mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Update tracker services logo layout (closes #5625)
This commit is contained in:
@@ -35,7 +35,7 @@ class TrackSearchAdapter(
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TrackSearchHolder {
|
||||
val binding = TrackSearchItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
binding.container.applyElevationOverlay()
|
||||
binding.root.applyElevationOverlay()
|
||||
return TrackSearchHolder(binding, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ class TrackSearchHolder(
|
||||
private val adapter: TrackSearchAdapter
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(track: TrackSearch, position: Int) {
|
||||
binding.container.isChecked = position == adapter.selectedItemPosition
|
||||
binding.container.setOnClickListener {
|
||||
binding.root.isChecked = position == adapter.selectedItemPosition
|
||||
binding.root.setOnClickListener {
|
||||
adapter.selectedItemPosition = position
|
||||
binding.container.isChecked = true
|
||||
binding.root.isChecked = true
|
||||
}
|
||||
|
||||
binding.trackSearchTitle.text = track.title
|
||||
@@ -62,6 +62,6 @@ class TrackSearchHolder(
|
||||
}
|
||||
|
||||
fun setUnchecked() {
|
||||
binding.container.isChecked = false
|
||||
binding.root.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.widget.preference.LoginPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.TrackerPreference
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
@@ -96,12 +96,13 @@ class SettingsTrackingController :
|
||||
private inline fun PreferenceGroup.trackPreference(
|
||||
service: TrackService,
|
||||
crossinline login: () -> Unit
|
||||
): LoginPreference {
|
||||
): TrackerPreference {
|
||||
return add(
|
||||
LoginPreference(context).apply {
|
||||
TrackerPreference(context).apply {
|
||||
key = Keys.trackUsername(service.id)
|
||||
titleRes = service.nameRes()
|
||||
iconRes = service.getLogo()
|
||||
iconColor = service.getLogoColor()
|
||||
onClick {
|
||||
if (service.isLogged) {
|
||||
if (service is NoLoginTrackService) {
|
||||
@@ -142,7 +143,7 @@ class SettingsTrackingController :
|
||||
}
|
||||
|
||||
private fun updatePreference(id: Int) {
|
||||
val pref = findPreference(Keys.trackUsername(id)) as? LoginPreference
|
||||
val pref = findPreference(Keys.trackUsername(id)) as? TrackerPreference
|
||||
pref?.notifyChanged()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user