styles: refactor styles
Refactor styles again, this time trying to seperate the more layout-specific attributes so that layouts become more re-usable. This also updates the naming conventions of styles.
This commit is contained in:
@@ -58,7 +58,7 @@ class AlbumDetailFragment : DetailFragment() {
|
||||
setupToolbar(R.menu.menu_album_detail) { itemId ->
|
||||
if (itemId == R.id.action_queue_add) {
|
||||
playbackModel.addToUserQueue(detailModel.currentAlbum.value!!)
|
||||
requireContext().showToast(R.string.label_queue_added)
|
||||
requireContext().showToast(R.string.lbl_queue_added)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
||||
@@ -87,7 +87,7 @@ class ArtistDetailFragment : DetailFragment() {
|
||||
data.add(
|
||||
Header(
|
||||
id = -2,
|
||||
name = getString(R.string.label_songs),
|
||||
name = getString(R.string.lbl_songs),
|
||||
isAction = true
|
||||
)
|
||||
)
|
||||
|
||||
@@ -144,17 +144,17 @@ class LoadingFragment : Fragment() {
|
||||
when (error) {
|
||||
MusicStore.Response.NO_MUSIC -> {
|
||||
binding.loadingRetryButton.visibility = View.VISIBLE
|
||||
binding.loadingErrorText.text = getString(R.string.error_no_music)
|
||||
binding.loadingErrorText.text = getString(R.string.err_no_music)
|
||||
}
|
||||
|
||||
MusicStore.Response.NO_PERMS -> {
|
||||
binding.loadingGrantButton.visibility = View.VISIBLE
|
||||
binding.loadingErrorText.text = getString(R.string.error_no_perms)
|
||||
binding.loadingErrorText.text = getString(R.string.err_no_perms)
|
||||
}
|
||||
|
||||
MusicStore.Response.FAILED -> {
|
||||
binding.loadingRetryButton.visibility = View.VISIBLE
|
||||
binding.loadingErrorText.text = getString(R.string.error_load_failed)
|
||||
binding.loadingErrorText.text = getString(R.string.err_load_failed)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
|
||||
@@ -107,8 +107,8 @@ class MusicLoader(private val context: Context) {
|
||||
Albums.DEFAULT_SORT_ORDER
|
||||
)
|
||||
|
||||
val albumPlaceholder = context.getString(R.string.placeholder_album)
|
||||
val artistPlaceholder = context.getString(R.string.placeholder_artist)
|
||||
val albumPlaceholder = context.getString(R.string.def_album)
|
||||
val artistPlaceholder = context.getString(R.string.def_artist)
|
||||
|
||||
albumCursor?.use { cursor ->
|
||||
val idIndex = cursor.getColumnIndexOrThrow(Albums._ID)
|
||||
@@ -191,8 +191,8 @@ class MusicLoader(private val context: Context) {
|
||||
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),
|
||||
name = context.getString(R.string.def_album),
|
||||
artistName = context.getString(R.string.def_artist),
|
||||
coverUri = Uri.EMPTY,
|
||||
year = 0
|
||||
)
|
||||
@@ -300,7 +300,7 @@ class MusicLoader(private val context: Context) {
|
||||
if (songsWithoutGenres.isNotEmpty()) {
|
||||
val unknownGenre = Genre(
|
||||
id = -2,
|
||||
name = context.getString(R.string.placeholder_genre)
|
||||
name = context.getString(R.string.def_genre)
|
||||
)
|
||||
|
||||
songsWithoutGenres.forEach { song ->
|
||||
|
||||
@@ -111,7 +111,7 @@ fun Int.toYear(context: Context): String {
|
||||
return if (this > 0) {
|
||||
toString()
|
||||
} else {
|
||||
context.getString(R.string.placeholder_no_date)
|
||||
context.getString(R.string.def_date)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ fun Int.toYear(context: Context): String {
|
||||
*/
|
||||
@BindingAdapter("artistGenre")
|
||||
fun TextView.bindArtistGenre(artist: Artist) {
|
||||
text = artist.genre?.resolvedName ?: context.getString(R.string.placeholder_genre)
|
||||
text = artist.genre?.resolvedName ?: context.getString(R.string.def_genre)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,8 +130,8 @@ fun TextView.bindArtistGenre(artist: Artist) {
|
||||
*/
|
||||
@BindingAdapter("artistCounts")
|
||||
fun TextView.bindArtistCounts(artist: Artist) {
|
||||
val albums = context.getPlural(R.plurals.format_album_count, artist.albums.size)
|
||||
val songs = context.getPlural(R.plurals.format_song_count, artist.songs.size)
|
||||
val albums = context.getPlural(R.plurals.fmt_album_count, artist.albums.size)
|
||||
val songs = context.getPlural(R.plurals.fmt_song_count, artist.songs.size)
|
||||
|
||||
text = context.getString(R.string.format_double_counts, albums, songs)
|
||||
}
|
||||
@@ -144,7 +144,7 @@ fun TextView.bindAllAlbumDetails(album: Album) {
|
||||
text = context.getString(
|
||||
R.string.format_double_info,
|
||||
album.year.toYear(context),
|
||||
context.getPlural(R.plurals.format_song_count, album.songs.size),
|
||||
context.getPlural(R.plurals.fmt_song_count, album.songs.size),
|
||||
album.totalDuration
|
||||
)
|
||||
}
|
||||
@@ -157,7 +157,7 @@ fun TextView.bindAlbumInfo(album: Album) {
|
||||
text = context.getString(
|
||||
R.string.format_info,
|
||||
album.artist.name,
|
||||
context.getPlural(R.plurals.format_song_count, album.songs.size),
|
||||
context.getPlural(R.plurals.fmt_song_count, album.songs.size),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class QueueAdapter(
|
||||
binding.headerButton.apply {
|
||||
setImageResource(R.drawable.ic_clear)
|
||||
|
||||
contentDescription = context.getString(R.string.description_clear_user_queue)
|
||||
contentDescription = context.getString(R.string.desc_clear_user_queue)
|
||||
TooltipCompat.setTooltipText(this, contentDescription)
|
||||
|
||||
setOnClickListener {
|
||||
|
||||
@@ -142,7 +142,7 @@ class QueueFragment : Fragment() {
|
||||
if (userQueue.isNotEmpty()) {
|
||||
queue += Header(
|
||||
id = -2,
|
||||
name = getString(R.string.label_next_user_queue),
|
||||
name = getString(R.string.lbl_next_user_queue),
|
||||
isAction = true
|
||||
)
|
||||
|
||||
@@ -152,7 +152,7 @@ class QueueFragment : Fragment() {
|
||||
if (nextQueue.isNotEmpty()) {
|
||||
queue += Header(
|
||||
id = -3,
|
||||
name = getString(R.string.format_next_from, getParentName()),
|
||||
name = getString(R.string.fmt_next_from, getParentName()),
|
||||
isAction = false
|
||||
)
|
||||
|
||||
@@ -163,6 +163,6 @@ class QueueFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun getParentName(): String {
|
||||
return playbackModel.parent.value?.displayName ?: getString(R.string.label_all_songs)
|
||||
return playbackModel.parent.value?.displayName ?: getString(R.string.lbl_all_songs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class PlaybackNotification private constructor(
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return
|
||||
|
||||
// A blank parent always means that the mode is ALL_SONGS
|
||||
setSubText(parent?.displayName ?: context.getString(R.string.label_all_songs))
|
||||
setSubText(parent?.displayName ?: context.getString(R.string.lbl_all_songs))
|
||||
}
|
||||
|
||||
// --- NOTIFICATION ACTION BUILDERS ---
|
||||
|
||||
@@ -54,28 +54,28 @@ class SearchViewModel : ViewModel() {
|
||||
|
||||
if (mFilterMode.isAllOr(DisplayMode.SHOW_ARTISTS)) {
|
||||
musicStore.artists.filterByOrNull(query)?.let { artists ->
|
||||
results.add(Header(id = -2, name = context.getString(R.string.label_artists)))
|
||||
results.add(Header(id = -2, name = context.getString(R.string.lbl_artists)))
|
||||
results.addAll(artists)
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode.isAllOr(DisplayMode.SHOW_ALBUMS)) {
|
||||
musicStore.albums.filterByOrNull(query)?.let { albums ->
|
||||
results.add(Header(id = -3, name = context.getString(R.string.label_albums)))
|
||||
results.add(Header(id = -3, name = context.getString(R.string.lbl_albums)))
|
||||
results.addAll(albums)
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode.isAllOr(DisplayMode.SHOW_GENRES)) {
|
||||
musicStore.genres.filterByOrNull(query)?.let { genres ->
|
||||
results.add(Header(id = -4, name = context.getString(R.string.label_genres)))
|
||||
results.add(Header(id = -4, name = context.getString(R.string.lbl_genres)))
|
||||
results.addAll(genres)
|
||||
}
|
||||
}
|
||||
|
||||
if (mFilterMode.isAllOr(DisplayMode.SHOW_SONGS)) {
|
||||
musicStore.songs.filterByOrNull(query)?.let { songs ->
|
||||
results.add(Header(id = -5, name = context.getString(R.string.label_songs)))
|
||||
results.add(Header(id = -5, name = context.getString(R.string.lbl_songs)))
|
||||
results.addAll(songs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class AboutFragment : Fragment() {
|
||||
binding.aboutFaq.setOnClickListener { openLinkInBrowser(LINK_FAQ) }
|
||||
binding.aboutLicenses.setOnClickListener { openLinkInBrowser(LINK_LICENSES) }
|
||||
binding.aboutSongCount.text = getString(
|
||||
R.string.format_songs_loaded, musicStore.songs.size
|
||||
R.string.fmt_songs_loaded, musicStore.songs.size
|
||||
)
|
||||
|
||||
logD("Dialog created.")
|
||||
@@ -76,7 +76,7 @@ class AboutFragment : Fragment() {
|
||||
}
|
||||
} else {
|
||||
// No app installed to open the link
|
||||
requireContext().showToast(R.string.error_no_browser)
|
||||
requireContext().showToast(R.string.err_no_app)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
||||
SettingsManager.KEY_SAVE_STATE -> {
|
||||
onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
playbackModel.savePlaybackState(requireContext()) {
|
||||
requireContext().showToast(R.string.label_state_saved)
|
||||
requireContext().showToast(R.string.lbl_state_saved)
|
||||
}
|
||||
|
||||
true
|
||||
|
||||
@@ -57,7 +57,7 @@ class AccentDialog : LifecycleDialog() {
|
||||
}
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder.setTitle(R.string.setting_accent)
|
||||
builder.setTitle(R.string.set_accent)
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
if (pendingAccent != Accent.get()) {
|
||||
|
||||
@@ -86,11 +86,11 @@ class BlacklistDialog : LifecycleDialog() {
|
||||
}
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder.setTitle(R.string.setting_content_blacklist)
|
||||
builder.setTitle(R.string.set_blacklist)
|
||||
|
||||
// Dont set the click listener here, we do some custom black magic in onCreateView instead.
|
||||
builder.setNeutralButton(R.string.label_add, null)
|
||||
builder.setPositiveButton(R.string.label_save, null)
|
||||
builder.setNeutralButton(R.string.lbl_add, null)
|
||||
builder.setPositiveButton(R.string.lbl_save, null)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class BlacklistDialog : LifecycleDialog() {
|
||||
if (path != null) {
|
||||
blacklistModel.addPath(path)
|
||||
} else {
|
||||
requireContext().showToast(R.string.error_bad_dir)
|
||||
requireContext().showToast(R.string.err_bad_dir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,68 +14,68 @@ import org.oxycblt.auxio.R
|
||||
* A list of all possible accents.
|
||||
*/
|
||||
val ACCENTS = arrayOf(
|
||||
Accent(R.color.red, R.style.Theme_Red, R.style.Theme_Red_Black, R.string.color_label_red),
|
||||
Accent(R.color.pink, R.style.Theme_Pink, R.style.Theme_Pink_Black, R.string.color_label_pink),
|
||||
Accent(R.color.red, R.style.Theme_Red, R.style.Theme_Red_Black, R.string.clr_red),
|
||||
Accent(R.color.pink, R.style.Theme_Pink, R.style.Theme_Pink_Black, R.string.clr_pink),
|
||||
Accent(
|
||||
R.color.purple,
|
||||
R.style.Theme_Purple,
|
||||
R.style.Theme_Purple_Black,
|
||||
R.string.color_label_purple
|
||||
R.string.clr_purple
|
||||
),
|
||||
Accent(
|
||||
R.color.deep_purple,
|
||||
R.style.Theme_DeepPurple,
|
||||
R.style.Theme_DeepPurple_Black,
|
||||
R.string.color_label_deep_purple
|
||||
R.string.clr_deep_purple
|
||||
),
|
||||
Accent(
|
||||
R.color.indigo,
|
||||
R.style.Theme_Indigo,
|
||||
R.style.Theme_Indigo_Black,
|
||||
R.string.color_label_indigo
|
||||
R.string.clr_indigo
|
||||
),
|
||||
Accent(R.color.blue, R.style.Theme_Blue, R.style.Theme_Blue_Black, R.string.color_label_blue),
|
||||
Accent(R.color.blue, R.style.Theme_Blue, R.style.Theme_Blue_Black, R.string.clr_blue),
|
||||
Accent(
|
||||
R.color.light_blue,
|
||||
R.style.Theme_LightBlue,
|
||||
R.style.Theme_LightBlue_Black,
|
||||
R.string.color_label_light_blue
|
||||
R.string.clr_light_blue
|
||||
),
|
||||
Accent(R.color.cyan, R.style.Theme_Cyan, R.style.Theme_Cyan_Black, R.string.color_label_cyan),
|
||||
Accent(R.color.teal, R.style.Theme_Teal, R.style.Theme_Teal_Black, R.string.color_label_teal),
|
||||
Accent(R.color.green, R.style.Theme_Green, R.style.Theme_Green_Black, R.string.color_label_green),
|
||||
Accent(R.color.cyan, R.style.Theme_Cyan, R.style.Theme_Cyan_Black, R.string.clr_cyan),
|
||||
Accent(R.color.teal, R.style.Theme_Teal, R.style.Theme_Teal_Black, R.string.clr_teal),
|
||||
Accent(R.color.green, R.style.Theme_Green, R.style.Theme_Green_Black, R.string.clr_green),
|
||||
Accent(
|
||||
R.color.light_green,
|
||||
R.style.Theme_LightGreen,
|
||||
R.style.Theme_LightGreen_Black,
|
||||
R.string.color_label_light_green
|
||||
R.string.color_light_green
|
||||
),
|
||||
Accent(R.color.lime, R.style.Theme_Lime, R.style.Theme_Lime_Black, R.string.color_label_lime),
|
||||
Accent(R.color.lime, R.style.Theme_Lime, R.style.Theme_Lime_Black, R.string.color_lime),
|
||||
Accent(
|
||||
R.color.yellow,
|
||||
R.style.Theme_Yellow,
|
||||
R.style.Theme_Yellow_Black,
|
||||
R.string.color_label_yellow
|
||||
R.string.color_yellow
|
||||
),
|
||||
Accent(
|
||||
R.color.orange,
|
||||
R.style.Theme_Orange,
|
||||
R.style.Theme_Orange_Black,
|
||||
R.string.color_label_orange
|
||||
R.string.clr_orange
|
||||
),
|
||||
Accent(
|
||||
R.color.deep_orange,
|
||||
R.style.Theme_DeepOrange,
|
||||
R.style.Theme_DeepOrange_Black,
|
||||
R.string.color_label_deep_orange
|
||||
R.string.clr_deep_orange
|
||||
),
|
||||
Accent(R.color.brown, R.style.Theme_Brown, R.style.Theme_Brown_Black, R.string.color_label_brown),
|
||||
Accent(R.color.grey, R.style.Theme_Grey, R.style.Theme_Grey_Black, R.string.color_label_grey),
|
||||
Accent(R.color.brown, R.style.Theme_Brown, R.style.Theme_Brown_Black, R.string.clr_label_brown),
|
||||
Accent(R.color.grey, R.style.Theme_Grey, R.style.Theme_Grey_Black, R.string.clr_label_grey),
|
||||
Accent(
|
||||
R.color.blue_grey,
|
||||
R.style.Theme_BlueGrey,
|
||||
R.style.Theme_BlueGrey_Black,
|
||||
R.string.color_label_blue_grey
|
||||
R.string.clr_blue_grey
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -129,12 +129,12 @@ class ActionMenu(
|
||||
when (data) {
|
||||
is Song -> {
|
||||
playbackModel.addToUserQueue(data)
|
||||
context.showToast(R.string.label_queue_added)
|
||||
context.showToast(R.string.lbl_queue_added)
|
||||
}
|
||||
|
||||
is Album -> {
|
||||
playbackModel.addToUserQueue(data)
|
||||
context.showToast(R.string.label_queue_added)
|
||||
context.showToast(R.string.lbl_queue_added)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
|
||||
@@ -25,8 +25,6 @@ import org.oxycblt.auxio.widgets.forms.WidgetForm
|
||||
* Auxio's one and only appwidget. This widget follows a more unorthodox approach, effectively
|
||||
* packing what could be considered 3 or 4 widgets into a single responsive widget. More specifically:
|
||||
*
|
||||
* - TODO?: For widgets 3x1 or lower, show a text-only view with minimal controls
|
||||
* - TODO?: For widgets 4x1, show a minimized view with album art
|
||||
* - For widgets Wx2 or higher, show an expanded view with album art and basic controls
|
||||
* - For widgets 4x2 or higher, show a complete view with all playback controls
|
||||
*
|
||||
@@ -105,7 +103,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions)
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
// We can't resize the widget until we can generate the views, request an update
|
||||
// We can't resize the widget until we can generate the views, so request an update
|
||||
// from PlaybackService.
|
||||
requestUpdate(context)
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ class FullWidgetForm : WidgetForm(R.layout.widget_full) {
|
||||
views.setImageViewBitmap(R.id.widget_cover, state.albumArt)
|
||||
views.setCharSequence(
|
||||
R.id.widget_cover, "setContentDescription",
|
||||
context.getString(R.string.description_album_cover, state.song.album.name)
|
||||
context.getString(R.string.desc_album_cover, state.song.album.name)
|
||||
)
|
||||
} else {
|
||||
views.setImageViewResource(R.id.widget_cover, R.drawable.ic_song)
|
||||
views.setCharSequence(
|
||||
R.id.widget_cover,
|
||||
"setContentDescription",
|
||||
context.getString(R.string.description_no_cover)
|
||||
context.getString(R.string.desc_no_cover)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ class SmallWidgetForm : WidgetForm(R.layout.widget_small) {
|
||||
views.setImageViewBitmap(R.id.widget_cover, state.albumArt)
|
||||
views.setCharSequence(
|
||||
R.id.widget_cover, "setContentDescription",
|
||||
context.getString(R.string.description_album_cover, state.song.album.name)
|
||||
context.getString(R.string.desc_album_cover, state.song.album.name)
|
||||
)
|
||||
} else {
|
||||
views.setImageViewResource(R.id.widget_cover, R.drawable.ic_song)
|
||||
views.setCharSequence(
|
||||
R.id.widget_cover,
|
||||
"setContentDescription",
|
||||
context.getString(R.string.description_no_cover)
|
||||
context.getString(R.string.desc_no_cover)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user