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 = val isExpanded =
binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse) binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse)
binding.mangaInfoToggle.text = with(binding.mangaInfoToggle) {
if (isExpanded) { text = if (isExpanded) {
context.getString(R.string.manga_info_expand) context.getString(R.string.manga_info_expand)
} else { } else {
context.getString(R.string.manga_info_collapse) 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) { with(binding.mangaSummary) {
maxLines = maxLines =
if (isExpanded) { if (isExpanded) {
3 2
} else { } else {
Int.MAX_VALUE Int.MAX_VALUE
} }

View File

@ -176,17 +176,32 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView <RelativeLayout
android:id="@+id/manga_summary_label"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:paddingStart="16dp"
android:layout_marginTop="8dp" android:paddingEnd="16dp">
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp" <TextView
android:text="@string/manga_info_about_label" android:id="@+id/manga_summary_label"
android:textIsSelectable="false" /> style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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 <TextView
android:id="@+id/manga_summary" android:id="@+id/manga_summary"
@ -198,7 +213,7 @@
android:clickable="true" android:clickable="true"
android:ellipsize="end" android:ellipsize="end"
android:focusable="true" android:focusable="true"
android:maxLines="3" android:maxLines="2"
android:textIsSelectable="false" android:textIsSelectable="false"
tools:text="Summary" /> tools:text="Summary" />
@ -237,16 +252,6 @@
</FrameLayout> </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 <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

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