Closed clevertrevor closed 4 years ago
I figured out a hack to prevent the previous theme's colors from leaking into. the current theme. There will be adverse changes in regards to persistence of all the other attributes. Replace usages of FloatingSearchView
with the DayNight version.
package com.arlib.floatingsearchview
import android.content.Context
import android.os.Parcelable
import android.util.AttributeSet
class FloatingSearchViewDayNight @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null)
: FloatingSearchView(context, attrs) {
// hack to remove color attributes which should not be reused
override fun onSaveInstanceState(): Parcelable? {
super.onSaveInstanceState()
return null
}
}
I am changing my application to use a DayNight theme so it will follow the user's device preferences. However, the FloatingSearchView is the only View not changing themes and is locked to whatever theme the app started in. I've tried invaliding
FloatingSearchView
and setting a dark/light theme as one of its XML attributes.Here's the XML declaration.