Move about summary more/less expander button

This commit is contained in:
arkon 2020-06-23 08:51:51 -04:00
parent 4e633b8936
commit eb254d9c56
3 changed files with 37 additions and 25 deletions

View file

@ -293,17 +293,24 @@ class MangaInfoHeaderAdapter(
val isExpanded =
binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse)
binding.mangaInfoToggle.text =
if (isExpanded) {
with(binding.mangaInfoToggle) {
text = if (isExpanded) {
context.getString(R.string.manga_info_expand)
} else {
context.getString(R.string.manga_info_collapse)
}
icon = if (isExpanded) {
context.getDrawable(R.drawable.ic_baseline_expand_more_24dp)
} else {
context.getDrawable(R.drawable.ic_baseline_expand_less_24dp)
}
}
with(binding.mangaSummary) {
maxLines =
if (isExpanded) {
3
2
} else {
Int.MAX_VALUE
}

View file

@ -176,18 +176,33 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<TextView
android:id="@+id/manga_summary_label"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:layout_centerVertical="true"
android:text="@string/manga_info_about_label"
android:textIsSelectable="false" />
<com.google.android.material.button.MaterialButton
android:id="@+id/manga_info_toggle"
style="@style/Theme.Widget.Button.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/manga_info_expand"
app:icon="@drawable/ic_baseline_expand_more_24dp"
app:iconTint="?attr/colorOnPrimary" />
</RelativeLayout>
<TextView
android:id="@+id/manga_summary"
style="@style/TextAppearance.Regular.Body1.Secondary"
@ -198,7 +213,7 @@
android:clickable="true"
android:ellipsize="end"
android:focusable="true"
android:maxLines="3"
android:maxLines="2"
android:textIsSelectable="false"
tools:text="Summary" />
@ -237,16 +252,6 @@
</FrameLayout>
<Button
android:id="@+id/manga_info_toggle"
style="@style/Theme.Widget.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/manga_info_expand"
android:textSize="12sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -461,8 +461,8 @@
<string name="manga_added_library">Added to library</string>
<string name="manga_removed_library">Removed from library</string>
<string name="manga_info_about_label">About</string>
<string name="manga_info_expand">Show more info</string>
<string name="manga_info_collapse">Show less info</string>
<string name="manga_info_expand">More</string>
<string name="manga_info_collapse">Less</string>
<plurals name="manga_num_chapters">
<item quantity="one">1 chapter</item>
<item quantity="other">%1$s chapters</item>