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