Update track number sizing

Use AppCompatTextView on the track number so that track numbers over 100 are not cut off. Sort of, track numbers over 100000 will be cut off, but I bet that will be rare in normal use.
This commit is contained in:
OxygenCobalt 2020-09-19 16:44:00 -06:00
parent 4d47dcd464
commit 309ed2dcff
6 changed files with 20 additions and 15 deletions

View file

@ -55,9 +55,6 @@ class MainFragment : Fragment() {
if (position > 0) {
tab.icon?.setTint(colorInactive)
}
// Init the fragment
fragmentAt(position)
}.attach()
// Set up the selected/deselected colors

View file

@ -82,7 +82,8 @@ fun TextView.bindArtistCounts(artist: Artist) {
text = context.getString(R.string.format_double_counts, albums, songs)
}
// TODO: Add option to just list all genres.
// Get the artist genre.
// TODO: Stub, add option to list all genres instead of just the most prominent
@BindingAdapter("artistGenre")
fun TextView.getArtistGenre(artist: Artist) {
text = artist.genre

View file

@ -56,9 +56,10 @@
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:text="@{album.name}"
android:maxLines="1"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/detail_header_size_min"
app:autoSizeStepGranularity="@dimen/detail_header_size_increment"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -57,8 +57,8 @@
android:layout_marginStart="@dimen/margin_medium"
android:text="@{artist.name}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/detail_header_size_min"
app:autoSizeStepGranularity="@dimen/detail_header_size_increment"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -18,17 +18,22 @@
android:focusable="true"
android:padding="@dimen/padding_medium">
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/track_number"
android:layout_width="@dimen/track_number_size"
android:layout_width="@dimen/track_number_width"
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"
android:textSize="@dimen/track_number_text_size_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"
android:gravity="center"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -16,12 +16,13 @@
<dimen name="cover_size_large">80dp</dimen>
<dimen name="cover_size_huge">230dp</dimen>
<dimen name="track_number_size">32dp</dimen>
<dimen name="track_number_text_size">20sp</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="detail_header_size_min">10sp</dimen>'
<dimen name="detail_header_size_increment">2sp</dimen>
<dimen name="generic_size_min">10sp</dimen>'
<dimen name="generic_size_increment">2sp</dimen>
<dimen name="elevation_normal">4dp</dimen>
</resources>