Put info on the same textview as sense
app/src/main/java/eu/lepiller/nani/MainActivity.java
9 | 9 | import androidx.appcompat.widget.Toolbar; | |
10 | 10 | import androidx.preference.PreferenceManager; | |
11 | 11 | ||
12 | + | import android.text.Html; | |
12 | 13 | import android.util.Log; | |
13 | 14 | import android.view.View; | |
14 | 15 | import android.view.Menu; | |
… | |||
328 | 329 | View child = getLayoutInflater().inflate(R.layout.layout_sense, senses_view, false); | |
329 | 330 | TextView id_view = child.findViewById(R.id.id_view); | |
330 | 331 | TextView lang_view = child.findViewById(R.id.lang_view); | |
331 | - | TextView infos_view = child.findViewById(R.id.infos_view); | |
332 | 332 | TextView sense_view = child.findViewById(R.id.definition_view); | |
333 | 333 | ||
334 | 334 | id_view.setText(String.format(getResources().getString(R.string.sense_number), sense_pos)); | |
335 | 335 | lang_view.setText(sense.getLanguage()); | |
336 | 336 | ||
337 | 337 | StringBuilder sb = new StringBuilder(); | |
338 | + | sb.append("<font color=\"#909090\"><i>"); | |
338 | 339 | boolean separator1 = false; | |
339 | 340 | for(String s : sense.getInfos()) { | |
340 | 341 | if (separator1) | |
… | |||
343 | 344 | separator1 = true; | |
344 | 345 | sb.append(s); | |
345 | 346 | } | |
347 | + | sb.append("</i></font>"); | |
346 | 348 | if(separator1) | |
347 | - | infos_view.setVisibility(View.VISIBLE); | |
348 | - | infos_view.setText(sb.toString()); | |
349 | + | sb.append(" "); | |
349 | 350 | ||
350 | - | sb = new StringBuilder(); | |
351 | 351 | separator1 = false; | |
352 | 352 | for (String s : sense.getGlosses()) { | |
353 | 353 | if (separator1) | |
… | |||
356 | 356 | separator1 = true; | |
357 | 357 | sb.append(s); | |
358 | 358 | } | |
359 | - | sense_view.setText(sb.toString()); | |
359 | + | sense_view.setText(Html.fromHtml(sb.toString())); | |
360 | 360 | ||
361 | 361 | senses_view.addView(child); | |
362 | 362 | sense_pos++; |
app/src/main/res/layout/layout_sense.xml
25 | 25 | android:layout_marginStart="8dp" | |
26 | 26 | android:text="lang" /> | |
27 | 27 | ||
28 | - | <LinearLayout | |
29 | - | android:layout_width="0dp" | |
28 | + | <TextView | |
29 | + | android:id="@+id/definition_view" | |
30 | + | android:layout_width="match_parent" | |
30 | 31 | android:layout_height="wrap_content" | |
31 | - | android:layout_weight="1" | |
32 | - | android:orientation="vertical"> | |
33 | - | ||
34 | - | <TextView | |
35 | - | android:id="@+id/infos_view" | |
36 | - | android:layout_width="match_parent" | |
37 | - | android:layout_height="wrap_content" | |
38 | - | android:layout_margin="8dp" | |
39 | - | android:text="infos" | |
40 | - | android:visibility="gone" | |
41 | - | android:textColor="@color/colorTextGrey" | |
42 | - | android:textStyle="italic" /> | |
43 | - | ||
44 | - | <TextView | |
45 | - | android:id="@+id/definition_view" | |
46 | - | android:layout_width="match_parent" | |
47 | - | android:layout_height="wrap_content" | |
48 | - | android:layout_margin="8dp" | |
49 | - | android:text="definition" /> | |
50 | - | </LinearLayout> | |
32 | + | android:layout_margin="8dp" | |
33 | + | android:text="definition" /> | |
51 | 34 | </LinearLayout> | |
51 | 34 | = | |
52 | 35 | = | \ No newline at end of file |