This commit is contained in:
Koitharu
2024-04-13 15:16:23 +03:00
parent 2cca696808
commit 535feb424c
6 changed files with 7 additions and 96 deletions

View File

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

View File

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

View File

@@ -277,6 +277,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), AppBarOwner, BottomNav
private fun onFeedCounterChanged(counter: Int) {
navigationDelegate.setCounter(NavItem.FEED, counter)
navigationDelegate.setCounter(NavItem.UPDATED, counter)
}
private fun onIncognitoModeChanged(isIncognito: Boolean) {

View File

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

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/info_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:divider="?attr/colorSecondary"
android:dividerPadding="8dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:showDividers="middle">
<TextView
android:id="@+id/textView_state"
style="@style/Widget.Kotatsu.TextView.Indicator.Vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
tools:drawableTopCompat="@drawable/ic_state_finished"
tools:text="Completed"
tools:visibility="visible" />
<TextView
android:id="@+id/textView_chapters"
style="@style/Widget.Kotatsu.TextView.Indicator.Vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_book_page"
tools:text="52 chapters"
tools:visibility="visible" />
<TextView
android:id="@+id/textView_nsfw"
style="@style/Widget.Kotatsu.TextView.Indicator.Vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/nsfw"
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_alert_outline"
tools:visibility="visible" />
<TextView
android:id="@+id/textView_source"
style="@style/Widget.Kotatsu.TextView.Indicator.Vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/custom_selectable_item_background"
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_web"
tools:text="Source"
tools:visibility="visible" />
<TextView
android:id="@+id/textView_size"
style="@style/Widget.Kotatsu.TextView.Indicator.Vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/custom_selectable_item_background"
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_storage"
tools:text="1.8 GiB"
tools:visibility="visible" />
</LinearLayout>

View File

@@ -3,12 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_updated"
android:orderInCategory="50"
android:title="@string/updated"
app:showAsAction="never" />
<item
android:id="@+id/action_update"
android:orderInCategory="50"