styles: redo accents

Recreate all accents AGAIN. This time it's to properly generate secondary
and tertiary colors for these. The results of them vary [some might be
removed since they're too similar to other accents now], but most are
fine and they allow me to properly use these components without inane
bugs.
This commit is contained in:
OxygenCobalt
2021-11-13 11:51:36 -07:00
parent d732aea1d3
commit 43b12598fb
16 changed files with 1305 additions and 491 deletions
@@ -18,12 +18,14 @@
package org.oxycblt.auxio.accent
import android.content.res.ColorStateList
import android.view.ViewGroup
import androidx.appcompat.widget.TooltipCompat
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.ItemAccentBinding
import org.oxycblt.auxio.util.inflater
import org.oxycblt.auxio.util.resolveAttr
import org.oxycblt.auxio.util.resolveStateList
/**
@@ -81,7 +83,7 @@ class AccentAdapter(
selectedViewHolder?.setSelected(false)
selectedViewHolder = this
R.color.surface.resolveStateList(context)
ColorStateList.valueOf(R.attr.colorSurface.resolveAttr(context))
} else {
android.R.color.transparent.resolveStateList(context)
}
@@ -30,6 +30,10 @@ class FloatingActionButtonContainer @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = -1
) : FrameLayout(context, attrs, defStyleAttr) {
init {
clipToPadding = false
}
override fun dispatchApplyWindowInsets(insets: WindowInsets): WindowInsets {
return onApplyWindowInsets(insets)
}
@@ -85,10 +85,13 @@ class CompactPlaybackView @JvmOverloads constructor(
mCallback?.onPlayPauseClick()
}
// By default, LinearProgressIndicator will not actually color the track with the proper
// opacity. Why? Who knows!
// Deliberately override the progress bar color [in a Lollipop-friendly way] so that
// we use colorSecondary instead of colorSurfaceVariant. This is for two reasons:
// 1. colorSurfaceVariant is used with the assumption that the view that is using it
// is not elevated and is therefore not colored. This view is elevated.
// 2. The way a solid color plays along with a ripple just doesnt look that good.
binding.playbackProgressBar.trackColor = MaterialColors.compositeARGBWithAlpha(
binding.playbackProgressBar.trackColor, (255 * 0.2).toInt()
R.attr.colorSecondary.resolveAttr(context), (255 * 0.2).toInt()
)
}
@@ -19,12 +19,16 @@
package org.oxycblt.auxio.playback
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.material.color.MaterialColors
import com.google.android.material.slider.Slider
import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.ViewSeekBarBinding
import org.oxycblt.auxio.music.toDuration
import org.oxycblt.auxio.util.inflater
import org.oxycblt.auxio.util.resolveAttr
/**
* A custom view that bundles together a seekbar with a current duration and a total duration.
@@ -45,6 +49,13 @@ class PlaybackSeekBar @JvmOverloads constructor(
init {
binding.seekBar.addOnChangeListener(this)
binding.seekBar.addOnSliderTouchListener(this)
// Override the inactive color so that it lines up with the playback progress bar.
binding.seekBar.trackInactiveTintList = ColorStateList.valueOf(
MaterialColors.compositeARGBWithAlpha(
R.attr.colorSecondary.resolveAttr(context), (255 * 0.2).toInt()
)
)
}
fun setProgress(seconds: Long) {