Improve the alignment of titleTextView and audioTrackTextView

This fulfills the following:
* both should never push content outside of the view
* there should be no wasted space
* `audioTrackTextView` is always aligned to the right
* both should grow equally but also respect their respective contents size first

Caveats:
* Currently the layout weight is distributed using "NestedWeights" which require a widget to be measured twice. According to Android Studio this might cause an exponential performane impact, however there is currently just a single nested component so the effect should be not noticeable
This commit is contained in:
litetex 2025-10-17 19:28:52 +02:00
parent 1547a83f2c
commit fc3d8b629b

View file

@ -119,15 +119,21 @@
tools:ignore="RtlHardcoded" />
<LinearLayout
android:id="@+id/metadataView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/metadataView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:gravity="top"
android:orientation="vertical"
tools:ignore="RtlHardcoded">
tools:ignore="NestedWeights,RtlHardcoded">
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/titleTextView"
@ -156,14 +162,20 @@
android:textColor="@android:color/white"
android:textSize="12sp"
tools:text="The Video Artist LONG very LONG very Long" />
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1">
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/audioTrackTextView"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_gravity="right"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center"
@ -176,6 +188,9 @@
tools:ignore="HardcodedText,RtlHardcoded"
tools:text="English (United States) original"
tools:visibility="visible" />
</FrameLayout>
</LinearLayout>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/qualityTextView"