Add element information to kanji result view
.gitignore
| 1 | 1 | *.iml | |
| 2 | 2 | .gradle | |
| 3 | 3 | /local.properties | |
| 4 | + | /.idea/misc.xml | |
| 4 | 5 | /.idea/caches | |
| 5 | 6 | /.idea/libraries | |
| 6 | 7 | /.idea/modules.xml | |
| 7 | 8 | /.idea/workspace.xml | |
| 8 | 9 | /.idea/navEditor.xml | |
| 9 | 10 | /.idea/assetWizardSettings.xml | |
| 10 | - | /.idea/misc.xml | |
| 11 | 11 | .DS_Store | |
| 12 | 12 | /build | |
| 13 | 13 | /captures |
app/src/main/java/eu/lepiller/nani/ResultPagerAdapter.java
| 71 | 71 | ||
| 72 | 72 | TextView kanjiView = child_result.findViewById(R.id.kanji_view); | |
| 73 | 73 | TextView strokesView = child_result.findViewById(R.id.kanji_strokes); | |
| 74 | + | TextView elementsView = child_result.findViewById(R.id.kanji_elements); | |
| 74 | 75 | LinearLayout senses_view = child_result.findViewById(R.id.sense_view); | |
| 75 | 76 | TextView onView = child_result.findViewById(R.id.on_reading); | |
| 76 | 77 | TextView kunView = child_result.findViewById(R.id.kun_reading); | |
… | |||
| 80 | 81 | strokesView.setText(String.format(context.getResources().getQuantityString(R.plurals.kanji_stroke, result.getStroke()), | |
| 81 | 82 | result.getStroke())); | |
| 82 | 83 | ||
| 84 | + | elementsView.setText(String.format(context.getResources().getQuantityString(R.plurals.kanji_elements, result.getElements().size()), | |
| 85 | + | getContent(result.getElements()))); | |
| 86 | + | if(result.getElements().isEmpty()) | |
| 87 | + | elementsView.setVisibility(View.GONE); | |
| 88 | + | ||
| 83 | 89 | senses_view.removeAllViews(); | |
| 84 | 90 | Map<String, List<String>> meanings = new HashMap<>(); | |
| 85 | 91 | for(KanjiResult.Sense sense: result.getSenses()) { | |
app/src/main/java/eu/lepiller/nani/result/KanjiResult.java
| 108 | 108 | return stroke; | |
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | + | public List<String> getElements() { | |
| 112 | + | return elements; | |
| 113 | + | } | |
| 114 | + | ||
| 111 | 115 | public List<String> getKun() { | |
| 112 | 116 | return kun; | |
| 113 | 117 | } |
app/src/main/res/layout/layout_kanji.xml
| 61 | 61 | android:layout_marginLeft="8dp" | |
| 62 | 62 | android:layout_marginStart="8dp" | |
| 63 | 63 | android:id="@+id/nanori_reading" /> | |
| 64 | + | ||
| 65 | + | <TextView | |
| 66 | + | android:layout_width="match_parent" | |
| 67 | + | android:layout_height="wrap_content" | |
| 68 | + | android:layout_marginTop="8dp" | |
| 69 | + | android:layout_marginLeft="8dp" | |
| 70 | + | android:layout_marginStart="8dp" | |
| 71 | + | android:id="@+id/kanji_elements" /> | |
| 64 | 72 | </LinearLayout> | |
| 65 | 73 | ||
| 66 | 74 |
app/src/main/res/values/strings.xml
| 103 | 103 | <string name="kun_reading">kunyomi: %s</string> | |
| 104 | 104 | <string name="on_reading">onyomi: %s</string> | |
| 105 | 105 | <string name="nanori_reading">nanori: %s</string> | |
| 106 | + | <plurals name="kanji_elements"> | |
| 107 | + | <item quantity="one">element: %s</item> | |
| 108 | + | <item quantity="other">elements: %s</item> | |
| 109 | + | </plurals> | |
| 106 | 110 | ||
| 107 | 111 | <!-- About activity --> | |
| 108 | 112 | <string name="nani_about">???Nani???? is an offline Japanese dictionary for Android. It helps |