Show sense info.
app/src/main/java/eu/lepiller/nani/MainActivity.java
| 22 | 22 | import com.moji4j.MojiDetector; | |
| 23 | 23 | ||
| 24 | 24 | import java.util.ArrayList; | |
| 25 | + | import java.util.List; | |
| 25 | 26 | ||
| 26 | 27 | import eu.lepiller.nani.dictionary.DictionaryException; | |
| 27 | 28 | import eu.lepiller.nani.dictionary.DictionaryFactory; | |
… | |||
| 302 | 303 | for (Result.Sense sense : result.getSenses()) { | |
| 303 | 304 | View child = getLayoutInflater().inflate(R.layout.layout_sense, senses_view, false); | |
| 304 | 305 | TextView id_view = child.findViewById(R.id.id_view); | |
| 306 | + | TextView infos_view = child.findViewById(R.id.infos_view); | |
| 305 | 307 | TextView sense_view = child.findViewById(R.id.definition_view); | |
| 306 | 308 | ||
| 307 | 309 | id_view.setText(String.format(getResources().getString(R.string.sense_number), sense_pos)); | |
| 308 | 310 | ||
| 309 | 311 | StringBuilder sb = new StringBuilder(); | |
| 310 | 312 | boolean separator1 = false; | |
| 313 | + | for(String s : sense.getInfos()) { | |
| 314 | + | if (separator1) | |
| 315 | + | sb.append(getResources().getString(R.string.sense_separator)); | |
| 316 | + | else | |
| 317 | + | separator1 = true; | |
| 318 | + | sb.append(s); | |
| 319 | + | } | |
| 320 | + | if(separator1) | |
| 321 | + | infos_view.setVisibility(View.VISIBLE); | |
| 322 | + | infos_view.setText(sb.toString()); | |
| 323 | + | ||
| 324 | + | sb = new StringBuilder(); | |
| 325 | + | separator1 = false; | |
| 311 | 326 | for (String s : sense.getGlosses()) { | |
| 312 | 327 | if (separator1) | |
| 313 | 328 | sb.append(getResources().getString(R.string.sense_separator)); | |
app/src/main/java/eu/lepiller/nani/result/Result.java
| 41 | 41 | public ArrayList<String> getGlosses() { | |
| 42 | 42 | return glosses; | |
| 43 | 43 | } | |
| 44 | + | ||
| 45 | + | public List<String> getInfos() { | |
| 46 | + | return infos; | |
| 47 | + | } | |
| 44 | 48 | } | |
| 45 | 49 | ||
| 46 | 50 | public static class Reading { |
app/src/main/res/layout/layout_sense.xml
| 13 | 13 | android:layout_marginRight="16dp" | |
| 14 | 14 | android:text="id" /> | |
| 15 | 15 | ||
| 16 | - | <TextView | |
| 17 | - | android:id="@+id/definition_view" | |
| 16 | + | <LinearLayout | |
| 18 | 17 | android:layout_width="0dp" | |
| 19 | 18 | android:layout_height="wrap_content" | |
| 20 | - | android:layout_margin="8dp" | |
| 21 | 19 | android:layout_weight="1" | |
| 22 | - | android:text="definition" /> | |
| 20 | + | android:orientation="vertical"> | |
| 21 | + | ||
| 22 | + | <TextView | |
| 23 | + | android:id="@+id/infos_view" | |
| 24 | + | android:layout_width="match_parent" | |
| 25 | + | android:layout_height="wrap_content" | |
| 26 | + | android:layout_margin="8dp" | |
| 27 | + | android:text="infos" | |
| 28 | + | android:visibility="gone" | |
| 29 | + | android:textColor="@color/colorTextGrey" | |
| 30 | + | android:textStyle="italic" /> | |
| 31 | + | ||
| 32 | + | <TextView | |
| 33 | + | android:id="@+id/definition_view" | |
| 34 | + | android:layout_width="match_parent" | |
| 35 | + | android:layout_height="wrap_content" | |
| 36 | + | android:layout_margin="8dp" | |
| 37 | + | android:text="definition" /> | |
| 38 | + | </LinearLayout> | |
| 23 | 39 | </LinearLayout> | |
| 23 | 39 | = | |
| 24 | 40 | = | \ No newline at end of file |
app/src/main/res/values/colors.xml
| 7 | 7 | <color name="colorUpdate">#F4DE96</color> | |
| 8 | 8 | <color name="colorDarkerGrey">#e0e3e0</color> | |
| 9 | 9 | <color name="colorDarkGrey">#d2d5d2</color> | |
| 10 | + | <color name="colorTextGrey">#909090</color> | |
| 10 | 11 | <color name="colorBlack">#505050</color> | |
| 11 | 12 | </resources> |