Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved metadata layout, better tags accessibility #6463

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ private void setupMetadata(final LayoutInflater inflater,
addMetadataItem(inflater, layout, false,
R.string.metadata_category, streamInfo.getCategory());

addTagsMetadataItem(inflater, layout);

addMetadataItem(inflater, layout, false,
R.string.metadata_licence, streamInfo.getLicence());

Expand All @@ -177,6 +175,8 @@ private void setupMetadata(final LayoutInflater inflater,
R.string.metadata_host, streamInfo.getHost());
addMetadataItem(inflater, layout, true,
R.string.metadata_thumbnail_url, streamInfo.getThumbnailUrl());

addTagsMetadataItem(inflater, layout);
}

private void addMetadataItem(final LayoutInflater inflater,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/chip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<!-- 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 -->
<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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/Theme.MaterialComponents.DayNight.Bridge"
app:chipMinTouchTargetSize="40dp"
tools:text="I'm a correctly themed chip!" />
15 changes: 3 additions & 12 deletions app/src/main/res/layout/item_metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="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" />
android:paddingVertical="6dp">

<TextView
android:id="@+id/metadata_type_view"
android:layout_width="0dp"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:gravity="center_vertical|end"
android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Licence" />
Expand All @@ -35,7 +26,7 @@
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="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"
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." />

Expand Down
39 changes: 12 additions & 27 deletions app/src/main/res/layout/item_metadata_tags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,30 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<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" />
android:layout_height="match_parent"
android:fadeScrollbars="false">

<TextView
android:id="@+id/metadata_type_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical|end"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/metadata_tags"
android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<HorizontalScrollView
android:layout_width="0dp"
<com.google.android.material.chip.ChipGroup
android:id="@+id/metadata_tags_chips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="-8dp"
android:layout_marginBottom="-8dp"
android:fadeScrollbars="false"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintStart_toStartOf="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>