Browse Source

Parameters set their name in the Action Bar

yattoz 4 years ago
parent
commit
f32bfd747c

+ 8 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/AlarmFragment.kt View File

1
 package fr.forum_thalie.tsumugi.preferences
1
 package fr.forum_thalie.tsumugi.preferences
2
 
2
 
3
 import android.app.TimePickerDialog
3
 import android.app.TimePickerDialog
4
+import android.content.Context
4
 import android.os.Bundle
5
 import android.os.Bundle
5
 import android.util.Log
6
 import android.util.Log
7
+import androidx.appcompat.app.AppCompatActivity
6
 import androidx.core.content.edit
8
 import androidx.core.content.edit
7
 import androidx.preference.*
9
 import androidx.preference.*
8
 import fr.forum_thalie.tsumugi.*
10
 import fr.forum_thalie.tsumugi.*
11
 import java.util.*
13
 import java.util.*
12
 
14
 
13
 class AlarmFragment : PreferenceFragmentCompat() {
15
 class AlarmFragment : PreferenceFragmentCompat() {
16
+
17
+    override fun onAttach(context: Context) {
18
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.setupAlarmClock)
19
+        super.onAttach(context)
20
+    }
21
+
14
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
22
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
15
         setPreferencesFromResource(R.xml.alarm_preferences, rootKey)
23
         setPreferencesFromResource(R.xml.alarm_preferences, rootKey)
16
 
24
 

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/CustomizeFragment.kt View File

1
 package fr.forum_thalie.tsumugi.preferences
1
 package fr.forum_thalie.tsumugi.preferences
2
 
2
 
3
+import android.content.Context
3
 import android.os.Bundle
4
 import android.os.Bundle
4
 import androidx.appcompat.app.AlertDialog
5
 import androidx.appcompat.app.AlertDialog
6
+import androidx.appcompat.app.AppCompatActivity
5
 import androidx.preference.*
7
 import androidx.preference.*
6
 import fr.forum_thalie.tsumugi.R
8
 import fr.forum_thalie.tsumugi.R
7
 import fr.forum_thalie.tsumugi.preferenceStore
9
 import fr.forum_thalie.tsumugi.preferenceStore
8
 
10
 
9
 class CustomizeFragment : PreferenceFragmentCompat() {
11
 class CustomizeFragment : PreferenceFragmentCompat() {
12
+    override fun onAttach(context: Context) {
13
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.customizeAppBehavior)
14
+        super.onAttach(context)
15
+    }
16
+
10
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
17
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
11
         setPreferencesFromResource(R.xml.customize_preferences, rootKey)
18
         setPreferencesFromResource(R.xml.customize_preferences, rootKey)
12
 
19
 

+ 5 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/MainPreferenceFragment.kt View File

5
 import android.os.Bundle
5
 import android.os.Bundle
6
 import fr.forum_thalie.tsumugi.R
6
 import fr.forum_thalie.tsumugi.R
7
 import android.annotation.SuppressLint
7
 import android.annotation.SuppressLint
8
+import androidx.appcompat.app.AppCompatActivity
8
 import androidx.preference.*
9
 import androidx.preference.*
9
 
10
 
10
 class MainPreferenceFragment : PreferenceFragmentCompat() {
11
 class MainPreferenceFragment : PreferenceFragmentCompat() {
12
+    override fun onResume() {
13
+        super.onResume()
14
+        (activity as AppCompatActivity).supportActionBar?.title = context?.getString(R.string.settings)
15
+    }
11
 
16
 
12
     @SuppressLint("ApplySharedPref")
17
     @SuppressLint("ApplySharedPref")
13
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/SleepFragment.kt View File

1
 package fr.forum_thalie.tsumugi.preferences
1
 package fr.forum_thalie.tsumugi.preferences
2
 
2
 
3
+import android.content.Context
3
 import android.os.Bundle
4
 import android.os.Bundle
4
 import androidx.preference.*
5
 import androidx.preference.*
5
 import fr.forum_thalie.tsumugi.R
6
 import fr.forum_thalie.tsumugi.R
6
 import android.text.InputType
7
 import android.text.InputType
8
+import androidx.appcompat.app.AppCompatActivity
7
 import fr.forum_thalie.tsumugi.alarm.RadioSleeper
9
 import fr.forum_thalie.tsumugi.alarm.RadioSleeper
8
 
10
 
9
 
11
 
10
 class SleepFragment : PreferenceFragmentCompat() {
12
 class SleepFragment : PreferenceFragmentCompat() {
13
+    override fun onAttach(context: Context) {
14
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.setSleepTimer)
15
+        super.onAttach(context)
16
+    }
17
+
11
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
12
         setPreferencesFromResource(R.xml.sleep_preference, rootKey)
19
         setPreferencesFromResource(R.xml.sleep_preference, rootKey)
13
 
20
 

+ 5 - 4
app/src/main/res/values-fr/strings.xml View File

37
     <string name="lp">Derniers titres</string>
37
     <string name="lp">Derniers titres</string>
38
     <string name="programme">Planning</string>
38
     <string name="programme">Planning</string>
39
     <string name="regular_programme">Programme régulier</string>
39
     <string name="regular_programme">Programme régulier</string>
40
-    <string name="useAlarmClock">Activer l\'alarme</string>
40
+    <string name="useAlarmClock">Activer le réveil</string>
41
     <string name="setTime">Choisir l\'heure</string>
41
     <string name="setTime">Choisir l\'heure</string>
42
     <string name="selectDaysOfWeek">Choisir les jours</string>
42
     <string name="selectDaysOfWeek">Choisir les jours</string>
43
     <string name="SetSnoozeDuration">Choisir le délai de répétition d\'alarme (minutes)</string>
43
     <string name="SetSnoozeDuration">Choisir le délai de répétition d\'alarme (minutes)</string>
44
     <string name="volumeAtStartup">Volume au démarrage</string>
44
     <string name="volumeAtStartup">Volume au démarrage</string>
45
     <string name="useHorizontalSplitLayout">Utiliser une disposition horizontale adaptée</string>
45
     <string name="useHorizontalSplitLayout">Utiliser une disposition horizontale adaptée</string>
46
     <string name="makeSnackbarsPersistent">Rendre les barres d\information persistantes</string>
46
     <string name="makeSnackbarsPersistent">Rendre les barres d\information persistantes</string>
47
-    <string name="setupAlarmClock">Configurer l\'alarme</string>
48
-    <string name="setSleepTimer">Configurer la minuterie avant extinction</string>
49
-    <string name="costumizeAppBehavior">Paramètres de l\'application</string>
47
+    <string name="setupAlarmClock">Réveil</string>
48
+    <string name="setSleepTimer">Minuterie avant extinction</string>
49
+    <string name="customizeAppBehavior">Comportement de l\'application</string>
50
     <string name="submitABug">Reporter un bug</string>
50
     <string name="submitABug">Reporter un bug</string>
51
     <string name="sleepClosesApp">Minuterie avant fermeture de l\'application</string>
51
     <string name="sleepClosesApp">Minuterie avant fermeture de l\'application</string>
52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
55
     <string name="refreshing">Actualisation…</string>
55
     <string name="refreshing">Actualisation…</string>
56
     <string name="action_refresh">Raffraîchir les données</string>
56
     <string name="action_refresh">Raffraîchir les données</string>
57
     <string name="autoPlay">\"Play\" au branchement de la prise casque</string>
57
     <string name="autoPlay">\"Play\" au branchement de la prise casque</string>
58
+    <string name="settings">Paramètres</string>
58
 
59
 
59
 </resources>
60
 </resources>

+ 4 - 3
app/src/main/res/values/strings.xml View File

64
     <string name="volumeAtStartup">Volume at startup</string>
64
     <string name="volumeAtStartup">Volume at startup</string>
65
     <string name="useHorizontalSplitLayout">Use horizontal split layout</string>
65
     <string name="useHorizontalSplitLayout">Use horizontal split layout</string>
66
     <string name="makeSnackbarsPersistent">Make Snackbars persistent</string>
66
     <string name="makeSnackbarsPersistent">Make Snackbars persistent</string>
67
-    <string name="setupAlarmClock">Set up alarm clock</string>
68
-    <string name="setSleepTimer">Set sleep timer</string>
69
-    <string name="costumizeAppBehavior">Customize app behavior</string>
67
+    <string name="setupAlarmClock">Alarm</string>
68
+    <string name="setSleepTimer">Sleep timer</string>
69
+    <string name="customizeAppBehavior">Customize app behavior</string>
70
     <string name="submitABug">Submit a bug (opens GitHub in a web browser)</string>
70
     <string name="submitABug">Submit a bug (opens GitHub in a web browser)</string>
71
     <string name="sleepClosesApp">Sleep - close app after some time</string>
71
     <string name="sleepClosesApp">Sleep - close app after some time</string>
72
     <string name="setSleepDuration">Set duration (minutes)</string>
72
     <string name="setSleepDuration">Set duration (minutes)</string>
75
     <string name="refreshing">Refreshing data…</string>
75
     <string name="refreshing">Refreshing data…</string>
76
     <string name="action_refresh">Refresh data</string>
76
     <string name="action_refresh">Refresh data</string>
77
     <string name="autoPlay">Auto play when plugging headphones</string>
77
     <string name="autoPlay">Auto play when plugging headphones</string>
78
+    <string name="settings">Settings</string>
78
 
79
 
79
 </resources>
80
 </resources>

+ 1 - 1
app/src/main/res/xml/preferences.xml View File

20
     <Preference
20
     <Preference
21
         app:icon="@drawable/ic_customize"
21
         app:icon="@drawable/ic_customize"
22
         app:key="CustomizeFragment"
22
         app:key="CustomizeFragment"
23
-        app:title="@string/costumizeAppBehavior"
23
+        app:title="@string/customizeAppBehavior"
24
         app:fragment="fr.forum_thalie.tsumugi.preferences.CustomizeFragment"
24
         app:fragment="fr.forum_thalie.tsumugi.preferences.CustomizeFragment"
25
         />
25
         />
26
 
26