image: refactor views

Refactor StyledImageView and ImageGroup into a new class called
CoverView.

This new view is more sensibly designed and should be capable of
handling non-square album covers when implemented.
This commit is contained in:
Alexander Capehart
2023-05-28 15:29:38 -06:00
parent 10d05b1f26
commit b7c15e0cc5
30 changed files with 517 additions and 611 deletions
@@ -6,14 +6,15 @@
android:layout_height="wrap_content"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<org.oxycblt.auxio.image.StyledImageView
<org.oxycblt.auxio.image.CoverView
android:id="@+id/playback_cover"
style="@style/Widget.Auxio.Image.Small"
android:layout_margin="@dimen/spacing_small"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
app:layout_constraintBottom_toTopOf="@+id/playback_progress_container"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_song_24" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/playback_song"
@@ -16,16 +16,17 @@
app:title="@string/lbl_playback"
tools:subtitle="@string/lbl_all_songs" />
<org.oxycblt.auxio.image.StyledImageView
<org.oxycblt.auxio.image.CoverView
android:id="@+id/playback_cover"
style="@style/Widget.Auxio.Image.Full"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginTop="@dimen/spacing_medium"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
app:layout_constraintBottom_toTopOf="@+id/playback_seek_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/playback_toolbar"
app:layout_constraintVertical_chainStyle="packed"
tools:staticIcon="@drawable/ic_song_24" />
app:layout_constraintVertical_chainStyle="packed" />
<!-- Playback information is wrapped in a container so that marquee doesn't break -->
+20 -10
View File
@@ -16,15 +16,25 @@
with us only overlaying the track number (and other elements) onto it.
-->
<org.oxycblt.auxio.image.ImageGroup
android:id="@+id/song_track_bg"
<org.oxycblt.auxio.image.CoverView
android:id="@+id/song_track_cover"
style="@style/Widget.Auxio.Image.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:staticIcon="@drawable/ic_song_24">
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/song_track_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_song_24"
android:scaleType="center"
android:contentDescription="@string/def_track"
android:visibility="invisible"
app:tint="@color/sel_on_cover_bg"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/song_track"
android:id="@+id/song_track_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
@@ -44,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="16" />
</org.oxycblt.auxio.image.ImageGroup>
</org.oxycblt.auxio.image.CoverView>
<TextView
@@ -56,8 +66,8 @@
android:textColor="@color/sel_selectable_text_primary"
app:layout_constraintBottom_toTopOf="@+id/song_duration"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_track_bg"
app:layout_constraintTop_toTopOf="@+id/song_track_bg"
app:layout_constraintStart_toEndOf="@+id/song_track_cover"
app:layout_constraintTop_toTopOf="@+id/song_track_cover"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Song Name" />
@@ -68,9 +78,9 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/song_track_bg"
app:layout_constraintBottom_toBottomOf="@+id/song_track_cover"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_track_bg"
app:layout_constraintStart_toEndOf="@+id/song_track_cover"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="16:16" />
@@ -10,14 +10,15 @@
android:paddingEnd="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.StyledImageView
<org.oxycblt.auxio.image.CoverView
android:id="@+id/detail_cover"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
style="@style/Widget.Auxio.Image.MidHuge"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:staticIcon="@drawable/ic_song_24" />
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/detail_type"
+18 -6
View File
@@ -10,15 +10,27 @@
android:paddingEnd="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.StyledImageView
android:id="@+id/disc_icon"
<org.oxycblt.auxio.image.CoverView
android:id="@+id/disc_cover"
style="@style/Widget.Auxio.Image.Small"
android:scaleType="matrix"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:staticIcon="@drawable/ic_album_24"
tools:ignore="ContentDescription" />
tools:ignore="ContentDescription">
<ImageView
android:id="@+id/disc_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_add_24"
android:scaleType="center"
app:tint="@color/sel_on_cover_bg"
tools:ignore="ContentDescription" />
</org.oxycblt.auxio.image.CoverView>
<TextView
android:id="@+id/disc_number"
@@ -29,7 +41,7 @@
android:textColor="@color/sel_selectable_text_primary"
app:layout_constraintBottom_toTopOf="@+id/disc_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/disc_icon"
app:layout_constraintStart_toEndOf="@+id/disc_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Disc 1" />
@@ -43,7 +55,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/disc_icon"
app:layout_constraintStart_toEndOf="@+id/disc_cover"
app:layout_constraintTop_toBottomOf="@+id/disc_number"
tools:text="Part 1" />
@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:background="@drawable/ui_item_ripple">
<org.oxycblt.auxio.image.ImageGroup
<org.oxycblt.auxio.image.CoverView
android:id="@+id/song_album_cover"
style="@style/Widget.Auxio.Image.Small"
android:layout_marginStart="@dimen/spacing_medium"
@@ -43,8 +43,7 @@
android:layout_marginBottom="@dimen/spacing_mid_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_song_24" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/song_name"
@@ -3,19 +3,33 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_mid_medium"
android:paddingEnd="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.ImageGroup
<org.oxycblt.auxio.image.CoverView
android:id="@+id/picker_image"
style="@style/Widget.Auxio.Image.Small"
android:contentDescription="@string/lbl_new_playlist"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:staticIcon="@drawable/ic_add_24" />
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false">
<ImageView
android:id="@+id/picker_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_add_24"
android:scaleType="center"
app:tint="@color/sel_on_cover_bg"
tools:ignore="ContentDescription" />
</org.oxycblt.auxio.image.CoverView>
<TextView
android:id="@+id/picker_name"
+2 -3
View File
@@ -10,13 +10,12 @@
android:paddingEnd="@dimen/spacing_mid_medium"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.ImageGroup
<org.oxycblt.auxio.image.CoverView
android:id="@+id/parent_image"
style="@style/Widget.Auxio.Image.Medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_artist_24" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/parent_name"
@@ -10,13 +10,12 @@
android:paddingEnd="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.ImageGroup
<org.oxycblt.auxio.image.CoverView
android:id="@+id/picker_image"
style="@style/Widget.Auxio.Image.Small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_song_24" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/picker_name"
+2 -3
View File
@@ -10,13 +10,12 @@
android:paddingEnd="@dimen/spacing_mid_medium"
android:paddingBottom="@dimen/spacing_mid_medium">
<org.oxycblt.auxio.image.ImageGroup
<org.oxycblt.auxio.image.CoverView
android:id="@+id/song_album_cover"
style="@style/Widget.Auxio.Image.Small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_song_24" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/song_name"