Add progress bar when radical dictionary is updated
.gitignore
7 | 7 | /.idea/workspace.xml | |
8 | 8 | /.idea/navEditor.xml | |
9 | 9 | /.idea/assetWizardSettings.xml | |
10 | + | /.idea/misc.xml | |
10 | 11 | .DS_Store | |
11 | 12 | /build | |
12 | 13 | /captures |
.idea/misc.xml
4 | 4 | <option name="filePathToZoomLevelMap"> | |
5 | 5 | <map> | |
6 | 6 | <entry key="../../../../../../layout/custom_preview.xml" value="0.23385416666666667" /> | |
7 | + | <entry key="app/src/main/res/drawable/ic_border_bottom.xml" value="0.1535" /> | |
7 | 8 | <entry key="app/src/main/res/drawable/ic_pitch.xml" value="0.1535" /> | |
8 | 9 | <entry key="app/src/main/res/drawable/ic_rad.xml" value="0.1535" /> | |
9 | 10 | <entry key="app/src/main/res/drawable/ic_reading.xml" value="0.1535" /> | |
10 | 11 | <entry key="app/src/main/res/layout/activity_main.xml" value="0.2078125" /> | |
11 | 12 | <entry key="app/src/main/res/layout/content_main.xml" value="0.2078125" /> | |
12 | - | <entry key="app/src/main/res/layout/content_radicals.xml" value="0.2078125" /> | |
13 | + | <entry key="app/src/main/res/layout/content_radicals.xml" value="0.1" /> | |
13 | 14 | <entry key="app/src/main/res/layout/fragment_results.xml" value="0.2078125" /> | |
14 | 15 | <entry key="app/src/main/res/layout/layout_result.xml" value="0.2078125" /> | |
15 | 16 | <entry key="app/src/main/res/xml/preferences.xml" value="0.2078125" /> |
app/src/main/java/eu/lepiller/nani/RadicalSelectorFragment.java
10 | 10 | import android.view.View; | |
11 | 11 | import android.widget.Button; | |
12 | 12 | import android.widget.LinearLayout; | |
13 | + | import android.widget.ProgressBar; | |
13 | 14 | import android.widget.TextView; | |
14 | 15 | import android.widget.ToggleButton; | |
15 | 16 | ||
… | |||
39 | 40 | ||
40 | 41 | private LinearLayout kanji_row1, kanji_row2; | |
41 | 42 | private LinearLayout radical_table; | |
43 | + | private ProgressBar radical_load; | |
42 | 44 | ||
43 | 45 | final List<String> selected = new ArrayList<>(); | |
44 | 46 | ||
… | |||
61 | 63 | kanji_row1 = getView().findViewById(R.id.kanji_row1); | |
62 | 64 | kanji_row2 = getView().findViewById(R.id.kanji_row2); | |
63 | 65 | radical_table = getView().findViewById(R.id.radical_table); | |
66 | + | radical_load = getView().findViewById(R.id.radical_load); | |
67 | + | ||
68 | + | radical_load.setIndeterminate(true); | |
69 | + | if(dictionary == null) { | |
70 | + | radical_load.setVisibility(View.VISIBLE); | |
71 | + | kanji_row1.setVisibility(View.GONE); | |
72 | + | kanji_row2.setVisibility(View.GONE); | |
73 | + | radical_table.setVisibility(View.GONE); | |
74 | + | } else { | |
75 | + | radical_load.setVisibility(View.GONE); | |
76 | + | kanji_row1.setVisibility(View.VISIBLE); | |
77 | + | kanji_row2.setVisibility(View.VISIBLE); | |
78 | + | radical_table.setVisibility(View.VISIBLE); | |
79 | + | } | |
64 | 80 | ||
65 | 81 | close_button.setOnClickListener((View v) -> { | |
66 | 82 | Bundle result = new Bundle(); | |
… | |||
143 | 159 | ||
144 | 160 | public void setDictionary(RadicalDict dict) { | |
145 | 161 | dictionary = dict; | |
162 | + | ||
163 | + | radical_load.setVisibility(View.VISIBLE); | |
164 | + | kanji_row1.setVisibility(View.GONE); | |
165 | + | kanji_row2.setVisibility(View.GONE); | |
166 | + | radical_table.setVisibility(View.GONE); | |
167 | + | ||
146 | 168 | new Thread(dictionaryUpdate).start(); | |
147 | 169 | } | |
148 | 170 | ||
… | |||
201 | 223 | box.setFlexWrap(FlexWrap.WRAP); | |
202 | 224 | box.invalidate(); | |
203 | 225 | } | |
226 | + | ||
227 | + | radical_load.setVisibility(View.GONE); | |
228 | + | kanji_row1.setVisibility(View.VISIBLE); | |
229 | + | kanji_row2.setVisibility(View.VISIBLE); | |
230 | + | radical_table.setVisibility(View.VISIBLE); | |
204 | 231 | } | |
205 | 232 | ||
206 | 233 | private void updateRadicals(Set<String> available) { |
app/src/main/res/layout/content_radicals.xml
4 | 4 | android:layout_height="match_parent" | |
5 | 5 | android:orientation="vertical"> | |
6 | 6 | ||
7 | + | <ProgressBar | |
8 | + | android:layout_width="match_parent" | |
9 | + | android:layout_height="wrap_content" | |
10 | + | android:id="@+id/radical_load" | |
11 | + | android:padding="8dp" | |
12 | + | style="?android:attr/progressBarStyleHorizontal" /> | |
13 | + | ||
7 | 14 | <HorizontalScrollView | |
8 | 15 | android:layout_width="match_parent" | |
9 | 16 | android:layout_height="wrap_content" |