mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 17:05:07 +01:00
Fix settings tracking crash
This commit is contained in:
parent
c43d5f01fa
commit
1f707141a6
@ -4,10 +4,10 @@ import android.content.Context
|
|||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.widget.ImageView
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceViewHolder
|
import androidx.preference.PreferenceViewHolder
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.databinding.PrefWidgetImageviewBinding
|
|
||||||
|
|
||||||
class LoginPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
class LoginPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||||
Preference(context, attrs) {
|
Preference(context, attrs) {
|
||||||
@ -18,15 +18,16 @@ class LoginPreference @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||||
super.onBindViewHolder(holder)
|
super.onBindViewHolder(holder)
|
||||||
val binding = PrefWidgetImageviewBinding.bind(holder.itemView)
|
|
||||||
|
|
||||||
binding.imageView.setImageResource(
|
(holder.findViewById(R.id.image_view) as? ImageView)?.let { imageView ->
|
||||||
|
imageView.setImageResource(
|
||||||
if (getPersistedString("").isNullOrEmpty()) android.R.color.transparent
|
if (getPersistedString("").isNullOrEmpty()) android.R.color.transparent
|
||||||
else R.drawable.ic_done_24dp
|
else R.drawable.ic_done_24dp
|
||||||
)
|
)
|
||||||
binding.imageView.imageTintList =
|
imageView.imageTintList =
|
||||||
ColorStateList.valueOf(Color.parseColor("#FF4CAF50"))
|
ColorStateList.valueOf(Color.parseColor("#FF4CAF50"))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override fun notifyChanged() {
|
public override fun notifyChanged() {
|
||||||
super.notifyChanged()
|
super.notifyChanged()
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
<ImageView android:id="@+id/image_view"
|
<ImageView android:id="@+id/image_view"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
</ImageView>
|
|
Loading…
Reference in New Issue
Block a user