mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:51:49 +01:00
Remove explicit source browse button, tint pin icon when pinned
This commit is contained in:
parent
a8c784355c
commit
34aaa7fb0a
@ -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)
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/source_browse"
|
||||
style="@style/Theme.Widget.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="48dp"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="48dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/browse"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/pin"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/pin"
|
||||
android:layout_width="44dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="0dp"
|
||||
android:alpha="0.75"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/action_pin"
|
||||
android:visibility="gone"
|
||||
@ -80,7 +67,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_push_pin_24dp"
|
||||
app:tint="?attr/colorOnSurface" />
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user