Add a option to put the recommendations into the overflow menu instead of the manga page
This commit is contained in:
parent
570db67894
commit
8e94afb9c1
@ -268,4 +268,6 @@ object PreferenceKeys {
|
|||||||
const val sources_tab_source_categories = "sources_tab_source_categories"
|
const val sources_tab_source_categories = "sources_tab_source_categories"
|
||||||
|
|
||||||
const val sourcesSort = "sources_sort"
|
const val sourcesSort = "sources_sort"
|
||||||
|
|
||||||
|
const val recommendsInOverflow = "recommends_in_overflow"
|
||||||
}
|
}
|
||||||
|
@ -368,4 +368,6 @@ class PreferencesHelper(val context: Context) {
|
|||||||
fun sourcesTabSourcesInCategories() = flowPrefs.getStringSet(Keys.sources_tab_source_categories, mutableSetOf())
|
fun sourcesTabSourcesInCategories() = flowPrefs.getStringSet(Keys.sources_tab_source_categories, mutableSetOf())
|
||||||
|
|
||||||
fun sourceSorting() = flowPrefs.getInt(Keys.sourcesSort, 0)
|
fun sourceSorting() = flowPrefs.getInt(Keys.sourcesSort, 0)
|
||||||
|
|
||||||
|
fun recommendsInOverflow() = flowPrefs.getBoolean(Keys.recommendsInOverflow, false)
|
||||||
}
|
}
|
||||||
|
@ -322,6 +322,7 @@ class MangaController :
|
|||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
if (presenter.manga.favorite) menu.findItem(R.id.action_edit).isVisible = true
|
if (presenter.manga.favorite) menu.findItem(R.id.action_edit).isVisible = true
|
||||||
|
if (preferences.recommendsInOverflow().get()) menu.findItem(R.id.action_recommend).isVisible = true
|
||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,6 +339,10 @@ class MangaController :
|
|||||||
)
|
)
|
||||||
editMangaDialog?.showDialog(router)
|
editMangaDialog?.showDialog(router)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.action_recommend -> {
|
||||||
|
openRecommends()
|
||||||
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
R.id.action_edit_categories -> onCategoriesClick()
|
R.id.action_edit_categories -> onCategoriesClick()
|
||||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.data.glide.MangaThumbnail
|
import eu.kanade.tachiyomi.data.glide.MangaThumbnail
|
||||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||||
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.databinding.MangaInfoHeaderBinding
|
import eu.kanade.tachiyomi.databinding.MangaInfoHeaderBinding
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
@ -46,6 +47,7 @@ import reactivecircus.flowbinding.android.view.clicks
|
|||||||
import reactivecircus.flowbinding.android.view.longClicks
|
import reactivecircus.flowbinding.android.view.longClicks
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class MangaInfoHeaderAdapter(
|
class MangaInfoHeaderAdapter(
|
||||||
private val controller: MangaController,
|
private val controller: MangaController,
|
||||||
@ -57,6 +59,7 @@ class MangaInfoHeaderAdapter(
|
|||||||
private var source: Source = controller.presenter.source
|
private var source: Source = controller.presenter.source
|
||||||
private var trackCount: Int = 0
|
private var trackCount: Int = 0
|
||||||
// SY -->
|
// SY -->
|
||||||
|
private val preferences: PreferencesHelper by injectLazy()
|
||||||
private var meta: RaisedSearchMetadata? = controller.presenter.meta
|
private var meta: RaisedSearchMetadata? = controller.presenter.meta
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
@ -243,7 +246,7 @@ class MangaInfoHeaderAdapter(
|
|||||||
|
|
||||||
// EXH -->
|
// EXH -->
|
||||||
if (controller.smartSearchConfig == null) {
|
if (controller.smartSearchConfig == null) {
|
||||||
binding.recommendBtn.visible()
|
binding.recommendBtn.visibleIf { !preferences.recommendsInOverflow().get() }
|
||||||
binding.recommendBtn.clicks()
|
binding.recommendBtn.clicks()
|
||||||
.onEach { controller.openRecommends() }
|
.onEach { controller.openRecommends() }
|
||||||
.launchIn(scope)
|
.launchIn(scope)
|
||||||
|
@ -267,6 +267,13 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
summaryRes = R.string.auto_solve_captchas_summary
|
summaryRes = R.string.auto_solve_captchas_summary
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.recommendsInOverflow
|
||||||
|
titleRes = R.string.put_recommends_in_overflow
|
||||||
|
summaryRes = R.string.put_recommends_in_overflow_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// <-- EXH
|
// <-- EXH
|
||||||
}
|
}
|
||||||
|
@ -51,4 +51,10 @@
|
|||||||
android:title="@string/action_edit"
|
android:title="@string/action_edit"
|
||||||
android:visible="false"
|
android:visible="false"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_recommend"
|
||||||
|
android:title="@string/az_recommends"
|
||||||
|
android:visible="false"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -136,6 +136,8 @@
|
|||||||
<string name="toggle_expand_search_filters">Expand all search filters by default</string>
|
<string name="toggle_expand_search_filters">Expand all search filters by default</string>
|
||||||
<string name="auto_solve_captchas">Automatically solve captcha</string>
|
<string name="auto_solve_captchas">Automatically solve captcha</string>
|
||||||
<string name="auto_solve_captchas_summary">Use HIGHLY EXPERIMENTAL automatic ReCAPTCHA solver. Will be grayed out if unsupported by your device.</string>
|
<string name="auto_solve_captchas_summary">Use HIGHLY EXPERIMENTAL automatic ReCAPTCHA solver. Will be grayed out if unsupported by your device.</string>
|
||||||
|
<string name="put_recommends_in_overflow">Recommendations in overflow</string>
|
||||||
|
<string name="put_recommends_in_overflow_summary">Put the recommendations button in the overflow menu instead of on the manga page</string>
|
||||||
|
|
||||||
<!-- Library settings -->
|
<!-- Library settings -->
|
||||||
<string name="pref_skip_pre_migration_summary">Use last saved pre-migration preferences and sources to mass migrate</string>
|
<string name="pref_skip_pre_migration_summary">Use last saved pre-migration preferences and sources to mass migrate</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user