1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-29 21:42:33 +01:00

Merge pull request #6463 from Stypox/metadata-tags

Improved metadata layout, better tags accessibility
This commit is contained in:
Tobi 2021-07-12 16:18:11 +02:00 committed by GitHub
commit 96f5cd9f17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 41 deletions

View File

@ -151,8 +151,6 @@ public class DescriptionFragment extends BaseFragment {
addMetadataItem(inflater, layout, false, addMetadataItem(inflater, layout, false,
R.string.metadata_category, streamInfo.getCategory()); R.string.metadata_category, streamInfo.getCategory());
addTagsMetadataItem(inflater, layout);
addMetadataItem(inflater, layout, false, addMetadataItem(inflater, layout, false,
R.string.metadata_licence, streamInfo.getLicence()); R.string.metadata_licence, streamInfo.getLicence());
@ -174,6 +172,8 @@ public class DescriptionFragment extends BaseFragment {
R.string.metadata_host, streamInfo.getHost()); R.string.metadata_host, streamInfo.getHost());
addMetadataItem(inflater, layout, true, addMetadataItem(inflater, layout, true,
R.string.metadata_thumbnail_url, streamInfo.getThumbnailUrl()); R.string.metadata_thumbnail_url, streamInfo.getThumbnailUrl());
addTagsMetadataItem(inflater, layout);
} }
private void addMetadataItem(final LayoutInflater inflater, private void addMetadataItem(final LayoutInflater inflater,

View File

@ -2,8 +2,10 @@
<!-- This is used to inflate a chip with a Material theme, otherwise it would crash --> <!-- This is used to inflate a chip with a Material theme, otherwise it would crash -->
<!-- Theme.MaterialComponents.DayNight is used to guarantee auto day/night switching --> <!-- Theme.MaterialComponents.DayNight is used to guarantee auto day/night switching -->
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android" <com.google.android.material.chip.Chip 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/Theme.MaterialComponents.DayNight.Bridge" android:theme="@style/Theme.MaterialComponents.DayNight.Bridge"
app:chipMinTouchTargetSize="40dp"
tools:text="I'm a correctly themed chip!" /> tools:text="I'm a correctly themed chip!" />

View File

@ -4,26 +4,17 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="6dp" android:paddingVertical="6dp">
android:paddingBottom="6dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.30" />
<TextView <TextView
android:id="@+id/metadata_type_view" android:id="@+id/metadata_type_view"
android:layout_width="0dp" android:layout_width="96dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical|end" android:gravity="center_vertical|end"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Licence" /> tools:text="Licence" />
@ -35,7 +26,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintStart_toEndOf="@+id/metadata_type_view"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum." /> tools:text="Description Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum." />

View File

@ -2,45 +2,30 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
android:fadeScrollbars="false">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.30" />
<TextView <TextView
android:id="@+id/metadata_type_view"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical|end" android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/metadata_tags" android:text="@string/metadata_tags"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<HorizontalScrollView <com.google.android.material.chip.ChipGroup
android:layout_width="0dp" android:id="@+id/metadata_tags_chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginTop="8dp"
android:layout_marginTop="-8dp"
android:layout_marginBottom="-8dp"
android:fadeScrollbars="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toBottomOf="@+id/metadata_type_view" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/metadata_tags_chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.MaterialComponents.Chip"
app:singleLine="true" />
</HorizontalScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>