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))
}
}

View File

@@ -42,11 +42,11 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_small"
android:text="@string/new_version_s"
android:textAppearance="?attr/textAppearanceBodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/icon"
app:layout_constraintTop_toBottomOf="@id/textPrimary"
tools:text="@string/new_version_s" />
app:layout_constraintTop_toBottomOf="@id/textPrimary" />
<Button
android:id="@+id/button_download"

View File

@@ -332,4 +332,5 @@
<string name="random">Random</string>
<string name="categories_delete_confirm">Are you sure you want to delete the selected favorite categories?\nAll manga in it will be lost and this cannot be undone.</string>
<string name="reorder">Reorder</string>
<string name="empty">Empty</string>
</resources>