Fix crashes on home screen shortcuts and going to artist page
This commit is contained in:
parent
240874f312
commit
263620310f
38 changed files with 214 additions and 222 deletions
|
@ -16,8 +16,6 @@ import code.name.monkey.appthemehelper.R
|
|||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.common.views.ATESwitch
|
||||
|
||||
import java.lang.reflect.Field
|
||||
|
||||
/**
|
||||
* @author Aidan Follestad (afollestad)
|
||||
*/
|
||||
|
@ -26,23 +24,23 @@ class ATESwitchPreference : SwitchPreference {
|
|||
private var mSwitch: ATESwitch? = null
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init() {
|
||||
layoutResource = R.layout.ate_preference_custom
|
||||
if (COMPAT_MODE) {
|
||||
widgetLayoutResource = R.layout.ate_preference_switch
|
||||
|
|
|
@ -19,19 +19,19 @@ class ATEColorPreference(context: Context, attrs: AttributeSet?, defStyleAttr: I
|
|||
private var border: Int = 0
|
||||
|
||||
constructor(context: Context) : this(context, null, 0) {
|
||||
init(context, null)
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
init {
|
||||
init(context, attrs)
|
||||
init()
|
||||
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init() {
|
||||
layoutResource = R.layout.ate_preference_custom_support
|
||||
widgetLayoutResource = R.layout.ate_preference_color
|
||||
isPersistent = false
|
||||
|
|
|
@ -14,23 +14,23 @@ import code.name.monkey.appthemehelper.R
|
|||
class ATESwitchPreference : CheckBoxPreference {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
||||
init(context, attrs)
|
||||
init()
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init() {
|
||||
layoutResource = R.layout.ate_preference_custom_support
|
||||
widgetLayoutResource = R.layout.ate_preference_switch_support
|
||||
}
|
||||
|
|
|
@ -14,18 +14,18 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
class ATEEditText : AppCompatEditText {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init(context: Context) {
|
||||
ATH.setTint(this, ThemeStore.accentColor(context))
|
||||
setTextColor(ThemeStore.textColorPrimary(context))
|
||||
}
|
||||
|
|
|
@ -16,23 +16,23 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
class ATEProgressBar : ProgressBar {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init(context: Context) {
|
||||
ATH.setTint(this, ThemeStore.accentColor(context))
|
||||
}
|
||||
}
|
|
@ -12,18 +12,18 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
class ATESecondaryTextView : AppCompatTextView {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init(context: Context) {
|
||||
setTextColor(ThemeStore.textColorSecondary(context))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,18 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
class ATEStockSwitch : Switch {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
private fun init(context: Context) {
|
||||
ATH.setTint(this, ThemeStore.accentColor(context))
|
||||
}
|
||||
|
||||
|
|
|
@ -23,15 +23,6 @@ object ATHUtil {
|
|||
}
|
||||
}
|
||||
|
||||
fun isInClassPath(clsName: String): Boolean {
|
||||
try {
|
||||
return inClassPath(clsName) != null
|
||||
} catch (t: Throwable) {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun inClassPath(clsName: String): Class<*> {
|
||||
try {
|
||||
return Class.forName(clsName)
|
||||
|
|
|
@ -3,27 +3,19 @@ package code.name.monkey.appthemehelper.util
|
|||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.TransitionDrawable
|
||||
import android.os.Build
|
||||
import androidx.annotation.ColorInt
|
||||
import android.view.View
|
||||
import android.view.ViewTreeObserver
|
||||
import androidx.annotation.ColorInt
|
||||
|
||||
|
||||
object ViewUtil {
|
||||
|
||||
fun removeOnGlobalLayoutListener(v: View, listener: ViewTreeObserver.OnGlobalLayoutListener) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
v.viewTreeObserver.removeGlobalOnLayoutListener(listener)
|
||||
} else {
|
||||
v.viewTreeObserver.removeOnGlobalLayoutListener(listener)
|
||||
}
|
||||
v.viewTreeObserver.removeOnGlobalLayoutListener(listener)
|
||||
}
|
||||
|
||||
fun setBackgroundCompat(view: View, drawable: Drawable?) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
|
||||
view.background = drawable
|
||||
else
|
||||
view.setBackgroundDrawable(drawable)
|
||||
view.background = drawable
|
||||
}
|
||||
|
||||
fun setBackgroundTransition(view: View, newDrawable: Drawable): TransitionDrawable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue