Change RecyclerView divider color
Change the RecyclerView divider color to not require any transparency changes through ThemeUtils.
This commit is contained in:
parent
d017774cef
commit
4b3285cef0
6 changed files with 11 additions and 21 deletions
|
|
@ -34,9 +34,9 @@ class MusicRepository {
|
||||||
loader.albums,
|
loader.albums,
|
||||||
loader.songs,
|
loader.songs,
|
||||||
|
|
||||||
app.applicationContext.getString(R.string.label_unknown_genre),
|
app.applicationContext.getString(R.string.placeholder_unknown_genre),
|
||||||
app.applicationContext.getString(R.string.label_unknown_artist),
|
app.applicationContext.getString(R.string.placeholder_unknown_artist),
|
||||||
app.applicationContext.getString(R.string.label_unknown_album)
|
app.applicationContext.getString(R.string.placeholder_unknown_album)
|
||||||
)
|
)
|
||||||
|
|
||||||
songs = sorter.songs.toList()
|
songs = sorter.songs.toList()
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ import android.graphics.drawable.ColorDrawable
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.theme.getDayNightAlpha
|
import org.oxycblt.auxio.theme.toColor
|
||||||
import org.oxycblt.auxio.theme.getTransparentAccent
|
|
||||||
|
|
||||||
// Apply a custom vertical divider
|
// Apply a custom vertical divider
|
||||||
fun RecyclerView.applyDivider() {
|
fun RecyclerView.applyDivider() {
|
||||||
|
|
@ -16,9 +15,7 @@ fun RecyclerView.applyDivider() {
|
||||||
|
|
||||||
div.setDrawable(
|
div.setDrawable(
|
||||||
ColorDrawable(
|
ColorDrawable(
|
||||||
getTransparentAccent(
|
R.color.divider_color.toColor(context)
|
||||||
context, R.color.divider_color, getDayNightAlpha()
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.oxycblt.auxio.theme
|
package org.oxycblt.auxio.theme
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
|
|
@ -31,13 +30,6 @@ private val ACCENTS = listOf(
|
||||||
|
|
||||||
val accent = ACCENTS[5]
|
val accent = ACCENTS[5]
|
||||||
|
|
||||||
fun getDayNightAlpha(): Int {
|
|
||||||
val isDark = AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES
|
|
||||||
|
|
||||||
// Depending on the theme use a different opacity for the divider
|
|
||||||
return if (isDark) 45 else 85
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getInactiveAlpha(color: Int): Int {
|
fun getInactiveAlpha(color: Int): Int {
|
||||||
return if (color == R.color.yellow) 100 else 150
|
return if (color == R.color.yellow) 100 else 150
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="background">#151515</color>
|
<color name="background">#151515</color>
|
||||||
<color name="divider_color">#6d6d6d</color>
|
<color name="divider_color">#323232</color>
|
||||||
<color name="selection_color">#484848</color>
|
<color name="selection_color">#484848</color>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="background">#fafafa</color>
|
<color name="background">#fafafa</color>
|
||||||
<color name="divider_color">#6d6d6d</color>
|
<color name="divider_color">#cbcbcb</color>
|
||||||
<color name="selection_color">#cbcbcb</color>
|
<color name="selection_color">#cbcbcb</color>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,10 @@
|
||||||
<string name="label_retry">Retry</string>
|
<string name="label_retry">Retry</string>
|
||||||
<string name="label_grant">Grant</string>
|
<string name="label_grant">Grant</string>
|
||||||
<string name="label_single_song">1 Song</string>
|
<string name="label_single_song">1 Song</string>
|
||||||
<string name="label_unknown_genre">Unknown Genre</string>
|
|
||||||
<string name="label_unknown_artist">Unknown Artist</string>
|
<string name="placeholder_unknown_genre">Unknown Genre</string>
|
||||||
<string name="label_unknown_album">Unknown Album</string>
|
<string name="placeholder_unknown_artist">Unknown Artist</string>
|
||||||
|
<string name="placeholder_unknown_album">Unknown Album</string>
|
||||||
|
|
||||||
<string name="format_multi_song_count">%s Songs</string>
|
<string name="format_multi_song_count">%s Songs</string>
|
||||||
<string name="format_song_info">%s / %s</string>
|
<string name="format_song_info">%s / %s</string>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue