Improve accents

Add a new "Neutral" accent and improve the yellow accent so that its more visible.
This commit is contained in:
OxygenCobalt 2020-12-05 10:42:22 -07:00
parent c44003907a
commit dbd2c022a0
11 changed files with 26 additions and 20 deletions

View file

@ -21,7 +21,6 @@ import org.oxycblt.auxio.music.MusicStore
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.ui.accent
import org.oxycblt.auxio.ui.getInactiveAlpha
import org.oxycblt.auxio.ui.getTransparentAccent
import org.oxycblt.auxio.ui.toColor
import kotlin.IllegalArgumentException
@ -48,9 +47,7 @@ class MainFragment : Fragment() {
val colorActive = accent.first.toColor(requireContext())
val colorInactive = getTransparentAccent(
requireContext(),
accent.first,
getInactiveAlpha(accent.first)
requireContext(), accent.first, 150
)
// Set up the tints for the navigation icons + text

View file

@ -50,6 +50,9 @@ class QueueFragment : Fragment() {
findNavController().navigateUp()
}
// Since QueueFragment doesn't fit system windows, inset padding needs to be
// artificially applied to the Toolbar so that it fits on the main window AND
// so that the elevation doesn't show on the top.
setOnApplyWindowInsetsListener { _, insets ->
val top = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
insets.getInsets(WindowInsets.Type.systemBars()).top

View file

@ -285,31 +285,35 @@ class PlaybackStateManager private constructor() {
forceQueueUpdate()
}
fun removeQueueItem(index: Int) {
fun removeQueueItem(index: Int): Boolean {
Log.d(this::class.simpleName, "Removing item ${mQueue[index].name}.")
if (index > mQueue.size || index < 0) {
Log.e(this::class.simpleName, "Index is out of bounds, did not remove queue item.")
return
return false
}
mQueue.removeAt(index)
forceQueueUpdate()
return true
}
fun moveQueueItems(from: Int, to: Int) {
fun moveQueueItems(from: Int, to: Int): Boolean {
try {
val item = mQueue.removeAt(from)
mQueue.add(to, item)
} catch (exception: IndexOutOfBoundsException) {
Log.e(this::class.simpleName, "Indices were out of bounds, did not move queue item")
return
return false
}
forceQueueUpdate()
return true
}
fun addToUserQueue(song: Song) {

View file

@ -6,7 +6,7 @@ import org.oxycblt.auxio.R
/**
* Convert a string representing a theme entry name to an actual theme int that can be used.
* This is only done because PreferenceFragment does not like int arrays.
* This is only done because PreferenceFragment does not like int arrays for some...reason.
*/
fun String.toThemeInt(): Int {
return when (this) {

View file

@ -38,7 +38,8 @@ val ACCENTS = arrayOf(
Pair(R.color.deep_orange, R.style.Theme_DeepOrange), // 15
Pair(R.color.brown, R.style.Theme_Brown), // 16
Pair(R.color.grey, R.style.Theme_Gray), // 17
Pair(R.color.blue_grey, R.style.Theme_BlueGrey) // 18
Pair(R.color.blue_grey, R.style.Theme_BlueGrey), // 18
Pair(R.color.control_color, R.style.Theme_Neutral)
)
/**
@ -55,7 +56,7 @@ private val ACCENT_NAMES = arrayOf(
R.string.color_label_yellow, R.string.color_label_amber,
R.string.color_label_orange, R.string.color_label_deep_orange,
R.string.color_label_brown, R.string.color_label_grey,
R.string.color_label_blue_grey
R.string.color_label_blue_grey, R.string.color_label_neutral
)
/**
@ -78,14 +79,6 @@ fun getTransparentAccent(context: Context, @ColorRes color: Int, alpha: Int): In
)
}
/**
* Get the inactive alpha of an accent.
*/
@ColorInt
fun getInactiveAlpha(@ColorRes color: Int): Int {
return if (color == R.color.yellow) 100 else 150
}
/**
* Resolve a color.
* @param context [Context] required

View file

@ -40,6 +40,7 @@
style="@style/ItemText.Secondary"
app:albumYear="@{album}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/album_name"
tools:text="2020" />

View file

@ -40,6 +40,7 @@
style="@style/ItemText.Secondary"
app:genreCounts="@{genre}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/genre_image"
app:layout_constraintTop_toBottomOf="@+id/genre_name"
tools:text="2 Artists, 4 Albums" />

View file

@ -40,6 +40,7 @@
style='@style/ItemText.Secondary'
app:artistCounts="@{artist}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2 Albums, 20 Songs" />

View file

@ -23,7 +23,7 @@
<color name="green">#4caf50</color>
<color name="light_green">#8bc34a</color>
<color name="lime">#cddc39</color>
<color name="yellow">#ffeb3b</color>
<color name="yellow">#F1CA00</color>
<color name="amber">#ffc107</color>
<color name="orange">#ff9800</color>
<color name="deep_orange">#ff5722</color>

View file

@ -119,6 +119,7 @@
<string name="color_label_brown">Brown</string>
<string name="color_label_grey">Grey</string>
<string name="color_label_blue_grey">Blue Grey</string>
<string name="color_label_neutral">Neutral</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="format_info">%1$s / %2$s</string>

View file

@ -97,4 +97,9 @@
<item name="colorPrimary">@color/blue_grey</item>
<item name="colorSecondary">@color/blue_grey</item>
</style>
<style name="Theme.Neutral" parent="Theme.Base">
<item name="colorPrimary">@color/control_color</item>
<item name="colorSecondary">@color/control_color</item>
</style>
</resources>