diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/ReaderControl.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/ReaderControl.kt
index da2373011..3465f6cec 100644
--- a/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/ReaderControl.kt
+++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/ReaderControl.kt
@@ -4,7 +4,7 @@ import java.util.EnumSet
enum class ReaderControl {
- PREV_CHAPTER, NEXT_CHAPTER, SLIDER, PAGES_SHEET, SCREEN_ROTATION;
+ PREV_CHAPTER, NEXT_CHAPTER, SLIDER, PAGES_SHEET, SCREEN_ROTATION, SAVE_PAGE;
companion object {
diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt
index a3b02a0b9..a2c11be7e 100644
--- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt
+++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt
@@ -166,7 +166,7 @@ class ReaderActivity :
}
addMenuProvider(ReaderMenuTopProvider(viewModel))
viewBinding.toolbarBottom.addMenuProvider(
- ReaderMenuBottomProvider(this, readerManager, screenOrientationHelper, viewModel),
+ ReaderMenuBottomProvider(this, readerManager, screenOrientationHelper, this, viewModel),
)
}
diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderMenuBottomProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderMenuBottomProvider.kt
index 61be3f23a..ace7fa17d 100644
--- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderMenuBottomProvider.kt
+++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderMenuBottomProvider.kt
@@ -9,11 +9,13 @@ import androidx.fragment.app.FragmentActivity
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.core.nav.router
import org.koitharu.kotatsu.core.prefs.ReaderControl
+import org.koitharu.kotatsu.reader.ui.config.ReaderConfigSheet
class ReaderMenuBottomProvider(
private val activity: FragmentActivity,
private val readerManager: ReaderManager,
private val screenOrientationHelper: ScreenOrientationHelper,
+ private val configCallback: ReaderConfigSheet.Callback,
private val viewModel: ReaderViewModel,
) : MenuProvider {
@@ -24,8 +26,8 @@ class ReaderMenuBottomProvider(
override fun onPrepareMenu(menu: Menu) {
val readerControls = viewModel.readerControls.value
- val isPagesSheetEnabled = viewModel.content.value.pages.isNotEmpty() &&
- ReaderControl.PAGES_SHEET in readerControls
+ val hasPages = viewModel.content.value.pages.isNotEmpty()
+ val isPagesSheetEnabled = hasPages && ReaderControl.PAGES_SHEET in readerControls
menu.findItem(R.id.action_pages_thumbs).run {
isVisible = isPagesSheetEnabled
if (isPagesSheetEnabled) {
@@ -47,6 +49,9 @@ class ReaderMenuBottomProvider(
}
}
}
+ menu.findItem(R.id.action_save_page)?.run {
+ isVisible = hasPages && ReaderControl.SAVE_PAGE in readerControls
+ }
}
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
@@ -56,6 +61,11 @@ class ReaderMenuBottomProvider(
true
}
+ R.id.action_save_page -> {
+ configCallback.onSavePageClick()
+ true
+ }
+
R.id.action_pages_thumbs -> {
activity.router.showChapterPagesSheet()
true
diff --git a/app/src/main/res/menu/opt_reader_bottom.xml b/app/src/main/res/menu/opt_reader_bottom.xml
index 327458cf2..76f1ae34f 100644
--- a/app/src/main/res/menu/opt_reader_bottom.xml
+++ b/app/src/main/res/menu/opt_reader_bottom.xml
@@ -5,6 +5,14 @@
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AlwaysShowAction">
+
+
- @string/pages_slider
- @string/chapters_and_pages
- @string/screen_orientation
+ - @string/save_page
diff --git a/app/src/main/res/xml/pref_reader.xml b/app/src/main/res/xml/pref_reader.xml
index 9228b787b..b341c9217 100644
--- a/app/src/main/res/xml/pref_reader.xml
+++ b/app/src/main/res/xml/pref_reader.xml
@@ -23,6 +23,12 @@
app:allowDividerAbove="true"
app:useSimpleSummaryProvider="true" />
+
+
-
-
+
+
+ android:title="@string/reader_actions" />
-
-