Skip to content

Commit

Permalink
Merge branch 'develop' into feature/filter-chips
Browse files Browse the repository at this point in the history
  • Loading branch information
cemrich committed Feb 4, 2024
2 parents badb823 + 8e3bcd6 commit 4f02caf
Show file tree
Hide file tree
Showing 27 changed files with 635 additions and 169 deletions.
44 changes: 12 additions & 32 deletions .tx/config
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

12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
1. [Über](#über)
2. [FAQ](app/src/main/res/raw/faq.md)
3. [Changelog](app/src/main/res/raw/changelog.md)
4. [Bibliotheken](#bibliotheken)

---------------------

Expand Down Expand Up @@ -40,14 +39,3 @@ Zapp ist Teil von MediathekView und gibt dir einen schnellen Zugang zu vielen de
## Übersetzungen

Zapp wird in Deutsch entwickelt, kann aber über [Transifex](https://www.transifex.com/none-581/zapp-android-app/) in andere Sprachen übersetzt werden. Vorschläge für weitere Sprachen und Helfer beim Übersetzen sind herzlich willkommen!

## Bibliotheken

Zapp uses a lot of awesome open source libraries:
- [JUnit](http://junit.org/junit4/) to test things out
- [Gson](https://github.com/google/gson) to parse the list of channels
- [Commons IO](https://commons.apache.org/proper/commons-io/) for a sane way to handle files on Android
- [DragListView](https://github.com/woxblom/DragListView) to let you reorder the channel list intuitively
- [exo player](https://google.github.io/ExoPlayer/) the better video player
- [Retrofit](https://square.github.io/retrofit/) for easy server api communication
- [Joda time](http://www.joda.org/joda-time/) for sane date and time handling in Java
14 changes: 10 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
compileSdk 34
minSdkVersion 26
targetSdkVersion 34
versionCode 69
versionName "8.4.0"
versionCode 70
versionName "8.5.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations += ['de', 'en']
}
Expand Down Expand Up @@ -50,6 +50,11 @@ android {
}
}

lintOptions {
// disabled for PR workflow with 3rd party translation tools
disable('MissingTranslation')
}

testOptions {
unitTests {
includeAndroidResources = true
Expand Down Expand Up @@ -118,7 +123,7 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation "androidx.paging:paging-runtime-ktx:3.2.1"

def lifecycle_version = "2.6.2"
def lifecycle_version = "2.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"

Expand Down Expand Up @@ -146,7 +151,7 @@ dependencies {
implementation "androidx.work:work-runtime-ktx:$work_version"

// exo player
def media3_version = "1.2.0"
def media3_version = "1.2.1"
implementation "androidx.media3:media3-exoplayer:$media3_version"
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
implementation "androidx.media3:media3-ui:$media3_version"
Expand Down Expand Up @@ -184,4 +189,5 @@ dependencies {
// android tv
implementation 'androidx.leanback:leanback:1.1.0-rc02'
implementation "androidx.leanback:leanback-tab:1.1.0-beta01"
implementation "androidx.leanback:leanback-preference:1.2.0-alpha04"
}
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
android:screenOrientation="landscape"
android:theme="@style/LeanbackAppTheme" />

<activity
android:name=".tv.settings.SettingsActivity"
android:screenOrientation="landscape"
android:theme="@style/LeanbackAppTheme.Transparent" />

<activity
android:name=".tv.faq.FaqActivity"
android:screenOrientation="landscape"
Expand Down
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AboutFragment : Fragment(), AboutItemListener {
val binding = TvFragmentAboutBinding.inflate(inflater, container, false)

binding.grid.adapter = AboutListAdapter(this)
binding.grid.layoutManager = GridLayoutManager(requireContext(), 2)
binding.grid.layoutManager = GridLayoutManager(requireContext(), 3)

return binding.root
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import de.christinecoenen.code.zapp.R
import de.christinecoenen.code.zapp.databinding.TvAboutItemBinding
import de.christinecoenen.code.zapp.tv.changelog.ChangelogActivity
import de.christinecoenen.code.zapp.tv.faq.FaqActivity
import de.christinecoenen.code.zapp.tv.settings.SettingsActivity

class AboutListAdapter(
private val listener: AboutItemListener
) : RecyclerView.Adapter<AboutViewViewHolder>() {

private val aboutItems = listOf(
AboutItem(
R.string.activity_settings_title,
R.drawable.ic_outline_settings_24,
SettingsActivity
),
AboutItem(
R.string.changelog_title,
R.drawable.ic_sharp_format_list_bulleted_24,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import de.christinecoenen.code.zapp.R
import de.christinecoenen.code.zapp.app.settings.repository.SettingsRepository
import de.christinecoenen.code.zapp.databinding.TvFragmentMainBinding
import org.koin.android.ext.android.inject


class MainFragment : Fragment() {

private var _binding: TvFragmentMainBinding? = null
private val binding: TvFragmentMainBinding get() = _binding!!

private val settingsRepository: SettingsRepository by inject()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -23,7 +28,13 @@ class MainFragment : Fragment() {
binding.viewpager.adapter = MainNavPagerAdapter(requireContext(), parentFragmentManager)
binding.tabs.setupWithViewPager(binding.viewpager)

binding.tabs.getTabAt(0)?.view?.requestFocus()
val selectedTabIndex = when (settingsRepository.startFragment) {
R.id.mediathekListFragment -> 1
else -> 0
}
val selectedTab = binding.tabs.getTabAt(selectedTabIndex)
binding.tabs.selectTab(selectedTab)
selectedTab?.view?.requestFocus()

return binding.root
}
Expand Down
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()
}
}
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)
}
}
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())
}

}
Loading

0 comments on commit 4f02caf

Please sign in to comment.