Code refactor with ConstraintLayout

main
Hemanth S 2020-05-14 19:07:15 +05:30
parent f32ef48e51
commit ebb22f6cc7
19 changed files with 316 additions and 442 deletions

View File

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.adapter.artist
import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
@ -66,12 +65,12 @@ class ArtistAdapter(
}
fun setColors(processor: MediaNotificationProcessor, holder: ViewHolder) {
holder.mask?.backgroundTintList = ColorStateList.valueOf(processor.primaryTextColor)
if (holder.paletteColorContainer != null) {
holder.paletteColorContainer?.setBackgroundColor(processor.backgroundColor)
holder.title?.setTextColor(processor.primaryTextColor)
}
holder.imageContainerCard?.setCardBackgroundColor(processor.backgroundColor)
holder.mask?.backgroundTintList = ColorStateList.valueOf(processor.backgroundColor)
}
private fun loadArtistImage(artist: Artist, holder: ViewHolder) {
@ -82,11 +81,6 @@ class ArtistAdapter(
.generatePalette(activity)
.build()
.into(object : RetroMusicColoredTarget(holder.image!!) {
override fun onLoadCleared(placeholder: Drawable?) {
super.onLoadCleared(placeholder)
//setColors(defaultFooterColor, holder)
}
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors, holder)
}

View File

@ -17,5 +17,5 @@
<gradient
android:angle="135"
android:endColor="@color/semi_transparent"
android:startColor="?attr/colorControlNormal" />
android:startColor="#80000000" />
</shape>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="156dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="?attr/rectSelector"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:civ_border="false"
app:retroCornerSize="78dp"
tools:src="@tools:sample/avatars" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingTop="12dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?android:attr/textColorPrimary"
tools:text="@tools:sample/full_names" />
</LinearLayout>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="?rectSelector"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:layout_width="196dp"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="vertical"
app:cardCornerRadius="6dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[17]" />
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:padding="10dp"
android:textAppearance="@style/TextViewNormal"
tools:text="Song title" />
</LinearLayout>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="196dp"
android:layout_margin="8dp"
app:cardCornerRadius="16dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@tools:sample/avatars" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/playSongs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="12dp"
android:background="@drawable/color_circle_gradient"
android:backgroundTint="@color/eighty_percent_black_overlay"
android:padding="8dp"
app:srcCompat="@drawable/ic_play_arrow_white_32dp" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingTop="6dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />
</LinearLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
@ -8,33 +8,38 @@
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="112dp"
android:layout_height="156dp"
android:layout_margin="4dp"
android:layout_margin="8dp"
app:cardCornerRadius="8dp"
app:cardElevation="4dp">
app:cardElevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
app:srcCompat="@drawable/default_album_art"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:srcCompat="@drawable/default_album_art"
tools:src="@tools:sample/avatars" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingStart="12dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
android:padding="8dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageContainer"
tools:ignore="MissingPrefix"
tools:text="@tools:sample/full_names" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,21 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="112dp"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="?attr/rectSelector"
android:orientation="vertical">
android:orientation="vertical"
android:padding="4dp">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/image"
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="112dp"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:retroCornerSize="56dp"
app:srcCompat="@drawable/default_artist_art"
tools:src="@tools:sample/avatars" />
android:layout_height="112dp"
app:cardCornerRadius="56dp"
app:cardElevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
app:srcCompat="@drawable/default_artist_art"
tools:src="@tools:sample/avatars" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
@ -25,5 +36,9 @@
android:gravity="center"
android:maxLines="2"
android:paddingTop="12dp"
android:textAppearance="@style/TextViewNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/imageContainer"
tools:text="@tools:sample/full_names" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -16,7 +16,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_margin="4dp"
app:cardCornerRadius="16dp">
@ -24,7 +23,8 @@
android:id="@+id/paletteColorContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/artist_card_gradient_effect">
android:background="@drawable/artist_card_gradient_effect"
tools:backgroundTint="@color/md_red_500">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/image"

View File

@ -5,27 +5,33 @@
android:id="@+id/imageContainerCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="?attr/rectSelector"
app:cardCornerRadius="6dp"
app:cardElevation="4dp"
app:cardUseCompatPadding="true">
app:cardCornerRadius="8dp"
app:cardElevation="4dp">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="112dp"
android:layout_height="156dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />
<FrameLayout
android:id="@+id/paletteColorContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
@ -33,9 +39,8 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:padding="8dp"
android:textAppearance="@style/TextViewNormal"
tools:text="@string/home" />
</FrameLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -4,65 +4,64 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="?attr/rectSelector"
android:clickable="true"
android:focusable="true"
tools:ignore="MissingPrefix">
android:focusable="true">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
tools:ignore="MissingPrefix">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<LinearLayout
android:layout_width="match_parent"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="12dp">
android:paddingHorizontal="8dp"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp"
android:singleLine="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:singleLine="true"
tools:text="@string/bug_report_summary" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
</FrameLayout>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_margin="4dp"
android:background="?attr/rectSelector"
android:clickable="true"
android:focusable="true"
@ -14,56 +14,53 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
tools:ignore="MissingPrefix">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/paletteColorContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?rectSelector"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<LinearLayout
android:layout_width="match_parent"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="12dp">
android:paddingHorizontal="8dp"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp"
android:singleLine="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:singleLine="true"
tools:text="@string/bug_report_summary" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>

View File

@ -11,7 +11,7 @@
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -28,37 +28,34 @@
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_margin="8dp"
app:civ_border="false"
app:civ_shadow="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:retroCornerSize="36dp"
app:srcCompat="@drawable/ic_person_flat"
app:srcCompat="@drawable/ic_account_white_24dp"
tools:srcCompat="@tools:sample/backgrounds/scenic[20]" />
<LinearLayout
android:layout_width="match_parent"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/icon"
tools:text="@tools:sample/full_names" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
tools:text="@tools:sample/full_names" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
app:lineHeightHint="24sp"
tools:text="@tools:sample/full_names" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"
app:lineHeightHint="24sp"
tools:text="@tools:sample/full_names" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -8,11 +8,11 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:contentPadding="12dp">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -25,23 +25,25 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextViewBody2"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:ignore="MissingPrefix" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingPrefix"
tools:text="$9" />
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="36dp"
android:layout_height="36dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/itemImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:scaleType="centerInside"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/itemPrice"
app:srcCompat="@drawable/ic_github_circle_white_24dp"
app:tint="?attr/colorControlNormal" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/itemImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
app:srcCompat="@drawable/ic_github_circle_white_24dp"
app:tint="?attr/colorControlNormal" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/itemTitle"
@ -49,6 +51,9 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextViewBody2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/itemImage"
tools:text="@tools:sample/full_names" />
<com.google.android.material.textview.MaterialTextView
@ -56,7 +61,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextViewBody1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/itemTitle"
tools:text="@tools:sample/full_names" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>

View File

@ -1,56 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_margin="2dp"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
android:padding="4dp"
tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:cardCornerRadius="8dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<code.name.monkey.retromusic.views.RetroShapeableImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:retroCornerSize="8dp"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="8dp">
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="2"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/imageContainer"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
tools:text="@string/bug_report_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,67 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="?rectSelector"
android:padding="4dp"
tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:civ_border="false"
app:civ_shadow="false"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
android:maxLines="2"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image"
tools:text="@tools:sample/lorem/random" />
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="@tools:sample/lorem/random" />
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:civ_border="false"
app:civ_shadow="false"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="4dp"
android:paddingTop="8dp"
android:paddingEnd="4dp"
android:paddingBottom="8dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="2dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
tools:text="@tools:sample/lorem" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
@ -8,12 +8,17 @@
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:id="@+id/imageContainer"
android:layout_width="156dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="true">
app:cardElevation="8dp"
app:cardPreventCornerOverlap="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
@ -26,11 +31,14 @@
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:padding="8dp"
android:textAppearance="@style/TextViewNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/imageContainer"
tools:text="Song name" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,57 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="?attr/rectSelector"
android:clickable="true"
android:focusable="true"
tools:ignore="MissingPrefix">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="4dp"
android:orientation="vertical"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/imageContainer"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?rectSelector"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_album_art"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<View
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shadow_up_home" />
</LinearLayout>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
android:scaleType="centerCrop"
android:transitionName="@string/transition_album_art"
tools:ignore="ContentDescription"
tools:src="@tools:sample/avatars" />
<View
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shadow_up_home" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
@ -65,8 +49,7 @@
android:paddingBottom="8dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000"
tools:text="@string/bug_report_summary" />
tools:text="@tools:sample/full_names" />
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
-
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -54,8 +54,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="8dp"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -34,7 +34,7 @@
<color name="blackColorSurface">#000000</color>
<color name="transparent">#00000000</color>
<color name="semi_transparent">#40000000</color>
<color name="semi_transparent">#20000000</color>
<!-- card colors -->
<color name="card_background">#ffffff</color>
<color name="card_shadow_1">#d4d4d4</color>