Refactor dimens

Refactor the dimen naming/use across the app.
This commit is contained in:
OxygenCobalt 2020-10-12 11:56:33 -06:00
parent a2409a5718
commit 09d4e107e0
20 changed files with 99 additions and 96 deletions

View file

@ -6,7 +6,7 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity
import org.oxycblt.auxio.theme.accent
// FIXME: Fix bug where fast navigation will break the fade animation and
// FIXME: Fix bug where fast navigation will break the animations and
// lead to nothing being displayed [Possibly Un-fixable]
class MainActivity : AppCompatActivity(R.layout.activity_main) {

View file

@ -50,8 +50,6 @@ class PlaybackFragment : Fragment() {
// Make marquee scroll work
binding.playbackSong.isSelected = true
binding.playbackAlbum.isSelected = true
binding.playbackArtist.isSelected = true
// --- VIEWMODEL SETUP --

View file

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?><!--
Stationary animation used so that PlaybackFragment can slide w/o MainFragment sliding as well.
https://stackoverflow.com/a/64314693/14143986
-->
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"

View file

@ -16,6 +16,6 @@ https://stackoverflow.com/a/61157571/14143986
<item>
<ripple
android:color="@color/selection_color"
android:radius="@dimen/divider_ripple_size"></ripple>
android:radius="@dimen/size_divider_ripple"></ripple>
</item>
</layer-list>

View file

@ -41,8 +41,8 @@
<ImageView
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_width="@dimen/size_cover_huge"
android:layout_height="@dimen/size_cover_huge"
android:layout_marginTop="@dimen/margin_medium"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
@ -61,9 +61,9 @@
android:layout_marginEnd="@dimen/margin_medium"
android:maxLines="1"
android:text="@{album.name}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeMaxTextSize="@dimen/text_size_header_max"
app:autoSizeMinTextSize="@dimen/text_size_min"
app:autoSizeStepGranularity="@dimen/text_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -37,13 +37,12 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical">
android:animateLayoutChanges="true">
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_width="@dimen/size_cover_huge"
android:layout_height="@dimen/size_cover_huge"
android:layout_marginTop="@dimen/margin_medium"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:artistImage="@{artist}"
@ -61,9 +60,9 @@
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:text="@{artist.name}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeMaxTextSize="@dimen/text_size_header_max"
app:autoSizeMinTextSize="@dimen/text_size_min"
app:autoSizeStepGranularity="@dimen/text_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -27,7 +27,7 @@
android:id="@+id/playback_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/playback_progress_size"
android:layout_height="@dimen/height_compact_progress"
android:clickable="false"
android:progressBackgroundTint="?android:attr/colorControlNormal"
android:progressTint="?android:attr/colorPrimary"
@ -37,10 +37,10 @@
<ImageView
android:id="@+id/playback_cover"
android:layout_width="@dimen/cover_size_compact"
android:layout_height="@dimen/cover_size_compact"
android:layout_width="@dimen/size_cover_compact"
android:layout_height="@dimen/size_cover_compact"
android:contentDescription="@{@string/description_album_cover(song.name)}"
android:layout_margin="@dimen/margin_smallish"
android:layout_margin="@dimen/margin_mid_small"
app:coverArt="@{song}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -51,8 +51,8 @@
android:id="@+id/playback_song"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_smallish"
android:layout_marginEnd="@dimen/margin_smallish"
android:layout_marginStart="@dimen/margin_mid_small"
android:layout_marginEnd="@dimen/margin_mid_small"
android:ellipsize="marquee"
android:fontFamily="@font/inter_semibold"
android:marqueeRepeatLimit="marquee_forever"
@ -70,8 +70,8 @@
android:id="@+id/playback_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_smallish"
android:layout_marginEnd="@dimen/margin_smallish"
android:layout_marginStart="@dimen/margin_mid_small"
android:layout_marginEnd="@dimen/margin_mid_small"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
@ -86,10 +86,10 @@
<ImageButton
android:id="@+id/playback_controls"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_marginEnd="@dimen/margin_smallish"
android:layout_marginEnd="@dimen/margin_mid_small"
android:contentDescription="@{playbackModel.isPlaying ? @string/description_pause : @string/description_play}"
android:layout_width="@dimen/controls_size_compact"
android:layout_height="@dimen/controls_size_compact"
android:layout_width="@dimen/size_play_pause_compact"
android:layout_height="@dimen/size_play_pause_compact"
android:background="@drawable/ui_unbounded_ripple"
android:onClick="@{() -> playbackModel.invertPlayingStatus()}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -42,8 +42,8 @@
<ImageView
android:id="@+id/genre_image"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_width="@dimen/size_cover_huge"
android:layout_height="@dimen/size_cover_huge"
android:layout_marginTop="@dimen/margin_medium"
android:contentDescription="@{@string/description_genre_image(genre.name)}"
app:genreImage="@{genre}"
@ -61,9 +61,9 @@
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:text="@{genre.name}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeMaxTextSize="@dimen/text_size_header_max"
app:autoSizeMinTextSize="@dimen/text_size_min"
app:autoSizeStepGranularity="@dimen/text_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -32,8 +32,8 @@
<ImageView
android:id="@+id/loading_error_icon"
android:layout_width="@dimen/status_icon_size"
android:layout_height="@dimen/status_icon_size"
android:layout_width="@dimen/size_error_icon"
android:layout_height="@dimen/size_error_icon"
android:indeterminateTint="?attr/colorPrimary"
android:indeterminateTintMode="src_in"
android:src="@drawable/ic_error"

View file

@ -26,7 +26,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_menu_size"
android:layout_height="@dimen/height_tab_menu"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
android:elevation="@dimen/elevation_normal"

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layout 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"
tools:context=".playback.PlaybackFragment">
<data>
@ -38,7 +39,7 @@
android:id="@+id/playback_cover"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/margin_large"
android:layout_margin="@dimen/margin_mid_large"
android:contentDescription="@{@string/description_album_cover(song.name)}"
app:layout_constraintDimensionRatio="1:1"
app:coverArt="@{song}"
@ -53,12 +54,12 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:fontFamily="@font/inter_semibold"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:layout_marginStart="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_large"
android:layout_marginStart="@dimen/margin_mid_large"
android:layout_marginEnd="@dimen/margin_mid_large"
android:text="@{song.name}"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
@ -71,11 +72,10 @@
android:id="@+id/playback_artist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="end"
android:singleLine="true"
android:layout_marginStart="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_large"
android:layout_marginStart="@dimen/margin_mid_large"
android:layout_marginEnd="@dimen/margin_mid_large"
android:text="@{song.album.artist.name}"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textColor="?android:attr/textColorSecondary"
@ -88,10 +88,9 @@
android:id="@+id/playback_album"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:layout_marginStart="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_large"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="end"
android:layout_marginStart="@dimen/margin_mid_large"
android:layout_marginEnd="@dimen/margin_mid_large"
android:layout_marginBottom="@dimen/margin_medium"
android:singleLine="true"
android:text="@{song.album.name}"
@ -107,8 +106,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_medium"
android:paddingStart="@dimen/margin_large"
android:paddingEnd="@dimen/margin_large"
android:paddingStart="@dimen/margin_mid_large"
android:paddingEnd="@dimen/margin_mid_large"
android:progressBackgroundTint="?android:attr/colorControlNormal"
android:progressTint="?android:attr/colorPrimary"
android:splitTrack="false"
@ -120,8 +119,8 @@
<ImageButton
android:id="@+id/playback_play_pause"
android:layout_width="@dimen/controls_size"
android:layout_height="@dimen/controls_size"
android:layout_width="@dimen/size_play_pause"
android:layout_height="@dimen/size_play_pause"
android:layout_marginBottom="40dp"
android:background="@drawable/ui_circular_button"
android:backgroundTint="?android:attr/colorPrimary"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:layout_width="@dimen/size_cover_normal"
android:layout_height="@dimen/size_cover_normal"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -21,18 +21,18 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/song_track"
android:layout_width="@dimen/track_number_width"
android:layout_width="@dimen/width_track_number"
android:layout_height="wrap_content"
android:text="@{String.valueOf(song.track)}"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/track_number_text_size_max"
android:textSize="@dimen/text_size_track_max"
android:maxLines="1"
android:contentDescription="@{@string/description_track_number(song.track)}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeMaxTextSize="@dimen/text_size_header_max"
app:autoSizeMinTextSize="@dimen/text_size_min"
app:autoSizeStepGranularity="@dimen/text_size_increment"
android:gravity="center"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:layout_width="@dimen/size_cover_normal"
android:layout_height="@dimen/size_cover_normal"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:layout_width="@dimen/size_cover_large"
android:layout_height="@dimen/size_cover_large"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/genre_image"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:layout_width="@dimen/size_cover_normal"
android:layout_height="@dimen/size_cover_normal"
app:genreImage="@{genre}"
android:contentDescription="@{@string/description_genre_image(genre.name)}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:layout_width="@dimen/size_cover_large"
android:layout_height="@dimen/size_cover_large"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_compact"
android:layout_height="@dimen/cover_size_compact"
android:layout_width="@dimen/size_cover_compact"
android:layout_height="@dimen/size_cover_compact"
android:contentDescription="@{@string/description_album_cover(song.name)}"
app:coverArt="@{song}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -1,40 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TODO: Do dimens refactoring -->
<!-- Padding Namespace | Dimens for padding attributes -->
<dimen name="padding_tiny">4dp</dimen>
<dimen name="padding_small">8dp</dimen>
<dimen name="padding_medium">16dp</dimen>
<dimen name="padding_mid_large">24dp</dimen>
<dimen name="padding_large">32dp</dimen>
<dimen name="padding_huge">64dp</dimen>
<!-- Margin namespace | Dimens for margin attributes -->
<dimen name="margin_small">8dp</dimen>
<dimen name="margin_smallish">10dp</dimen>
<dimen name="margin_mid_small">10dp</dimen>
<dimen name="margin_medium">16dp</dimen>
<dimen name="margin_large">24dp</dimen>
<dimen name="margin_mid_large">24dp</dimen>
<dimen name="margin_large">32dp</dimen>
<dimen name="margin_huge">64dp</dimen>
<dimen name="status_icon_size">48dp</dimen>
<!-- Height Namespace | Height for UI elements -->
<dimen name="height_tab_menu">40dp</dimen>
<dimen name="height_compact_progress">2dp</dimen>
<dimen name="tab_menu_size">40dp</dimen>
<!-- Width Namespace | Width for UI elements -->
<dimen name="width_track_number">32dp</dimen>
<dimen name="cover_size_small">36dp</dimen>
<dimen name="cover_size_compact">44dp</dimen>
<dimen name="cover_size_normal">56dp</dimen>
<dimen name="cover_size_large">68dp</dimen>
<dimen name="cover_size_huge">250dp</dimen>
<dimen name="cover_size_playback">110dp</dimen>
<!-- Size Namespace | Width & Heights for UI elements -->
<dimen name="size_error_icon">48dp</dimen>
<dimen name="size_divider_ripple">18dp</dimen>
<dimen name="size_cover_compact">44dp</dimen>
<dimen name="size_cover_normal">56dp</dimen>
<dimen name="size_cover_large">68dp</dimen>
<dimen name="size_cover_huge">250dp</dimen>
<dimen name="size_play_pause">70dp</dimen>
<dimen name="size_play_pause_compact">36dp</dimen>
<dimen name="track_number_width">32dp</dimen>
<dimen name="track_number_text_size_max">20sp</dimen>
<dimen name="detail_header_size_max">26sp</dimen>
<dimen name="generic_size_min">10sp</dimen>'
<dimen name="generic_size_increment">2sp</dimen>
<dimen name="divider_ripple_size">18dp</dimen>
<dimen name="playback_progress_size">2dp</dimen>
<dimen name="controls_size">70dp</dimen>
<dimen name="controls_size_compact">36dp</dimen>
<!-- Text Size Namespace | Text Sizes -->
<dimen name="text_size_min">10sp</dimen>
<dimen name="text_size_increment">2sp</dimen>
<dimen name="text_size_track_max">20sp</dimen>
<dimen name="text_size_header_max">26sp</dimen>
<!-- Misc -->
<dimen name="elevation_normal">4dp</dimen>
</resources>

View file

@ -25,7 +25,7 @@
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
<item name="android:textColor">?android:attr/colorPrimary</item>
<item name="android:fontFamily">@font/inter_black</item>
<item name="android:textSize">@dimen/detail_header_size_max</item>
<item name="android:textSize">@dimen/text_size_header_max</item>
</style>
<style name="TextAppearance.SmallHeader" parent="TextAppearance.MaterialComponents.Body2">