This commit is contained in:
Koitharu
2022-07-09 18:42:33 +03:00
parent e4668cf938
commit 5b066c9dde
4 changed files with 19 additions and 9 deletions

View File

@@ -48,8 +48,10 @@ fun categoryAD(
binding.imageViewCover2,
ColorStateList.valueOf(ColorUtils.setAlphaComponent(backgroundColor, 76))
)
binding.imageViewCover2.backgroundTintList = ColorStateList.valueOf(ColorUtils.setAlphaComponent(backgroundColor, 76))
binding.imageViewCover3.backgroundTintList = ColorStateList.valueOf(ColorUtils.setAlphaComponent(backgroundColor, 153))
binding.imageViewCover2.backgroundTintList =
ColorStateList.valueOf(ColorUtils.setAlphaComponent(backgroundColor, 76))
binding.imageViewCover3.backgroundTintList =
ColorStateList.valueOf(ColorUtils.setAlphaComponent(backgroundColor, 153))
val fallback = ColorDrawable(Color.TRANSPARENT)
val coverViews = arrayOf(binding.imageViewCover1, binding.imageViewCover2, binding.imageViewCover3)
val imageRequests = arrayOfNulls<Disposable?>(coverViews.size)
@@ -63,11 +65,15 @@ fun categoryAD(
imageRequests.forEach { it?.dispose() }
binding.imageViewHandle.isVisible = item.isReorderMode
binding.textViewTitle.text = item.category.title
binding.textViewSubtitle.text = context.resources.getQuantityString(
R.plurals.items,
item.mangaCount,
item.mangaCount,
)
binding.textViewSubtitle.text = if (item.mangaCount == 0) {
getString(R.string.empty)
} else {
context.resources.getQuantityString(
R.plurals.items,
item.mangaCount,
item.mangaCount,
)
}
repeat(coverViews.size) { i ->
imageRequests[i] = coverViews[i].newImageRequest(item.covers.getOrNull(i))
.placeholder(R.drawable.ic_placeholder)

View File

@@ -9,6 +9,7 @@ import androidx.core.view.updatePadding
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.BaseFragment
import org.koitharu.kotatsu.databinding.FragmentToolsBinding
import org.koitharu.kotatsu.download.ui.DownloadsActivity
import org.koitharu.kotatsu.settings.AppUpdateChecker
import org.koitharu.kotatsu.settings.SettingsActivity
@@ -23,6 +24,7 @@ class ToolsFragment : BaseFragment<FragmentToolsBinding>(), View.OnClickListener
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.buttonSettings.setOnClickListener(this)
binding.buttonDownloads.setOnClickListener(this)
binding.cardUpdate.root.setOnClickListener(this)
binding.cardUpdate.buttonDownload.setOnClickListener(this)
}
@@ -30,6 +32,7 @@ class ToolsFragment : BaseFragment<FragmentToolsBinding>(), View.OnClickListener
override fun onClick(v: View) {
when (v.id) {
R.id.button_settings -> startActivity(SettingsActivity.newIntent(v.context))
R.id.button_downloads -> startActivity(DownloadsActivity.newIntent(v.context))
}
}