style: migrate to Material3 text styling

Migrate to 100% Material3 text styling. I had to basically ignore the
intended styling here just to get a sensible design here, which is
"bad" but I do what I want. The only usage of MaterialComponents left
in the project now is the dialog since the new dialog style the worst
thing ever.
This commit is contained in:
OxygenCobalt
2021-11-11 11:48:22 -07:00
parent 63198f8677
commit 8f61d8479a
15 changed files with 161 additions and 79 deletions
@@ -24,7 +24,6 @@ import android.graphics.Canvas
import android.graphics.Rect
import android.text.TextUtils
import android.util.AttributeSet
import android.util.TypedValue
import android.view.Gravity
import android.view.MotionEvent
import android.view.View
@@ -35,6 +34,7 @@ import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.math.MathUtils
import androidx.core.widget.TextViewCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -149,13 +149,8 @@ class FastScrollRecyclerView @JvmOverloads constructor(
includeFontPadding = false
isSingleLine = true
setTextColor(android.R.attr.textColorPrimaryInverse.resolveAttr(context))
setTextSize(
TypedValue.COMPLEX_UNIT_PX,
resources.getDimensionPixelSize(
R.dimen.text_size_insane
).toFloat()
)
TextViewCompat.setTextAppearance(this, R.style.TextAppearance_Auxio_HeadlineLarge)
setTextColor(R.attr.colorSurface.resolveAttr(context))
}
thumbWidth = thumbDrawable.intrinsicWidth
@@ -37,14 +37,20 @@ enum class PlaybackMode {
* @return The constant for this mode,
*/
fun toInt(): Int {
return CONST_ALL_SONGS + ordinal
return when (this) {
ALL_SONGS -> CONST_ALL_SONGS
IN_ALBUM -> CONST_IN_ALBUM
IN_ARTIST -> CONST_IN_ARTIST
IN_GENRE -> CONST_IN_GENRE
}
}
companion object {
private const val CONST_ALL_SONGS = 0xA103
private const val CONST_IN_ALBUM = 0xA104
private const val CONST_IN_ARTIST = 0xA105
private const val CONST_IN_GENRE = 0xA106
// Kept in reverse order because of backwards compat, do not re-order these
private const val CONST_ALL_SONGS = 0xA106
private const val CONST_IN_ALBUM = 0xA105
private const val CONST_IN_ARTIST = 0xA104
private const val CONST_IN_GENRE = 0xA103
/**
* Get a [PlaybackMode] for an int [constant]
@@ -154,6 +154,7 @@ fun createWideWidget(context: Context, state: WidgetState): RemoteViews {
fun createSmallWidget(context: Context, state: WidgetState): RemoteViews {
return createViews(context, R.layout.widget_small)
.applyMeta(state)
.applyCover(context, state)
.applyControls(context, state)
}