Update header text style

Update the style of the header text further to be cleaner and to fix issues where the name would not be properly centered on smaller fonts.
This commit is contained in:
OxygenCobalt 2021-04-27 19:09:16 -06:00
parent c5c16dfdce
commit dcd5b3235c
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
6 changed files with 29 additions and 21 deletions

View file

@ -47,12 +47,12 @@ sealed class Parent : BaseModel() {
* @property hash A versatile, unique(ish) hash used for databases
*/
data class Song(
override val id: Long = -1,
override val id: Long,
override val name: String,
val fileName: String,
val albumId: Long = -1,
val track: Int = -1,
val duration: Long = 0
val albumId: Long,
val track: Int,
val duration: Long
) : BaseModel() {
private var mAlbum: Album? = null
private var mGenre: Genre? = null
@ -95,11 +95,11 @@ data class Song(
* @property totalDuration The combined duration of all of the album's child songs, formatted.
*/
data class Album(
override val id: Long = -1,
override val id: Long,
override val name: String,
val artistName: String,
val coverUri: Uri = Uri.EMPTY,
val year: Int = 0
val coverUri: Uri,
val year: Int
) : Parent() {
private var mArtist: Artist? = null
val artist: Artist get() = requireNotNull(mArtist)
@ -138,7 +138,7 @@ data class Album(
* @property songs The list of all [Song]s in this artist
*/
data class Artist(
override val id: Long = -1,
override val id: Long,
override val name: String,
val albums: List<Album>
) : Parent() {
@ -167,7 +167,7 @@ data class Artist(
* @property resolvedName A name that has been resolved from its int-genre form to its named form.
*/
data class Genre(
override val id: Long = -1,
override val id: Long,
override val name: String,
) : Parent() {
private val mSongs = mutableListOf<Song>()
@ -191,8 +191,8 @@ data class Genre(
* A data object used solely for the "Header" UI element. Inherits [BaseModel].
*/
data class Header(
override val id: Long = -1,
override val name: String = "",
override val id: Long,
override val name: String,
) : BaseModel()
/**
@ -201,8 +201,8 @@ data class Header(
* @property action The callback that will be called when the action button is clicked.
*/
data class ActionHeader(
override val id: Long = -1,
override val name: String = "",
override val id: Long,
override val name: String,
@DrawableRes val icon: Int,
val action: () -> Unit,
) : BaseModel()

View file

@ -2,6 +2,7 @@ package org.oxycblt.auxio.music
import android.annotation.SuppressLint
import android.content.Context
import android.net.Uri
import android.provider.MediaStore
import android.provider.MediaStore.Audio.Albums
import android.provider.MediaStore.Audio.Genres
@ -188,8 +189,11 @@ class MusicLoader(private val context: Context) {
// Group up songs by their album ids and then link them with their albums
val songsByAlbum = songs.groupBy { it.albumId }
val unknownAlbum = Album(
id = -1,
name = context.getString(R.string.placeholder_album),
artistName = context.getString(R.string.placeholder_artist)
artistName = context.getString(R.string.placeholder_artist),
coverUri = Uri.EMPTY,
year = 0
)
songsByAlbum.forEach { entry ->
@ -266,7 +270,10 @@ class MusicLoader(private val context: Context) {
val songsWithoutGenres = songs.filter { it.genre == null }
if (songsWithoutGenres.isNotEmpty()) {
val unknownGenre = Genre(name = context.getString(R.string.placeholder_genre))
val unknownGenre = Genre(
id = -2,
name = context.getString(R.string.placeholder_genre)
)
songsWithoutGenres.forEach { song ->
unknownGenre.linkSong(song)

View file

@ -41,7 +41,7 @@
<!-- Text Size Namespace | Text Sizes -->
<dimen name="text_size_min">10sp</dimen>
<dimen name="text_size_increment">2sp</dimen>
<dimen name="text_size_increment">1sp</dimen>
<dimen name="text_size_track_max">20sp</dimen>
<dimen name="text_size_detail_header_max">26sp</dimen>
<dimen name="text_size_thumb">18sp</dimen>

View file

@ -59,7 +59,7 @@
<!-- Toolbar Title EntryNames -->
<style name="TextAppearance.Toolbar.Header" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:fontFamily">@font/inter_exbold</item>
<item name="android:fontFamily">@font/inter_bold</item>
<item name="android:textSize">@dimen/text_size_toolbar_header</item>
</style>
@ -67,11 +67,12 @@
<style name="DetailTitleText">
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
<item name="android:textColor">?attr/colorPrimary</item>
<item name="android:fontFamily">@font/inter_exbold</item>
<item name="android:fontFamily">@font/inter_bold</item>
<item name="android:textSize">@dimen/text_size_detail_header_max</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:gravity">center_vertical</item>
<item name="autoSizeMaxTextSize">@dimen/text_size_detail_header_max</item>
<item name="autoSizeMinTextSize">@dimen/text_size_min</item>
@ -118,7 +119,7 @@
<!-- Custom dialog title theme -->
<style name="Widget.TextView.Dialog.Title" parent="MaterialAlertDialog.MaterialComponents.Title.Text">
<item name="android:fontFamily">@font/inter_exbold</item>
<item name="android:fontFamily">@font/inter_bold</item>
<item name="android:textSize">@dimen/text_size_toolbar_header</item>
</style>

View file

@ -6,7 +6,7 @@ Here are the music formats that Auxio supports, as per the [Supported ExoPlayer
✅ = Supported
❌ = Not supported
👎 = Not supported well
| Format | Supported | Comments |
|--------|-----------|-----------
@ -17,4 +17,4 @@ Here are the music formats that Auxio supports, as per the [Supported ExoPlayer
| WAV | ✅ | |
| MPEG | ✅ | |
| AAC | ✅ | |
| FLAC | ❌ | Auxio must be patched with the [FLAC Extension](https://github.com/google/ExoPlayer/tree/release-v2/extensions/flac). I do plan to roll this myself eventually, but it may take awhile |
| FLAC | 👎 | Supported on Android 8.1 or newer. Auxio must be patched with the [FLAC Extension](https://github.com/google/ExoPlayer/tree/release-v2/extensions/flac) on lower versions. |