style: migrate to roboto
Dumpster Inter in favor of Roboto. This is mostly for three reasons: 1. Reduces the insane typography setup that Auxio uses 2. Reduces total app size since .ttf files are pretty large and the dynamic fonts feature was proprietary. 3. Creates a more cohesive look and feel given that nearly every android app also uses Roboto.
This commit is contained in:
@@ -29,7 +29,6 @@ import org.oxycblt.auxio.music.Artist
|
||||
import org.oxycblt.auxio.music.BaseModel
|
||||
import org.oxycblt.auxio.music.Genre
|
||||
import org.oxycblt.auxio.music.Header
|
||||
import org.oxycblt.auxio.music.HeaderString
|
||||
import org.oxycblt.auxio.music.MusicStore
|
||||
import org.oxycblt.auxio.settings.SettingsManager
|
||||
import org.oxycblt.auxio.ui.DisplayMode
|
||||
@@ -160,7 +159,7 @@ class DetailViewModel : ViewModel() {
|
||||
data.add(
|
||||
ActionHeader(
|
||||
id = -2,
|
||||
string = HeaderString.Single(R.string.lbl_songs),
|
||||
string = R.string.lbl_songs,
|
||||
icon = R.drawable.ic_sort,
|
||||
desc = R.string.lbl_sort,
|
||||
onClick = { view ->
|
||||
@@ -182,7 +181,7 @@ class DetailViewModel : ViewModel() {
|
||||
data.add(
|
||||
Header(
|
||||
id = -2,
|
||||
string = HeaderString.Single(R.string.lbl_albums)
|
||||
string = R.string.lbl_albums
|
||||
)
|
||||
)
|
||||
|
||||
@@ -191,7 +190,7 @@ class DetailViewModel : ViewModel() {
|
||||
data.add(
|
||||
ActionHeader(
|
||||
id = -3,
|
||||
string = HeaderString.Single(R.string.lbl_songs),
|
||||
string = R.string.lbl_songs,
|
||||
icon = R.drawable.ic_sort,
|
||||
desc = R.string.lbl_sort,
|
||||
onClick = { view ->
|
||||
@@ -212,7 +211,7 @@ class DetailViewModel : ViewModel() {
|
||||
data.add(
|
||||
ActionHeader(
|
||||
id = -2,
|
||||
string = HeaderString.Single(R.string.lbl_songs),
|
||||
string = R.string.lbl_songs,
|
||||
icon = R.drawable.ic_sort,
|
||||
desc = R.string.lbl_sort,
|
||||
onClick = { view ->
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package org.oxycblt.auxio.music
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
@@ -202,11 +201,10 @@ data class Genre(
|
||||
|
||||
/**
|
||||
* A data object used solely for the "Header" UI element.
|
||||
* @see HeaderString
|
||||
*/
|
||||
data class Header(
|
||||
override val id: Long,
|
||||
val string: HeaderString
|
||||
@StringRes val string: Int
|
||||
) : BaseModel()
|
||||
|
||||
/**
|
||||
@@ -215,7 +213,7 @@ data class Header(
|
||||
*/
|
||||
data class ActionHeader(
|
||||
override val id: Long,
|
||||
val string: HeaderString,
|
||||
@StringRes val string: Int,
|
||||
@DrawableRes val icon: Int,
|
||||
@StringRes val desc: Int,
|
||||
val onClick: (View) -> Unit,
|
||||
@@ -243,77 +241,3 @@ data class ActionHeader(
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The string used for a header instance. This class is a bit complex, mostly because it revolves
|
||||
* around passing string resources that are then resolved by the view. This is because ViewModel
|
||||
* instance should preferably not have access to a Context but should still generate data,
|
||||
* which at times can include [Header] instances that require string resources.
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
sealed class HeaderString {
|
||||
/** A single string resource. */
|
||||
class Single(@StringRes val id: Int) : HeaderString()
|
||||
/** A string resource with an argument. */
|
||||
class WithArg(@StringRes val id: Int, val arg: Arg) : HeaderString()
|
||||
|
||||
/**
|
||||
* Resolve this instance into a string.
|
||||
*/
|
||||
fun resolve(context: Context): String {
|
||||
return when (this) {
|
||||
is Single -> context.getString(id)
|
||||
is WithArg -> context.getString(id, arg.resolve(context))
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return false
|
||||
|
||||
return when (this) {
|
||||
is Single -> other is Single && other.id == id
|
||||
is WithArg -> other is WithArg && other.id == id && other.arg == arg
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return when (this) {
|
||||
is Single -> id.hashCode()
|
||||
is WithArg -> 31 * id.hashCode() * arg.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An argument for the [WithArg] header string.
|
||||
*/
|
||||
sealed class Arg {
|
||||
/** A string resource to be used as the argument */
|
||||
class Resource(@StringRes val id: Int) : Arg()
|
||||
/** A string value to be used as the argument */
|
||||
class Value(val string: String) : Arg()
|
||||
|
||||
/** Resolve this argument instance into a string. */
|
||||
fun resolve(context: Context): String {
|
||||
return when (this) {
|
||||
is Resource -> context.getString(id)
|
||||
is Value -> string
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return false
|
||||
|
||||
return when (this) {
|
||||
is Resource -> other is Resource && other.id == id
|
||||
is Value -> other is Value && other.string == this.string
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return when (this) {
|
||||
is Resource -> id.hashCode()
|
||||
is Value -> 31 * string.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,6 @@ class PlaybackViewModel : ViewModel(), PlaybackStateManager.Callback {
|
||||
*/
|
||||
fun removeQueueDataItem(adapterIndex: Int, apply: () -> Unit) {
|
||||
val adjusted = adapterIndex + (playbackManager.queue.size - mNextUp.value!!.size)
|
||||
logD("$adjusted")
|
||||
|
||||
if (adjusted in playbackManager.queue.indices) {
|
||||
apply()
|
||||
|
||||
@@ -284,7 +284,6 @@ class PlaybackStateManager private constructor() {
|
||||
|
||||
if (index > mQueue.size || index < 0) {
|
||||
logE("Index is out of bounds, did not remove queue item.")
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -301,7 +300,6 @@ class PlaybackStateManager private constructor() {
|
||||
fun moveQueueItems(from: Int, to: Int): Boolean {
|
||||
if (from > mQueue.size || from < 0 || to > mQueue.size || to < 0) {
|
||||
logE("Indices were out of bounds, did not move queue item")
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.music.BaseModel
|
||||
import org.oxycblt.auxio.music.Header
|
||||
import org.oxycblt.auxio.music.HeaderString
|
||||
import org.oxycblt.auxio.music.Music
|
||||
import org.oxycblt.auxio.music.MusicParent
|
||||
import org.oxycblt.auxio.music.MusicStore
|
||||
@@ -85,28 +84,28 @@ class SearchViewModel : ViewModel() {
|
||||
|
||||
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_ARTISTS) {
|
||||
musicStore.artists.filterByOrNull(query)?.let { artists ->
|
||||
results.add(Header(-1, HeaderString.Single(R.string.lbl_artists)))
|
||||
results.add(Header(-1, R.string.lbl_artists))
|
||||
results.addAll(sort.sortParents(artists))
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_ALBUMS) {
|
||||
musicStore.albums.filterByOrNull(query)?.let { albums ->
|
||||
results.add(Header(-2, HeaderString.Single(R.string.lbl_albums)))
|
||||
results.add(Header(-2, R.string.lbl_albums))
|
||||
results.addAll(sort.sortAlbums(albums))
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_GENRES) {
|
||||
musicStore.genres.filterByOrNull(query)?.let { genres ->
|
||||
results.add(Header(-3, HeaderString.Single(R.string.lbl_genres)))
|
||||
results.add(Header(-3, R.string.lbl_genres))
|
||||
results.addAll(sort.sortParents(genres))
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_SONGS) {
|
||||
musicStore.songs.filterByOrNull(query)?.let { songs ->
|
||||
results.add(Header(-4, HeaderString.Single(R.string.lbl_songs)))
|
||||
results.add(Header(-4, R.string.lbl_songs))
|
||||
results.addAll(sort.sortSongs(songs))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user