Improve layouts and images

Julien LepillerFri Apr 19 21:29:05+0200 2019

4297e60

Improve layouts and images

app/src/main/java/eu/lepiller/nani/DictionaryDownloadActivity.java

4848
4949
        TextView description_view = findViewById(R.id.additional_info_view);
5050
        description_view.setText(d.getDescription());
51+
        TextView full_description_view = findViewById(R.id.extended_info_view);
52+
        full_description_view.setText(d.getFullDescription());
5153
5254
        download_bar = findViewById(R.id.download_progress);
5355
        download_bar.setProgress(0);

8183
        LinearLayout remove_layout = findViewById(R.id.remove_layout);
8284
        remove_layout.setVisibility(d.isDownloaded()? View.VISIBLE: View.INVISIBLE);
8385
86+
        TextView size_view = findViewById(R.id.size_view);
87+
        size_view.setText(String.format(getResources().getString(R.string.dictionary_size), d.getSize()));
88+
8489
        download_button.setOnClickListener(new View.OnClickListener() {
8590
            @Override
8691
            public void onClick(View v) {

app/src/main/java/eu/lepiller/nani/dictionary/DictionariesAdapter.java

3535
        }
3636
3737
        // Lookup view for data population
38-
        ImageView icon_view = (ImageView) convertView.findViewById(R.id.icon_view);
39-
        TextView name_view = (TextView) convertView.findViewById(R.id.name_view);
40-
        TextView description_view = (TextView) convertView.findViewById(R.id.additional_info_view);
38+
        ImageView icon_view = convertView.findViewById(R.id.icon_view);
39+
        TextView name_view = convertView.findViewById(R.id.name_view);
40+
        TextView description_view = convertView.findViewById(R.id.additional_info_view);
4141
4242
        // Populate the data into the template view using the data object
4343
        Drawable icon = dictionary.getDrawable(context);
4444
        if(icon != null) {
45+
            icon = icon.getConstantState().newDrawable().mutate();
46+
            if(!dictionary.isDownloaded())
47+
                icon.setAlpha(64);
48+
            else
49+
                icon.setAlpha(255);
4550
            icon_view.setImageDrawable(icon);
4651
        }
4752

app/src/main/res/drawable-v24/ic_launcher_foreground.xml

11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
    xmlns:aapt="http://schemas.android.com/aapt"
32
    android:width="108dp"
43
    android:height="108dp"
54
    android:viewportWidth="108"
65
    android:viewportHeight="108">
76
    <group
87
        android:rotation="-15"
9-
        android:translateX="-10"
10-
        android:translateY="50"
11-
        android:scaleX="0.4"
12-
        android:scaleY="0.4">
8+
        android:translateX="12"
9+
        android:translateY="60"
10+
        android:scaleX="0.3"
11+
        android:scaleY="0.3">
1312
        <path
1413
            android:fillColor="#EEF2EE"
1514
            android:pathData="M 92.727991,-65.332249 H 210.47799 v 14.25 h -15 v 128.25 q 0,10.5 -3.75,15 -3.75,4.499999 -14.25,4.499999 -9,0 -17.25,-2.249999 l -3,-14.25 q 9,2.25 18,2.25 5.25,0 5.25,-9 v -124.5 H 92.727991 Z m 65.999999,43.5 v 66 h -42.75 v 10.5 h -14.25 v -76.5 z m -42.75,52.5 h 28.5 V -9.0822506 h -28.5 z m -39.749999,-106.5 15,4.5 q -6,17.25 -13.5,34.5 V 96.66775 h -15 V -8.3322506 q -9,14.2499999 -18.75,26.2500016 l -7.5,-15.0000016 q 27.75,-37.4999984 39.75,-78.7499984 z" />

app/src/main/res/layout/activity_dictionary_download.xml

4141
        android:id="@+id/additional_info_view"
4242
        android:layout_width="wrap_content"
4343
        android:layout_height="wrap_content"
44-
        android:layout_margin="8dp"
4544
        android:layout_marginStart="8dp"
4645
        android:layout_marginLeft="8dp"
4746
        android:layout_marginTop="8dp"
4847
        android:layout_marginEnd="8dp"
4948
        android:layout_marginRight="8dp"
49+
        android:padding="8dp"
5050
        android:text="Description"
5151
        app:layout_constraintEnd_toEndOf="parent"
5252
        app:layout_constraintStart_toStartOf="parent"
5353
        app:layout_constraintTop_toBottomOf="@+id/linearLayout2" />
5454
55+
    <TextView
56+
        android:id="@+id/extended_info_view"
57+
        android:layout_width="wrap_content"
58+
        android:layout_height="wrap_content"
59+
        android:layout_marginStart="8dp"
60+
        android:layout_marginLeft="8dp"
61+
        android:layout_marginTop="8dp"
62+
        android:layout_marginEnd="8dp"
63+
        android:layout_marginRight="8dp"
64+
        android:padding="8dp"
65+
        android:text="Description"
66+
        app:layout_constraintEnd_toEndOf="parent"
67+
        app:layout_constraintStart_toStartOf="parent"
68+
        app:layout_constraintTop_toBottomOf="@+id/additional_info_view" />
69+
5570
    <LinearLayout
5671
        android:id="@+id/linearLayout3"
5772
        android:layout_width="match_parent"

6378
        android:layout_marginRight="8dp"
6479
        android:orientation="horizontal"
6580
        app:layout_constraintEnd_toEndOf="parent"
81+
        app:layout_constraintHorizontal_bias="0.0"
6682
        app:layout_constraintStart_toStartOf="parent"
67-
        app:layout_constraintTop_toBottomOf="@+id/additional_info_view">
83+
        app:layout_constraintTop_toBottomOf="@+id/extended_info_view">
6884
6985
        <ProgressBar
7086
            android:id="@+id/download_progress"

101117
            android:layout_margin="8dp"
102118
            android:layout_marginTop="8dp"
103119
            android:layout_marginBottom="8dp"
104-
            android:layout_weight="1"
105-
            android:text="TextView" />
120+
            android:layout_weight="1" />
106121
107122
        <ImageButton
108123
            android:id="@+id/remove_button"