Option to open reader in a separated task
This commit is contained in:
@@ -165,7 +165,11 @@ class AppRouter private constructor(
|
||||
}
|
||||
|
||||
fun openReader(intent: ReaderIntent, anchor: View? = null) {
|
||||
startActivity(intent.intent, anchor?.let { view -> scaleUpActivityOptionsOf(view) })
|
||||
val activityIntent = intent.intent
|
||||
if (settings.isReaderMultiTaskEnabled && activityIntent.data != null) {
|
||||
activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
|
||||
}
|
||||
startActivity(activityIntent, anchor?.let { view -> scaleUpActivityOptionsOf(view) })
|
||||
}
|
||||
|
||||
fun openAlternatives(manga: Manga) {
|
||||
@@ -779,7 +783,7 @@ class AppRouter private constructor(
|
||||
else -> true
|
||||
}
|
||||
|
||||
private fun shortMangaUrl(mangaId: Long) = Uri.Builder()
|
||||
fun shortMangaUrl(mangaId: Long) = Uri.Builder()
|
||||
.scheme("kotatsu")
|
||||
.path("manga")
|
||||
.appendQueryParameter("id", mangaId.toString())
|
||||
|
||||
@@ -21,10 +21,12 @@ value class ReaderIntent private constructor(
|
||||
|
||||
fun manga(manga: Manga) = apply {
|
||||
intent.putExtra(AppRouter.KEY_MANGA, ParcelableManga(manga))
|
||||
intent.setData(AppRouter.shortMangaUrl(manga.id))
|
||||
}
|
||||
|
||||
fun mangaId(mangaId: Long) = apply {
|
||||
intent.putExtra(AppRouter.KEY_ID, mangaId)
|
||||
intent.setData(AppRouter.shortMangaUrl(mangaId))
|
||||
}
|
||||
|
||||
fun incognito() = apply {
|
||||
|
||||
@@ -225,6 +225,9 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
|
||||
get() = prefs.getBoolean(KEY_INCOGNITO_MODE, false)
|
||||
set(value) = prefs.edit { putBoolean(KEY_INCOGNITO_MODE, value) }
|
||||
|
||||
val isReaderMultiTaskEnabled: Boolean
|
||||
get() = prefs.getBoolean(KEY_READER_MULTITASK, false)
|
||||
|
||||
var isChaptersReverse: Boolean
|
||||
get() = prefs.getBoolean(KEY_REVERSE_CHAPTERS, false)
|
||||
set(value) = prefs.edit { putBoolean(KEY_REVERSE_CHAPTERS, value) }
|
||||
@@ -688,6 +691,7 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
|
||||
const val KEY_DOH = "doh"
|
||||
const val KEY_EXIT_CONFIRM = "exit_confirm"
|
||||
const val KEY_INCOGNITO_MODE = "incognito"
|
||||
const val KEY_READER_MULTITASK = "reader_multitask"
|
||||
const val KEY_SYNC = "sync"
|
||||
const val KEY_SYNC_SETTINGS = "sync_settings"
|
||||
const val KEY_READER_BAR = "reader_bar"
|
||||
|
||||
@@ -847,4 +847,6 @@
|
||||
<string name="collapse_long_description">Collapse long description</string>
|
||||
<string name="creating_backup">Creating backup</string>
|
||||
<string name="share_backup">Share backup</string>
|
||||
<string name="reader_multitask">Open reader in a separate task</string>
|
||||
<string name="reader_multitask_summary">Allows you to keep multiple readers with different manga open at the same time</string>
|
||||
</resources>
|
||||
|
||||
@@ -119,6 +119,12 @@
|
||||
android:summary="@string/keep_screen_on_summary"
|
||||
android:title="@string/keep_screen_on" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="reader_multitask"
|
||||
android:summary="@string/reader_multitask_summary"
|
||||
android:title="@string/reader_multitask" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="reader_bar"
|
||||
|
||||
Reference in New Issue
Block a user