summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-12-03 12:16:40 +0100
committerByteHamster <info@bytehamster.com>2022-12-03 12:18:42 +0100
commitf5adc4e824eaa4fa2baa5a180c64efe56655a410 (patch)
treebafc1054e19b5f3abf4aa706534289d6ac66f039
parentbc3b7179112e986958bbb4773419ec94eb3aa67f (diff)
downloadAntennaPod-f5adc4e824eaa4fa2baa5a180c64efe56655a410.zip
Support for multi-line home section titles
-rw-r--r--app/src/main/res/layout/home_section.xml68
1 files changed, 41 insertions, 27 deletions
diff --git a/app/src/main/res/layout/home_section.xml b/app/src/main/res/layout/home_section.xml
index 783688f92..ea9c2ff3e 100644
--- a/app/src/main/res/layout/home_section.xml
+++ b/app/src/main/res/layout/home_section.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -12,32 +12,37 @@
<TextView
android:id="@+id/titleLabel"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_alignTop="@id/moreButton"
- android:layout_alignBottom="@id/moreButton"
- android:layout_alignParentStart="true"
- android:layout_alignParentLeft="true"
android:layout_marginStart="16dp"
- android:gravity="center"
- android:textAlignment="center"
+ android:textAlignment="textStart"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp"
+ android:layout_marginVertical="8dp"
+ app:layout_constraintWidth_max="wrap"
+ app:layout_constraintWidth_percent="0.6"
+ app:layout_constraintBottom_toBottomOf="@id/barrier"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintHorizontal_chainStyle="packed"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintWidth_default="wrap"
+ app:layout_constraintEnd_toStartOf="@id/shuffleButton"
tools:text="Title" />
<ImageButton
android:id="@+id/shuffleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignBottom="@+id/titleLabel"
- android:layout_alignParentTop="true"
android:layout_marginVertical="8dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
- android:layout_toEndOf="@+id/titleLabel"
- android:layout_toRightOf="@+id/titleLabel"
android:background="?attr/selectableItemBackgroundBorderless"
android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="@id/barrier"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toEndOf="@id/titleLabel"
+ app:layout_constraintEnd_toStartOf="@id/numNewItemsLabel"
tools:visibility="visible"
app:srcCompat="@drawable/ic_shuffle" />
@@ -45,47 +50,56 @@
android:id="@+id/numNewItemsLabel"
android:layout_width="wrap_content"
android:layout_height="20dp"
- android:layout_alignBottom="@+id/titleLabel"
- android:layout_alignParentTop="true"
android:layout_marginVertical="12dp"
android:layout_marginStart="8dp"
- android:layout_marginLeft="8dp"
- android:layout_toEndOf="@+id/titleLabel"
- android:layout_toRightOf="@+id/titleLabel"
android:background="@drawable/bg_pill"
- android:gravity="center"
android:paddingHorizontal="8dp"
android:textAlignment="center"
android:textColor="?attr/colorPrimary"
android:textSize="16sp"
android:visibility="gone"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="@id/barrier"
+ app:layout_constraintStart_toEndOf="@id/shuffleButton"
+ app:layout_constraintEnd_toStartOf="@id/moreButton"
tools:visibility="visible"
tools:text="6" />
<Button
android:id="@+id/moreButton"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:minWidth="0dp"
- android:layout_alignParentTop="true"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
android:paddingVertical="0dp"
android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ android:textAlignment="textEnd"
+ app:layout_constraintWidth_max="wrap"
+ app:layout_constraintWidth_percent="0.4"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="@id/barrier"
tools:text="@string/discover_more"
style="@style/Widget.MaterialComponents.Button.TextButton" />
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/barrier"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="titleLabel,moreButton" />
+
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/moreButton"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- android:layout_alignParentBottom="true"
android:clipToPadding="false"
android:clipToOutline="false"
android:clipChildren="false"
- android:paddingHorizontal="16dp" />
+ android:paddingHorizontal="16dp"
+ app:layout_constraintTop_toBottomOf="@id/barrier"
+ tools:listitem="@layout/horizontal_itemlist_item"
+ tools:itemCount="1" />
-</RelativeLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>