Add latest tab language code configuration

This commit is contained in:
Jobobby04 2020-06-14 19:19:50 -04:00
parent 5a38aa5a8b
commit 48786fe5b2
5 changed files with 16 additions and 2 deletions

View File

@ -260,4 +260,6 @@ object PreferenceKeys {
const val latest_tab_sources = "latest_tab_sources"
const val latest_tab_position = "latest_tab_position"
const val latest_tab_language_code = "latest_tab_language_code"
}

View File

@ -360,4 +360,6 @@ class PreferencesHelper(val context: Context) {
fun latestTabSources() = flowPrefs.getStringSet(Keys.latest_tab_sources, mutableSetOf())
fun latestTabInFront() = flowPrefs.getBoolean(Keys.latest_tab_position, false)
fun latestTabDisplayLanguageCode() = flowPrefs.getBoolean(Keys.latest_tab_language_code, false)
}

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.browse.latest
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.LatestAdapter
import eu.kanade.tachiyomi.util.view.gone
@ -12,6 +13,8 @@ import kotlinx.android.synthetic.main.latest_controller_card.recycler
import kotlinx.android.synthetic.main.latest_controller_card.source_card
import kotlinx.android.synthetic.main.latest_controller_card.title
import kotlinx.android.synthetic.main.latest_controller_card.title_wrapper
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
/**
* Holder that binds the [LatestItem] containing catalogue cards.
@ -51,7 +54,7 @@ class LatestHolder(view: View, val adapter: LatestAdapter) :
val results = item.results
val titlePrefix = if (item.highlighted) "" else ""
val langSuffix = if (source.lang.isNotEmpty()) " (${source.lang})" else ""
val langSuffix = if (source.lang.isNotEmpty() && Injekt.get<PreferencesHelper>().latestTabDisplayLanguageCode().get()) " (${source.lang})" else ""
// Set Title with country code if available.
title.text = titlePrefix + source.name + langSuffix

View File

@ -17,7 +17,7 @@ class SettingsBrowseController : SettingsController() {
titleRes = R.string.browse
preferenceCategory {
titleRes = R.string.pref_category_general
titleRes = R.string.latest
switchPreference {
key = Keys.latest_tab_position
@ -25,6 +25,12 @@ class SettingsBrowseController : SettingsController() {
summaryRes = R.string.pref_latest_position_summery
defaultValue = false
}
switchPreference {
key = Keys.latest_tab_language_code
titleRes = R.string.pref_latest_tab_language_code
defaultValue = false
}
}
preferenceCategory {

View File

@ -122,6 +122,7 @@
<string name="pref_latest_position_summery">Do you want the latest tab to be the first tab in browse? This will make it the default tab when opening browse, not recommended if your on data or a metered network</string>
<string name="too_many_watched">Too many watched sources, cannot add more then 5</string>
<string name="latest_tab_empty">You don\'t have any watched sources, go to the sources tab and long press a source to watch it</string>
<string name="pref_latest_tab_language_code">Display language code next to name</string>
<!-- AZ -->
<string name="az_recommends">See Recommendations</string>