Option to disable reading progress indicators
This commit is contained in:
@@ -104,10 +104,13 @@ class AppSettings(context: Context) {
|
|||||||
val isReaderModeDetectionEnabled: Boolean
|
val isReaderModeDetectionEnabled: Boolean
|
||||||
get() = prefs.getBoolean(KEY_READER_MODE_DETECT, true)
|
get() = prefs.getBoolean(KEY_READER_MODE_DETECT, true)
|
||||||
|
|
||||||
var historyGrouping: Boolean
|
var isHistoryGroupingEnabled: Boolean
|
||||||
get() = prefs.getBoolean(KEY_HISTORY_GROUPING, true)
|
get() = prefs.getBoolean(KEY_HISTORY_GROUPING, true)
|
||||||
set(value) = prefs.edit { putBoolean(KEY_HISTORY_GROUPING, value) }
|
set(value) = prefs.edit { putBoolean(KEY_HISTORY_GROUPING, value) }
|
||||||
|
|
||||||
|
val isReadingIndicatorsEnabled: Boolean
|
||||||
|
get() = prefs.getBoolean(KEY_READING_INDICATORS, true)
|
||||||
|
|
||||||
val isHistoryExcludeNsfw: Boolean
|
val isHistoryExcludeNsfw: Boolean
|
||||||
get() = prefs.getBoolean(KEY_HISTORY_EXCLUDE_NSFW, false)
|
get() = prefs.getBoolean(KEY_HISTORY_EXCLUDE_NSFW, false)
|
||||||
|
|
||||||
@@ -303,6 +306,7 @@ class AppSettings(context: Context) {
|
|||||||
const val KEY_BACKUP = "backup"
|
const val KEY_BACKUP = "backup"
|
||||||
const val KEY_RESTORE = "restore"
|
const val KEY_RESTORE = "restore"
|
||||||
const val KEY_HISTORY_GROUPING = "history_grouping"
|
const val KEY_HISTORY_GROUPING = "history_grouping"
|
||||||
|
const val KEY_READING_INDICATORS = "reading_indicators"
|
||||||
const val KEY_REVERSE_CHAPTERS = "reverse_chapters"
|
const val KEY_REVERSE_CHAPTERS = "reverse_chapters"
|
||||||
const val KEY_HISTORY_EXCLUDE_NSFW = "history_exclude_nsfw"
|
const val KEY_HISTORY_EXCLUDE_NSFW = "history_exclude_nsfw"
|
||||||
const val KEY_PAGES_NUMBERS = "pages_numbers"
|
const val KEY_PAGES_NUMBERS = "pages_numbers"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.koitharu.kotatsu.core.prefs.AppSettings
|
|||||||
import org.koitharu.kotatsu.favourites.domain.FavouritesRepository
|
import org.koitharu.kotatsu.favourites.domain.FavouritesRepository
|
||||||
import org.koitharu.kotatsu.favourites.ui.list.FavouritesListFragment.Companion.NO_ID
|
import org.koitharu.kotatsu.favourites.ui.list.FavouritesListFragment.Companion.NO_ID
|
||||||
import org.koitharu.kotatsu.history.domain.HistoryRepository
|
import org.koitharu.kotatsu.history.domain.HistoryRepository
|
||||||
|
import org.koitharu.kotatsu.history.domain.PROGRESS_NONE
|
||||||
import org.koitharu.kotatsu.list.domain.ListExtraProvider
|
import org.koitharu.kotatsu.list.domain.ListExtraProvider
|
||||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||||
@@ -27,7 +28,7 @@ class FavouritesListViewModel(
|
|||||||
private val repository: FavouritesRepository,
|
private val repository: FavouritesRepository,
|
||||||
private val trackingRepository: TrackingRepository,
|
private val trackingRepository: TrackingRepository,
|
||||||
private val historyRepository: HistoryRepository,
|
private val historyRepository: HistoryRepository,
|
||||||
settings: AppSettings,
|
private val settings: AppSettings,
|
||||||
) : MangaListViewModel(settings), ListExtraProvider {
|
) : MangaListViewModel(settings), ListExtraProvider {
|
||||||
|
|
||||||
var sortOrder: LiveData<SortOrder?> = if (categoryId == NO_ID) {
|
var sortOrder: LiveData<SortOrder?> = if (categoryId == NO_ID) {
|
||||||
@@ -96,6 +97,10 @@ class FavouritesListViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getProgress(mangaId: Long): Float {
|
override suspend fun getProgress(mangaId: Long): Float {
|
||||||
return historyRepository.getProgress(mangaId)
|
return if (settings.isReadingIndicatorsEnabled) {
|
||||||
|
historyRepository.getProgress(mangaId)
|
||||||
|
} else {
|
||||||
|
PROGRESS_NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ import org.koitharu.kotatsu.core.prefs.observeAsFlow
|
|||||||
import org.koitharu.kotatsu.core.ui.DateTimeAgo
|
import org.koitharu.kotatsu.core.ui.DateTimeAgo
|
||||||
import org.koitharu.kotatsu.history.domain.HistoryRepository
|
import org.koitharu.kotatsu.history.domain.HistoryRepository
|
||||||
import org.koitharu.kotatsu.history.domain.MangaWithHistory
|
import org.koitharu.kotatsu.history.domain.MangaWithHistory
|
||||||
|
import org.koitharu.kotatsu.history.domain.PROGRESS_NONE
|
||||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||||
import org.koitharu.kotatsu.list.ui.model.*
|
import org.koitharu.kotatsu.list.ui.model.*
|
||||||
import org.koitharu.kotatsu.tracker.domain.TrackingRepository
|
import org.koitharu.kotatsu.tracker.domain.TrackingRepository
|
||||||
@@ -37,7 +38,7 @@ class HistoryListViewModel(
|
|||||||
val isGroupingEnabled = MutableLiveData<Boolean>()
|
val isGroupingEnabled = MutableLiveData<Boolean>()
|
||||||
val onItemsRemoved = SingleLiveEvent<ReversibleHandle>()
|
val onItemsRemoved = SingleLiveEvent<ReversibleHandle>()
|
||||||
|
|
||||||
private val historyGrouping = settings.observeAsFlow(AppSettings.KEY_HISTORY_GROUPING) { historyGrouping }
|
private val historyGrouping = settings.observeAsFlow(AppSettings.KEY_HISTORY_GROUPING) { isHistoryGroupingEnabled }
|
||||||
.onEach { isGroupingEnabled.postValue(it) }
|
.onEach { isGroupingEnabled.postValue(it) }
|
||||||
|
|
||||||
override val content = combine(
|
override val content = combine(
|
||||||
@@ -89,7 +90,7 @@ class HistoryListViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setGrouping(isGroupingEnabled: Boolean) {
|
fun setGrouping(isGroupingEnabled: Boolean) {
|
||||||
settings.historyGrouping = isGroupingEnabled
|
settings.isHistoryGroupingEnabled = isGroupingEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun mapList(
|
private suspend fun mapList(
|
||||||
@@ -98,6 +99,7 @@ class HistoryListViewModel(
|
|||||||
mode: ListMode
|
mode: ListMode
|
||||||
): List<ListModel> {
|
): List<ListModel> {
|
||||||
val result = ArrayList<ListModel>(if (grouped) (list.size * 1.4).toInt() else list.size + 1)
|
val result = ArrayList<ListModel>(if (grouped) (list.size * 1.4).toInt() else list.size + 1)
|
||||||
|
val showPercent = settings.isReadingIndicatorsEnabled
|
||||||
var prevDate: DateTimeAgo? = null
|
var prevDate: DateTimeAgo? = null
|
||||||
if (!grouped) {
|
if (!grouped) {
|
||||||
result += ListHeader(null, R.string.history, null)
|
result += ListHeader(null, R.string.history, null)
|
||||||
@@ -111,10 +113,11 @@ class HistoryListViewModel(
|
|||||||
prevDate = date
|
prevDate = date
|
||||||
}
|
}
|
||||||
val counter = trackingRepository.getNewChaptersCount(manga.id)
|
val counter = trackingRepository.getNewChaptersCount(manga.id)
|
||||||
|
val percent = if (showPercent) history.percent else PROGRESS_NONE
|
||||||
result += when (mode) {
|
result += when (mode) {
|
||||||
ListMode.LIST -> manga.toListModel(counter, history.percent)
|
ListMode.LIST -> manga.toListModel(counter, percent)
|
||||||
ListMode.DETAILED_LIST -> manga.toListDetailedModel(counter, history.percent)
|
ListMode.DETAILED_LIST -> manga.toListDetailedModel(counter, percent)
|
||||||
ListMode.GRID -> manga.toGridModel(counter, history.percent)
|
ListMode.GRID -> manga.toGridModel(counter, percent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -304,4 +304,9 @@
|
|||||||
<string name="use_fingerprint">Use fingerprint if available</string>
|
<string name="use_fingerprint">Use fingerprint if available</string>
|
||||||
<string name="appwidget_shelf_description">Manga from your favourites</string>
|
<string name="appwidget_shelf_description">Manga from your favourites</string>
|
||||||
<string name="appwidget_recent_description">Your recently read manga</string>
|
<string name="appwidget_recent_description">Your recently read manga</string>
|
||||||
|
<string name="show_reading_indicators">Show reading progress indicators</string>
|
||||||
|
<string name="data_deletion">Data deletion</string>
|
||||||
|
<string name="show_reading_indicators_summary">Show percentage read in history and favourites</string>
|
||||||
|
<string name="exclude_nsfw_from_history_summary">Manga marked as NSFW will never added to the history and your progress will not be saved</string>
|
||||||
|
<string name="clear_cookies_summary">Can help in case of some issues. All authorizations will be invalidated</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,30 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<Preference
|
<SwitchPreferenceCompat
|
||||||
android:key="search_history_clear"
|
android:defaultValue="true"
|
||||||
android:persistent="false"
|
android:key="reading_indicators"
|
||||||
android:summary="@string/loading_"
|
android:summary="@string/show_reading_indicators_summary"
|
||||||
android:title="@string/clear_search_history" />
|
android:title="@string/show_reading_indicators" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="updates_feed_clear"
|
|
||||||
android:persistent="false"
|
|
||||||
android:summary="@string/loading_"
|
|
||||||
android:title="@string/clear_updates_feed" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="history_exclude_nsfw"
|
android:key="history_exclude_nsfw"
|
||||||
|
android:summary="@string/exclude_nsfw_from_history_summary"
|
||||||
android:title="@string/exclude_nsfw_from_history" />
|
android:title="@string/exclude_nsfw_from_history" />
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/cache">
|
<PreferenceCategory android:title="@string/data_deletion">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="search_history_clear"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="@string/loading_"
|
||||||
|
android:title="@string/clear_search_history" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="updates_feed_clear"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="@string/loading_"
|
||||||
|
android:title="@string/clear_updates_feed" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="thumbs_cache_clear"
|
android:key="thumbs_cache_clear"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:summary="@string/computing_"
|
android:summary="@string/computing_"
|
||||||
android:title="@string/clear_thumbs_cache" />
|
android:title="@string/clear_thumbs_cache"
|
||||||
|
app:allowDividerAbove="true" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="pages_cache_clear"
|
android:key="pages_cache_clear"
|
||||||
@@ -32,11 +41,13 @@
|
|||||||
android:summary="@string/computing_"
|
android:summary="@string/computing_"
|
||||||
android:title="@string/clear_pages_cache" />
|
android:title="@string/clear_pages_cache" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="cookies_clear"
|
||||||
|
android:persistent="false"
|
||||||
|
android:summary="@string/clear_cookies_summary"
|
||||||
|
android:title="@string/clear_cookies"
|
||||||
|
app:allowDividerAbove="true" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="cookies_clear"
|
|
||||||
android:persistent="false"
|
|
||||||
android:title="@string/clear_cookies" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Reference in New Issue
Block a user