From 34aaa7fb0a2869c497c2e65ba5718288d711ad5f Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 26 Jul 2020 16:28:58 -0400 Subject: [PATCH] Remove explicit source browse button, tint pin icon when pinned --- .../browse/migration/sources/SourceHolder.kt | 8 ------ .../ui/browse/source/SourceHolder.kt | 22 ++++++---------- .../source_main_controller_card_item.xml | 25 +++++-------------- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt index e26a5ec23..65e75ce44 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt @@ -1,15 +1,12 @@ package eu.kanade.tachiyomi.ui.browse.migration.sources import android.view.View -import androidx.core.view.isVisible import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder import io.github.mthli.slice.Slice import kotlinx.android.synthetic.main.source_main_controller_card_item.card import kotlinx.android.synthetic.main.source_main_controller_card_item.image -import kotlinx.android.synthetic.main.source_main_controller_card_item.source_browse -import kotlinx.android.synthetic.main.source_main_controller_card_item.source_latest import kotlinx.android.synthetic.main.source_main_controller_card_item.title class SourceHolder(view: View, override val adapter: SourceAdapter) : @@ -23,11 +20,6 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : override val viewToSlice: View get() = card - init { - source_latest.isVisible = false - source_browse.isVisible = false - } - fun bind(item: SourceItem) { val source = item.source setCardEdges(item) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt index f829057e6..79e69d179 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt @@ -7,15 +7,16 @@ import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder +import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.util.view.setVectorCompat import io.github.mthli.slice.Slice import kotlinx.android.synthetic.main.source_main_controller_card_item.card import kotlinx.android.synthetic.main.source_main_controller_card_item.image import kotlinx.android.synthetic.main.source_main_controller_card_item.pin -import kotlinx.android.synthetic.main.source_main_controller_card_item.source_browse import kotlinx.android.synthetic.main.source_main_controller_card_item.source_latest import kotlinx.android.synthetic.main.source_main_controller_card_item.title -class SourceHolder(view: View, override val adapter: SourceAdapter) : +class SourceHolder(private val view: View, override val adapter: SourceAdapter) : BaseFlexibleViewHolder(view, adapter), SlicedHolder { @@ -27,10 +28,6 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : get() = card init { - source_browse.setOnClickListener { - adapter.clickListener.onBrowseClick(bindingAdapterPosition) - } - source_latest.setOnClickListener { adapter.clickListener.onLatestClick(bindingAdapterPosition) } @@ -56,16 +53,13 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : } } - source_browse.setText(R.string.browse) source_latest.isVisible = source.supportsLatest pin.isVisible = true - pin.setImageResource( - if (item.isPinned) { - R.drawable.ic_push_pin_filled_24dp - } else { - R.drawable.ic_push_pin_24dp - } - ) + if (item.isPinned) { + pin.setVectorCompat(R.drawable.ic_push_pin_filled_24dp, view.context.getResourceColor(R.attr.colorAccent)) + } else { + pin.setVectorCompat(R.drawable.ic_push_pin_24dp, view.context.getResourceColor(android.R.attr.textColorHint)) + } } } diff --git a/app/src/main/res/layout/source_main_controller_card_item.xml b/app/src/main/res/layout/source_main_controller_card_item.xml index 777a751b8..c31b2a2dd 100644 --- a/app/src/main/res/layout/source_main_controller_card_item.xml +++ b/app/src/main/res/layout/source_main_controller_card_item.xml @@ -49,30 +49,17 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/latest" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/source_browse" - app:layout_constraintTop_toTopOf="parent" /> - -