ui: rework resource distribution

Try to remove the weird config file and replace it with more
conventional resource files in other places.
This commit is contained in:
OxygenCobalt
2022-08-05 09:58:20 -06:00
parent 7d04aad9b7
commit e12c7cb419
25 changed files with 59 additions and 156 deletions
@@ -44,6 +44,9 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
*
* TODO: Add multi-select
*
* LEFT-OFF: Add RecyclerView styles, queue issue is caused by tiny scroll and then replace op, not
* enough to change scroll apparently
*
* @author OxygenCobalt
*/
class MainActivity : AppCompatActivity() {
@@ -111,8 +111,7 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
this.titleAnimator =
ValueAnimator.ofFloat(from, to).apply {
addUpdateListener { titleView?.alpha = it.animatedValue as Float }
duration =
resources.getInteger(R.integer.detail_app_bar_title_anim_duration).toLong()
duration = TOOLBAR_FADE_DURATION
start()
}
}
@@ -143,6 +142,8 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
}
companion object {
private const val TOOLBAR_FADE_DURATION = 150L
private val TOOLBAR_TITLE_TEXT_FIELD: Field by
lazyReflectedField(Toolbar::class, "mTitleTextView")
}
@@ -17,6 +17,7 @@
package org.oxycblt.auxio.settings
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.annotation.DrawableRes
@@ -161,6 +162,10 @@ class SettingsListFragment : PreferenceFragmentCompat() {
preference.apply {
when (key) {
context.getString(R.string.set_key_theme) -> {
// Android 12 is the first version I deem to have universal dark and light
// mode toggles. No need for our setting.
isVisible = Build.VERSION.SDK_INT < Build.VERSION_CODES.S
onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _, value ->
AppCompatDelegate.setDefaultNightMode(value as Int)