From 535feb424c0e7df64295c5f5b092a151234b6823 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 13 Apr 2024 15:16:23 +0300 Subject: [PATCH] UI fixes --- .../kotatsu/core/ui/widgets/ProgressButton.kt | 9 +-- .../kotatsu/details/ui/DetailsActivity.kt | 6 +- .../koitharu/kotatsu/main/ui/MainActivity.kt | 1 + .../tracker/ui/feed/FeedMenuProvider.kt | 6 -- .../main/res/layout/layout_details_info.xml | 75 ------------------- app/src/main/res/menu/opt_feed.xml | 6 -- 6 files changed, 7 insertions(+), 96 deletions(-) delete mode 100644 app/src/main/res/layout/layout_details_info.xml diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ProgressButton.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ProgressButton.kt index d95b1dd63..c704df313 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ProgressButton.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ProgressButton.kt @@ -20,7 +20,6 @@ import androidx.core.view.children import androidx.core.widget.TextViewCompat import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.util.ext.getAnimationDuration -import org.koitharu.kotatsu.core.util.ext.getThemeColor import org.koitharu.kotatsu.core.util.ext.getThemeColorStateList import org.koitharu.kotatsu.core.util.ext.resolveDp import org.koitharu.kotatsu.core.util.ext.setTextAndVisible @@ -75,10 +74,10 @@ class ProgressButton @JvmOverloads constructor( ?: context.getThemeColorStateList(materialR.attr.colorPrimaryContainer) ?: colorBase colorProgress = getColorStateList(R.styleable.ProgressButton_progressColor) ?: context.getThemeColorStateList(materialR.attr.colorPrimary) ?: colorProgress - val colorText = getColorStateList(R.styleable.ProgressButton_android_textColor) - ?: context.getThemeColorStateList(materialR.attr.colorOnPrimaryContainer) ?: textViewTitle.textColors - textViewTitle.setTextColor(colorText) - textViewSubtitle.setTextColor(colorText) + getColorStateList(R.styleable.ProgressButton_android_textColor)?.let { colorText -> + textViewTitle.setTextColor(colorText) + textViewSubtitle.setTextColor(colorText) + } progress = getInt(R.styleable.ProgressButton_android_progress, 0).toFloat() / getInt(R.styleable.ProgressButton_android_max, 100).toFloat() } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index 246ff8204..fa075822a 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -180,10 +180,7 @@ class DetailsActivity : viewBinding.infoLayout.chipBranch.isVisible = it.size > 1 } viewModel.chapters.observe(this, PrefetchObserver(this)) - viewModel.onDownloadStarted.observeEvent( - this, - DownloadStartedObserver(viewBinding.scrollView), - ) + viewModel.onDownloadStarted.observeEvent(this, DownloadStartedObserver(viewBinding.scrollView)) addMenuProvider( DetailsMenuProvider( @@ -531,6 +528,7 @@ class DetailsActivity : info.isIncognitoMode -> getString(R.string.incognito_mode) info.currentChapter >= 0 -> getString(R.string.chapter_d_of_d, info.currentChapter + 1, info.totalChapters) info.totalChapters == 0 -> getString(R.string.no_chapters) + info.totalChapters == -1 -> getString(R.string.error_occurred) else -> resources.getQuantityString(R.plurals.chapters, info.totalChapters, info.totalChapters) } buttonRead.setProgress(info.history?.percent?.coerceIn(0f, 1f) ?: 0f, true) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt index c3716f9cf..779c8fc93 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/MainActivity.kt @@ -277,6 +277,7 @@ class MainActivity : BaseActivity(), AppBarOwner, BottomNav private fun onFeedCounterChanged(counter: Int) { navigationDelegate.setCounter(NavItem.FEED, counter) + navigationDelegate.setCounter(NavItem.UPDATED, counter) } private fun onIncognitoModeChanged(isIncognito: Boolean) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/FeedMenuProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/FeedMenuProvider.kt index 26f4444de..063046c32 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/FeedMenuProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/FeedMenuProvider.kt @@ -8,7 +8,6 @@ import android.view.View import androidx.core.view.MenuProvider import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.ui.dialog.CheckBoxAlertDialog -import org.koitharu.kotatsu.tracker.ui.updates.UpdatesActivity class FeedMenuProvider( private val snackbarHost: View, @@ -51,11 +50,6 @@ class FeedMenuProvider( true } - R.id.action_updated -> { - context.startActivity(UpdatesActivity.newIntent(context)) - true - } - else -> false } } diff --git a/app/src/main/res/layout/layout_details_info.xml b/app/src/main/res/layout/layout_details_info.xml deleted file mode 100644 index 9a6931d7b..000000000 --- a/app/src/main/res/layout/layout_details_info.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - diff --git a/app/src/main/res/menu/opt_feed.xml b/app/src/main/res/menu/opt_feed.xml index 783741741..4f66077fb 100644 --- a/app/src/main/res/menu/opt_feed.xml +++ b/app/src/main/res/menu/opt_feed.xml @@ -3,12 +3,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> - -