Skip to content

Commit

Permalink
Const text width for metadata; scrollable tags layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Stypox committed Jun 9, 2021
1 parent 56cd84c commit fa1d7ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 50 deletions.
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!" />
12 changes: 2 additions & 10 deletions app/src/main/res/layout/item_metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,15 @@
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" />

<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 +27,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
58 changes: 18 additions & 40 deletions app/src/main/res/layout/item_metadata_tags.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<HorizontalScrollView 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">
android:layout_height="wrap_content"
android:fadeScrollbars="false">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
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:orientation="vertical"
app:layout_constraintGuide_percent="0.30" />
app:singleLine="true">

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical|end"
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_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<HorizontalScrollView
android:layout_width="0dp"
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"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">

<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>
<TextView
android:layout_width="96dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical|end"
android:text="@string/metadata_tags"
android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" />
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>

0 comments on commit fa1d7ff

Please sign in to comment.