Set activated states for manga info favorite/tracker buttons
(cherry picked from commit 0904692f15)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt
# app/src/main/res/layout/manga_info_header.xml
This commit is contained in:
@@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.manga.info
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
@@ -22,7 +21,6 @@ import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.view.setTooltip
|
||||
import exh.MERGED_SOURCE_ID
|
||||
import exh.source.EnhancedHttpSource.Companion.getMainSource
|
||||
import exh.util.SourceTagsUtil
|
||||
@@ -115,27 +113,17 @@ class MangaInfoHeaderAdapter(
|
||||
isVisible = true
|
||||
|
||||
if (trackCount > 0) {
|
||||
setCompoundDrawablesWithIntrinsicBounds(
|
||||
null,
|
||||
ContextCompat.getDrawable(context, R.drawable.ic_done_24dp),
|
||||
null,
|
||||
null
|
||||
)
|
||||
setIconResource(R.drawable.ic_done_24dp)
|
||||
text = view.context.resources.getQuantityString(
|
||||
R.plurals.num_trackers,
|
||||
trackCount,
|
||||
trackCount
|
||||
)
|
||||
isSelected = true
|
||||
isActivated = true
|
||||
} else {
|
||||
setCompoundDrawablesWithIntrinsicBounds(
|
||||
null,
|
||||
ContextCompat.getDrawable(context, R.drawable.ic_sync_24dp),
|
||||
null,
|
||||
null
|
||||
)
|
||||
setIconResource(R.drawable.ic_sync_24dp)
|
||||
text = view.context.getString(R.string.manga_tracking_tab)
|
||||
isSelected = false
|
||||
isActivated = false
|
||||
}
|
||||
|
||||
clicks()
|
||||
@@ -151,7 +139,6 @@ class MangaInfoHeaderAdapter(
|
||||
binding.btnWebview.clicks()
|
||||
.onEach { controller.openMangaInWebView() }
|
||||
.launchIn(scope)
|
||||
binding.btnWebview.setTooltip(R.string.action_open_in_web_view)
|
||||
}
|
||||
|
||||
// SY -->
|
||||
@@ -320,18 +307,10 @@ class MangaInfoHeaderAdapter(
|
||||
// Set the Favorite drawable to the correct one.
|
||||
// Border drawable if false, filled drawable if true.
|
||||
binding.btnFavorite.apply {
|
||||
setCompoundDrawablesWithIntrinsicBounds(
|
||||
null,
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp
|
||||
),
|
||||
null,
|
||||
null
|
||||
)
|
||||
setIconResource(if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp)
|
||||
text =
|
||||
context.getString(if (isFavorite) R.string.in_library else R.string.add_to_library)
|
||||
isSelected = isFavorite
|
||||
isActivated = isFavorite
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user