style: apply body typography
Use body typography in more places, reworking the letter spacing as to make it more pleasent to use with the inter typeface. This should hopefully be the last time I fret over typography. Everything should line up in the way desired by M3.
This commit is contained in:
parent
f377e144dd
commit
ec358a13e3
7 changed files with 40 additions and 21 deletions
|
@ -1,7 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## dev [v2.2.1 or v2.3.0]
|
## dev [v2.2.1 or v2.3.0]
|
||||||
|
#### What's Improved
|
||||||
- Updated chinese translations [courtesy of cccClyde]
|
- Updated chinese translations [courtesy of cccClyde]
|
||||||
|
- Use body typography in correct places
|
||||||
|
|
||||||
## v2.2.0
|
## v2.2.0
|
||||||
#### What's New:
|
#### What's New:
|
||||||
|
|
|
@ -60,6 +60,8 @@ data class Song(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
/** The file name of this song, excluding the full path. */
|
/** The file name of this song, excluding the full path. */
|
||||||
val fileName: String,
|
val fileName: String,
|
||||||
|
/** The parent directories of this song. More or less the complement to [fileName]. */
|
||||||
|
val dirs: String,
|
||||||
/** The total duration of this song, in millis. */
|
/** The total duration of this song, in millis. */
|
||||||
val duration: Long,
|
val duration: Long,
|
||||||
/** The track number of this song. */
|
/** The track number of this song. */
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.provider.MediaStore
|
||||||
import androidx.core.database.getStringOrNull
|
import androidx.core.database.getStringOrNull
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.excluded.ExcludedDatabase
|
import org.oxycblt.auxio.excluded.ExcludedDatabase
|
||||||
|
import org.oxycblt.auxio.util.logD
|
||||||
import org.oxycblt.auxio.util.logE
|
import org.oxycblt.auxio.util.logE
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ class MusicLoader {
|
||||||
args += "$path%" // Append % so that the selector properly detects children
|
args += "$path%" // Append % so that the selector properly detects children
|
||||||
}
|
}
|
||||||
|
|
||||||
context.applicationContext.contentResolver.query(
|
context.contentResolver.query(
|
||||||
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
||||||
arrayOf(
|
arrayOf(
|
||||||
MediaStore.Audio.AudioColumns._ID,
|
MediaStore.Audio.AudioColumns._ID,
|
||||||
|
@ -137,6 +138,7 @@ class MusicLoader {
|
||||||
MediaStore.Audio.AudioColumns.YEAR,
|
MediaStore.Audio.AudioColumns.YEAR,
|
||||||
MediaStore.Audio.AudioColumns.TRACK,
|
MediaStore.Audio.AudioColumns.TRACK,
|
||||||
MediaStore.Audio.AudioColumns.DURATION,
|
MediaStore.Audio.AudioColumns.DURATION,
|
||||||
|
MediaStore.Audio.AudioColumns.DATA
|
||||||
),
|
),
|
||||||
selector, args.toTypedArray(), null
|
selector, args.toTypedArray(), null
|
||||||
)?.use { cursor ->
|
)?.use { cursor ->
|
||||||
|
@ -150,6 +152,7 @@ class MusicLoader {
|
||||||
val yearIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.YEAR)
|
val yearIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.YEAR)
|
||||||
val trackIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.TRACK)
|
val trackIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.TRACK)
|
||||||
val durationIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.DURATION)
|
val durationIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.DURATION)
|
||||||
|
val dataIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.DATA)
|
||||||
|
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
val id = cursor.getLong(idIndex)
|
val id = cursor.getLong(idIndex)
|
||||||
|
@ -170,10 +173,19 @@ class MusicLoader {
|
||||||
val track = cursor.getInt(trackIndex)
|
val track = cursor.getInt(trackIndex)
|
||||||
val duration = cursor.getLong(durationIndex)
|
val duration = cursor.getLong(durationIndex)
|
||||||
|
|
||||||
|
// More efficient to slice away DISPLAY_NAME from the full path then to
|
||||||
|
// grok the path components from DATA itself.
|
||||||
|
val dirs = cursor.getString(dataIndex).run {
|
||||||
|
substring(0 until lastIndexOfAny(listOf(fileName)))
|
||||||
|
}
|
||||||
|
|
||||||
|
logD("SONG NAME: $title ALBUM: $album ARTIST: $artist ALBUM ARTIST: $albumArtist")
|
||||||
|
|
||||||
songs.add(
|
songs.add(
|
||||||
Song(
|
Song(
|
||||||
title,
|
title,
|
||||||
fileName,
|
fileName,
|
||||||
|
dirs,
|
||||||
duration,
|
duration,
|
||||||
track,
|
track,
|
||||||
id,
|
id,
|
||||||
|
@ -188,7 +200,8 @@ class MusicLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
songs = songs.distinctBy {
|
songs = songs.distinctBy {
|
||||||
it.name to it.internalMediaStoreAlbumName to it.internalMediaStoreArtistName to it.internalMediaStoreAlbumArtistName to it.track to it.duration
|
it.name to it.internalMediaStoreAlbumName to it.internalMediaStoreArtistName to
|
||||||
|
it.internalMediaStoreAlbumArtistName to it.track to it.duration
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
return songs
|
return songs
|
||||||
|
@ -223,6 +236,8 @@ class MusicLoader {
|
||||||
)
|
)
|
||||||
val artistName = templateSong.internalGroupingArtistName
|
val artistName = templateSong.internalGroupingArtistName
|
||||||
|
|
||||||
|
logD("ALBUM NAME: $albumName PREFERRED ARTIST: $artistName")
|
||||||
|
|
||||||
albums.add(
|
albums.add(
|
||||||
Album(
|
Album(
|
||||||
albumName,
|
albumName,
|
||||||
|
@ -279,7 +294,7 @@ class MusicLoader {
|
||||||
private fun readGenres(context: Context, songs: List<Song>): List<Genre> {
|
private fun readGenres(context: Context, songs: List<Song>): List<Genre> {
|
||||||
val genres = mutableListOf<Genre>()
|
val genres = mutableListOf<Genre>()
|
||||||
|
|
||||||
val genreCursor = context.applicationContext.contentResolver.query(
|
val genreCursor = context.contentResolver.query(
|
||||||
MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI,
|
MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI,
|
||||||
arrayOf(
|
arrayOf(
|
||||||
MediaStore.Audio.Genres._ID,
|
MediaStore.Audio.Genres._ID,
|
||||||
|
@ -332,7 +347,7 @@ class MusicLoader {
|
||||||
val genreSongs = mutableListOf<Song>()
|
val genreSongs = mutableListOf<Song>()
|
||||||
|
|
||||||
// Don't even bother blacklisting here as useless iterations are less expensive than IO
|
// Don't even bother blacklisting here as useless iterations are less expensive than IO
|
||||||
val songCursor = context.applicationContext.contentResolver.query(
|
val songCursor = context.contentResolver.query(
|
||||||
MediaStore.Audio.Genres.Members.getContentUri("external", genreId),
|
MediaStore.Audio.Genres.Members.getContentUri("external", genreId),
|
||||||
arrayOf(MediaStore.Audio.Genres.Members._ID),
|
arrayOf(MediaStore.Audio.Genres.Members._ID),
|
||||||
null, null, null
|
null, null, null
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
|
|
||||||
<android.widget.TextView
|
<android.widget.TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:textAppearance="@style/Widget.Auxio.TextView.Primary.AppWidget"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/spacing_medium"
|
android:padding="@dimen/spacing_medium"
|
||||||
android:text="@string/def_playback"
|
android:text="@string/def_playback"
|
||||||
android:textAppearance="@style/TextAppearance.Auxio.TitleMidLarge"
|
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:textColor="?android:attr/textColorPrimary" />
|
android:textColor="?android:attr/textColorPrimary" />
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<!-- The style for the checked text view in the custom dialog -->
|
<!-- The style for the checked text view in the custom dialog -->
|
||||||
<style name="Widget.Auxio.Dialog.CheckedTextView" parent="Widget.Material3.CheckedTextView">
|
<style name="Widget.Auxio.Dialog.CheckedTextView" parent="Widget.Material3.CheckedTextView">
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||||
<item name="android:textAppearance">@style/TextAppearance.Auxio.TitleMedium</item>
|
<item name="android:textAppearance">@style/TextAppearance.Auxio.BodyLarge</item>
|
||||||
<item name="android:background">@null</item>
|
<item name="android:background">@null</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -40,16 +40,14 @@
|
||||||
<!-- Widget TextView that mimics the main Auxio Primary TextView -->
|
<!-- Widget TextView that mimics the main Auxio Primary TextView -->
|
||||||
<style name="Widget.Auxio.TextView.Primary.AppWidget" parent="Widget.Auxio.TextView.AppWidget">
|
<style name="Widget.Auxio.TextView.Primary.AppWidget" parent="Widget.Auxio.TextView.AppWidget">
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
<item name="android:fontFamily">sans-serif-medium</item>
|
<item name="android:textSize">@dimen/text_size_ext_title_mid_large</item>
|
||||||
<item name="android:textAppearance">@style/TextAppearance.Auxio.TitleMidLarge</item>
|
<item name="android:textAppearance">@style/TextAppearance.Material3.TitleMedium</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Widget TextView that mimics the main Auxio Secondary TextView -->
|
<!-- Widget TextView that mimics the main Auxio Secondary TextView -->
|
||||||
<style name="Widget.Auxio.TextView.Secondary.AppWidget" parent="Widget.Auxio.TextView.AppWidget">
|
<style name="Widget.Auxio.TextView.Secondary.AppWidget" parent="Widget.Auxio.TextView.AppWidget">
|
||||||
<item name="android:textStyle">normal</item>
|
|
||||||
<item name="android:fontFamily">sans-serif</item>
|
|
||||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
<item name="android:textAppearance">@style/TextAppearance.Auxio.TitleMedium</item>
|
<item name="android:textAppearance">@style/TextAppearance.Material3.BodyLarge</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Hack to make sure that ripples work the best that they can on all Android Versions -->
|
<!-- Hack to make sure that ripples work the best that they can on all Android Versions -->
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Auxio.TextView.Item.Secondary" parent="Widget.Auxio.TextView.Item.Base">
|
<style name="Widget.Auxio.TextView.Item.Secondary" parent="Widget.Auxio.TextView.Item.Base">
|
||||||
<item name="android:textAppearance">@style/TextAppearance.Auxio.TitleSmall</item>
|
<item name="android:textAppearance">@style/TextAppearance.Auxio.BodyMedium</item>
|
||||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
<item name="android:ellipsize">end</item>
|
<item name="android:ellipsize">end</item>
|
||||||
<item name="android:maxLines">1</item>
|
<item name="android:maxLines">1</item>
|
||||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
<item name="android:textAppearance">@style/TextAppearance.Auxio.TitleMedium</item>
|
<item name="android:textAppearance">@style/TextAppearance.Auxio.BodyLarge</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Auxio.TextView.Primary.Compact" parent="Widget.Auxio.TextView.Base">
|
<style name="Widget.Auxio.TextView.Primary.Compact" parent="Widget.Auxio.TextView.Base">
|
||||||
|
|
|
@ -49,8 +49,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Title styles are often used for headings, list items, or non-interactive elements.
|
Title styles are often used for titles,
|
||||||
Basically, any UI element with two lines of text or more.
|
|
||||||
-->
|
-->
|
||||||
<style name="TextAppearance.Auxio.TitleLarge" parent="TextAppearance.Material3.TitleLarge">
|
<style name="TextAppearance.Auxio.TitleLarge" parent="TextAppearance.Material3.TitleLarge">
|
||||||
<item name="fontFamily">@font/inter_semibold</item>
|
<item name="fontFamily">@font/inter_semibold</item>
|
||||||
|
@ -63,18 +62,21 @@
|
||||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="android:textSize">@dimen/text_size_ext_title_mid_large</item>
|
<item name="android:textSize">@dimen/text_size_ext_title_mid_large</item>
|
||||||
|
<item name="android:letterSpacing">0</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Auxio.TitleMedium" parent="TextAppearance.Material3.TitleMedium">
|
<style name="TextAppearance.Auxio.TitleMedium" parent="TextAppearance.Material3.TitleMedium">
|
||||||
<item name="fontFamily">@font/inter</item>
|
<item name="fontFamily">@font/inter</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:letterSpacing">0.01</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Auxio.TitleSmall" parent="TextAppearance.Material3.TitleSmall">
|
<style name="TextAppearance.Auxio.TitleSmall" parent="TextAppearance.Material3.TitleSmall">
|
||||||
<item name="fontFamily">@font/inter</item>
|
<item name="fontFamily">@font/inter</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:letterSpacing">0.01</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -95,37 +97,37 @@
|
||||||
<item name="fontFamily">@font/inter_semibold</item>
|
<item name="fontFamily">@font/inter_semibold</item>
|
||||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="android:letterSpacing">0.01</item>
|
<item name="android:letterSpacing">0.02</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Auxio.LabelSmall" parent="TextAppearance.Material3.LabelSmall">
|
<style name="TextAppearance.Auxio.LabelSmall" parent="TextAppearance.Material3.LabelSmall">
|
||||||
<item name="fontFamily">@font/inter_semibold</item>
|
<item name="fontFamily">@font/inter_semibold</item>
|
||||||
<item name="android:fontFamily">@font/inter_semibold</item>
|
<item name="android:fontFamily">@font/inter_semibold</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="android:letterSpacing">0.01</item>
|
<item name="android:letterSpacing">0.015</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The body typeface is used for UI elements with only one line of text or tertiary UI elements.
|
The body typeface is used for secondary and/or singular UI elements.
|
||||||
-->
|
-->
|
||||||
<style name="TextAppearance.Auxio.BodyLarge" parent="TextAppearance.Material3.BodyLarge">
|
<style name="TextAppearance.Auxio.BodyLarge" parent="TextAppearance.Material3.BodyLarge">
|
||||||
<item name="fontFamily">@font/inter</item>
|
<item name="fontFamily">@font/inter</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
<item name="android:letterSpacing">0.025</item>
|
<item name="android:letterSpacing">0.015</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Auxio.BodyMedium" parent="TextAppearance.Material3.BodyMedium">
|
<style name="TextAppearance.Auxio.BodyMedium" parent="TextAppearance.Material3.BodyMedium">
|
||||||
<item name="fontFamily">@font/inter</item>
|
<item name="fontFamily">@font/inter</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
<item name="android:letterSpacing">0.020</item>
|
<item name="android:letterSpacing">0.025</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Auxio.BodySmall" parent="TextAppearance.Material3.BodySmall">
|
<style name="TextAppearance.Auxio.BodySmall" parent="TextAppearance.Material3.BodySmall">
|
||||||
<item name="fontFamily">@font/inter</item>
|
<item name="fontFamily">@font/inter</item>
|
||||||
<item name="android:fontFamily">@font/inter</item>
|
<item name="android:fontFamily">@font/inter</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
<item name="android:letterSpacing">0.015</item>
|
<item name="android:letterSpacing">0.020</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue