-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/filter-chips
- Loading branch information
Showing
27 changed files
with
635 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,12 @@ | ||
[main] | ||
host = https://www.transifex.com | ||
lang_map = af_ZA: af-rZA, am_ET: am-rET, ar_AE: ar-rAE, ar_BH: ar-rBH, ar_DZ: ar-rDZ, ar_EG: ar-rEG, ar_IQ: ar-rIQ, ar_JO: ar-rJO, ar_KW: ar-rKW, ar_LB: ar-rLB, ar_LY: ar-rLY, ar_MA: ar-rMA, ar_OM: ar-rOM, ar_QA: ar-rQA, ar_SA: ar-rSA, ar_SY: ar-rSY, ar_TN: ar-rTN, ar_YE: ar-rYE, arn_CL: arn-rCL, as_IN: as-rIN, az_AZ: az-rAZ, ba_RU: ba-rRU, be_BY: be-rBY, bg_BG: bg-rBG, bn_BD: bn-rBD, bn_IN: bn-rIN, bo_CN: bo-rCN, br_FR: br-rFR, bs_BA: bs-rBA, ca_ES: ca-rES, ca@valencia: ca-rXV, co_FR: co-rFR, cs_CZ: cs-rCZ, cy_GB: cy-rGB, da_DK: da-rDK, de_AT: de-rAT, de_CH: de-rCH, de_DE: de-rDE, de_LI: de-rLI, de_LU: de-rLU, dsb_DE: dsb-rDE, dv_MV: dv-rMV, el_GR: el-rGR, en_AU: en-rAU, en_BZ: en-rBZ, en_CA: en-rCA, en_DE: en-rDE, en_GB: en-rGB, en_IE: en-rIE, en_IN: en-rIN, en_JM: en-rJM, en_MY: en-rMY, en_NZ: en-rNZ, en@pirate: en-rXP, en_PH: en-rPH, en_SG: en-rSG, en_TT: en-rTT, en_US: en-rUS, en_ZA: en-rZA, en_ZW: en-rZW, es_AR: es-rAR, es_BO: es-rBO, es_CL: es-rCL, es_CO: es-rCO, es_CR: es-rCR, es_DO: es-rDO, es_EC: es-rEC, es_ES: es-rES, es_GT: es-rGT, es_HN: es-rHN, es_MX: es-rMX, es_NI: es-rNI, es_PA: es-rPA, es_PE: es-rPE, es_PR: es-rPR, es_PY: es-rPY, es_SV: es-rSV, es_419: es-rUS, es_UY: es-rUY, es_VE: es-rVE, et_EE: et-rEE, eu_ES: eu-rES, fa_IR: fa-rIR, fi_FI: fi-rFI, fil_PH: fil-rPH, fo_FO: fo-rFO, fr_BE: fr-rBE, fr_CA: fr-rCA, fr_CH: fr-rCH, fr_FR: fr-rFR, fr_LU: fr-rLU, fr_MC: fr-rMC, fy_NL: fy-rNL, ga_IE: ga-rIE, gd_GB: gd-rGB, gl_ES: gl-rES, gsw_FR: gsw-rFR, gu_IN: gu-rIN, ha_NG: ha-rNG, he_IL: he-rIL, hi_IN: hi-rIN, hr_BA: hr-rBA, hr_HR: hr-rHR, hsb_DE: hsb-rDE, hu_HU: hu-rHU, hy_AM: hy-rAM, id_ID: id-rID, ig_NG: ig-rNG, ii_CN: ii-rCN, is_IS: is-rIS, it_CH: it-rCH, it_IT: it-rIT, iu_CA: iu-rCA, ja_JP: ja-rJP, ka_GE: ka-rGE, kk_KZ: kk-rKZ, kl_GL: kl-rGL, km_KH: km-rKH, kn_IN: kn-rIN, ko_KR: ko-rKR, kok_IN: kok-rIN, ku_IQ: ku-rIQ, ky_KG: ky-rKG, lb_LU: lb-rLU, lo_LA: lo-rLA, lt_LT: lt-rLT, lv_LV: lv-rLV, mi_NZ: mi-rNZ, mk_MK: mk-rMK, ml_IN: ml-rIN, mn_CN: mn-rCN, mn_MN: mn-rMN, moh_CA: moh-rCA, mr_IN: mr-rIN, ms_BN: ms-rBN, ms_MY: ms-rMY, my_MM: my, mt_MT: mt-rMT, nb_NO: nb-rNO, ne_NP: ne-rNP, nl_BE: nl-rBE, nl_NL: nl-rNL, nn_NO: nn-rNO, nso_ZA: nso-rZA, oc_FR: oc-rFR, or_IN: or-rIN, pa_IN: pa-rIN, pl_PL: pl-rPL, prs_AF: prs-rAF, ps_AF: ps-rAF, pt_BR: pt-rBR, pt_PT: pt-rPT, qut_GT: qut-rGT, quz_BO: quz-rBO, quz_EC: quz-rEC, quz_PE: quz-rPE, rm_CH: rm-rCH, ro_RO: ro-rRO, ru_RU: ru-rRU, rw_RW: rw-rRW, sa_IN: sa-rIN, sah_RU: sah-rRU, se_FI: se-rFI, se_NO: se-rNO, se_SE: se-rSE, si_LK: si-rLK, sk_SK: sk-rSK, sl_SI: sl-rSI, sma_NO: sma-rNO, sma_SE: sma-rSE, smj_NO: smj-rNO, smj_SE: smj-rSE, smn_FI: smn-rFI, sms_FI: sms-rFI, sq_AL: sq-rAL, sr_BA: sr-rBA, sr_CS: sr-rCS, sr_ME: sr-rME, sr_RS: sr-rRS, sr@latin: sr-rSP, sv_FI: sv-rFI, sv_SE: sv-rSE, sw_KE: sw-rKE, syr_SY: syr-rSY, ta_IN: ta-rIN, ta_LK: ta-rLK, te_IN: te-rIN, tg_TJ: tg-rTJ, th_TH: th-rTH, tk_TM: tk-rTM, tl_PH: tl-rPH, tn_ZA: tn-rZA, tr_TR: tr-rTR, tt_RU: tt-rRU, tzm_DZ: tzm-rDZ, ug_CN: ug-rCN, uk_UA: uk-rUA, ur_PK: ur-rPK, uz_UZ: uz-rUZ, vi_VN: vi-rVN, wo_SN: wo-rSN, xh_ZA: xh-rZA, yo_NG: yo-rNG, zh_CN: zh-rCN, zh_CN.GB2312:zh-rBG, zh_HK: zh-rHK, zh_MO: zh-rMO, zh_SG: zh-rSG, zh_TW: zh-rTW, zu_ZA: zu-rZA | ||
|
||
[zapp-android-app.stringsxml] | ||
file_filter = app/src/main/res/values-<lang>/strings.xml | ||
source_file = app/src/main/res/values/strings.xml | ||
trans.de_DE = app/src/main/res/values/strings.xml | ||
source_lang = de | ||
type = ANDROID | ||
|
||
[zapp-android-app.faqmd] | ||
file_filter = app/src/main/res/raw-<lang>/faq.md | ||
source_file = app/src/main/res/raw/faq.md | ||
trans.de_DE = app/src/main/res/raw/faq.md | ||
source_lang = de | ||
type = GITHUBMARKDOWN | ||
|
||
[zapp-android-app.shortdescription] | ||
file_filter = app/src/main/play/listings/<lang>/short-description.txt | ||
source_file = app/src/main/play/listings/de/short-description.txt | ||
trans.de_DE = app/src/main/play/listings/de/short-description.txt | ||
source_lang = de | ||
type = TXT | ||
|
||
[zapp-android-app.fulldescription] | ||
file_filter = app/src/main/play/listings/<lang>/full-description.txt | ||
source_file = app/src/main/play/listings/de/full-description.txt | ||
trans.de_DE = app/src/main/play/listings/de/full-description.txt | ||
source_lang = de | ||
type = HTML | ||
|
||
[main] | ||
host = https://app.transifex.com | ||
|
||
[o:none-581:p:zapp-android-app:r:9081446f9c384a682ff5a7ebf30e3e70] | ||
file_filter = app/src/main/res/raw-<lang>/changelog.md | ||
source_file = app/src/main/res/raw/changelog.md | ||
type = GITHUBMARKDOWN | ||
minimum_perc = 0 | ||
resource_name = app..raw/changelog.md (develop) | ||
replace_edited_strings = false | ||
keep_translations = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 13 additions & 84 deletions
97
app/src/main/java/de/christinecoenen/code/zapp/app/settings/ui/SettingsFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,34 @@ | ||
package de.christinecoenen.code.zapp.app.settings.ui | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatDelegate | ||
import androidx.core.os.LocaleListCompat | ||
import androidx.navigation.fragment.findNavController | ||
import androidx.preference.ListPreference | ||
import androidx.preference.Preference | ||
import androidx.preference.SwitchPreferenceCompat | ||
import com.google.android.material.color.DynamicColors | ||
import com.jakewharton.processphoenix.ProcessPhoenix | ||
import androidx.preference.PreferenceFragmentCompat | ||
import de.christinecoenen.code.zapp.R | ||
import de.christinecoenen.code.zapp.app.settings.helper.ShortcutPreference | ||
import de.christinecoenen.code.zapp.app.settings.repository.SettingsRepository | ||
import de.christinecoenen.code.zapp.utils.system.LanguageHelper | ||
|
||
import de.christinecoenen.code.zapp.utils.system.PreferenceFragmentHelper | ||
import org.koin.android.ext.android.inject | ||
|
||
class SettingsFragment : BaseSettingsFragment() { | ||
|
||
companion object { | ||
|
||
private const val PREF_SHORTCUTS = "pref_shortcuts" | ||
private const val PREF_DYNAMIC_COLORS = "dynamic_colors" | ||
private const val PREF_UI_MODE = "pref_ui_mode" | ||
private const val PREF_LANGUAGE = "pref_key_language" | ||
private const val PREF_CHANNEL_SELECTION = "pref_key_channel_selection" | ||
|
||
} | ||
|
||
private lateinit var settingsRepository: SettingsRepository | ||
private lateinit var shortcutPreference: ShortcutPreference | ||
private lateinit var dynamicColorsPreference: SwitchPreferenceCompat | ||
private lateinit var uiModePreference: ListPreference | ||
private lateinit var languagePreference: ListPreference | ||
private lateinit var channelSelectionPreference: Preference | ||
private val settingsRepository: SettingsRepository by inject() | ||
private val preferenceFragmentHelper = PreferenceFragmentHelper(this, settingsRepository) | ||
|
||
private val uiModeChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> | ||
val uiMode = settingsRepository.prefValueToUiMode(newValue as String?) | ||
AppCompatDelegate.setDefaultNightMode(uiMode) | ||
private val channelSelectionClickListener = Preference.OnPreferenceClickListener { | ||
val direction = | ||
SettingsFragmentDirections.toChannelSelectionFragment() | ||
findNavController().navigate(direction) | ||
true | ||
} | ||
|
||
private val languageChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> | ||
val languageTag = newValue as String | ||
val appLocale = LocaleListCompat.forLanguageTags(languageTag) | ||
AppCompatDelegate.setApplicationLocales(appLocale) | ||
|
||
true | ||
} | ||
|
||
override fun onAttach(context: Context) { | ||
super.onAttach(context) | ||
|
||
settingsRepository = SettingsRepository(context) | ||
} | ||
|
||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
addPreferencesFromResource(R.xml.preferences) | ||
|
||
shortcutPreference = preferenceScreen.findPreference(PREF_SHORTCUTS)!! | ||
dynamicColorsPreference = preferenceScreen.findPreference(PREF_DYNAMIC_COLORS)!! | ||
uiModePreference = preferenceScreen.findPreference(PREF_UI_MODE)!! | ||
languagePreference = preferenceScreen.findPreference(PREF_LANGUAGE)!! | ||
channelSelectionPreference = preferenceScreen.findPreference(PREF_CHANNEL_SELECTION)!! | ||
|
||
val languages = LanguageHelper.getAvailableLanguages(requireContext()) | ||
languagePreference.value = LanguageHelper.getCurrentLanguageTag() | ||
languagePreference.entries = languages.values.toTypedArray() | ||
languagePreference.entryValues = languages.keys.toTypedArray() | ||
|
||
// only show the preference for dynamic colors when available (Android 12 and up) | ||
dynamicColorsPreference.isVisible = DynamicColors.isDynamicColorAvailable() | ||
dynamicColorsPreference.setOnPreferenceChangeListener { _, useDynamicColors -> | ||
// save explicitly to persist before app restart | ||
settingsRepository.dynamicColors = useDynamicColors as Boolean | ||
// app restart | ||
ProcessPhoenix.triggerRebirth(context) | ||
true | ||
} | ||
|
||
channelSelectionPreference.setOnPreferenceClickListener { | ||
val direction = | ||
SettingsFragmentDirections.toChannelSelectionFragment() | ||
findNavController().navigate(direction) | ||
true | ||
} | ||
preferenceFragmentHelper.initPreferences(channelSelectionClickListener) | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
|
||
shortcutPreference.onPreferenceChangeListener = shortcutPreference | ||
uiModePreference.onPreferenceChangeListener = uiModeChangeListener | ||
languagePreference.onPreferenceChangeListener = languageChangeListener | ||
} | ||
|
||
override fun onPause() { | ||
super.onPause() | ||
|
||
shortcutPreference.onPreferenceChangeListener = null | ||
uiModePreference.onPreferenceChangeListener = null | ||
languagePreference.onPreferenceChangeListener = null | ||
override fun onDestroy() { | ||
super.onDestroy() | ||
preferenceFragmentHelper.destroy() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/de/christinecoenen/code/zapp/tv/settings/PreferenceFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.christinecoenen.code.zapp.tv.settings | ||
|
||
import android.os.Bundle | ||
import androidx.leanback.preference.LeanbackPreferenceFragmentCompat | ||
import de.christinecoenen.code.zapp.R | ||
import de.christinecoenen.code.zapp.app.settings.repository.SettingsRepository | ||
import de.christinecoenen.code.zapp.utils.system.PreferenceFragmentHelper | ||
import org.koin.android.ext.android.inject | ||
|
||
class PreferenceFragment : LeanbackPreferenceFragmentCompat() { | ||
|
||
private val settingsRepository: SettingsRepository by inject() | ||
private val preferenceFragmentHelper = PreferenceFragmentHelper(this, settingsRepository) | ||
|
||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
setPreferencesFromResource(R.xml.tv_preferences, rootKey) | ||
|
||
preferenceFragmentHelper.initPreferences() | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
preferenceFragmentHelper.destroy() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/de/christinecoenen/code/zapp/tv/settings/SettingsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package de.christinecoenen.code.zapp.tv.settings | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.fragment.app.FragmentActivity | ||
import de.christinecoenen.code.zapp.databinding.TvActivitySettingsBinding | ||
import de.christinecoenen.code.zapp.utils.system.IStartableActivity | ||
|
||
class SettingsActivity : FragmentActivity() { | ||
|
||
companion object : IStartableActivity { | ||
override fun getStartIntent(context: Context?): Intent = | ||
Intent(context, SettingsActivity::class.java) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val binding = TvActivitySettingsBinding.inflate(layoutInflater) | ||
|
||
setContentView(binding.root) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/de/christinecoenen/code/zapp/tv/settings/SettingsFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.christinecoenen.code.zapp.tv.settings | ||
|
||
import androidx.leanback.preference.LeanbackSettingsFragmentCompat | ||
import androidx.preference.Preference | ||
import androidx.preference.PreferenceFragmentCompat | ||
import androidx.preference.PreferenceScreen | ||
|
||
|
||
class SettingsFragment : LeanbackSettingsFragmentCompat() { | ||
|
||
override fun onPreferenceStartFragment( | ||
caller: PreferenceFragmentCompat, | ||
pref: Preference | ||
): Boolean { | ||
return false | ||
} | ||
|
||
override fun onPreferenceStartScreen( | ||
caller: PreferenceFragmentCompat, | ||
pref: PreferenceScreen | ||
): Boolean { | ||
return false | ||
} | ||
|
||
override fun onPreferenceStartInitialScreen() { | ||
startPreferenceFragment(PreferenceFragment()) | ||
} | ||
|
||
} |
Oops, something went wrong.