Kaynağa Gözat

Parameters set their name in the Action Bar

yattoz 4 yıl önce
ebeveyn
işleme
f32bfd747c

+ 8 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/AlarmFragment.kt Dosyayı Görüntüle

@@ -1,8 +1,10 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3 3
 import android.app.TimePickerDialog
4
+import android.content.Context
4 5
 import android.os.Bundle
5 6
 import android.util.Log
7
+import androidx.appcompat.app.AppCompatActivity
6 8
 import androidx.core.content.edit
7 9
 import androidx.preference.*
8 10
 import fr.forum_thalie.tsumugi.*
@@ -11,6 +13,12 @@ import fr.forum_thalie.tsumugi.alarm.RadioAlarm
11 13
 import java.util.*
12 14
 
13 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 22
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
15 23
         setPreferencesFromResource(R.xml.alarm_preferences, rootKey)
16 24
 

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/CustomizeFragment.kt Dosyayı Görüntüle

@@ -1,12 +1,19 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3
+import android.content.Context
3 4
 import android.os.Bundle
4 5
 import androidx.appcompat.app.AlertDialog
6
+import androidx.appcompat.app.AppCompatActivity
5 7
 import androidx.preference.*
6 8
 import fr.forum_thalie.tsumugi.R
7 9
 import fr.forum_thalie.tsumugi.preferenceStore
8 10
 
9 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 17
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
11 18
         setPreferencesFromResource(R.xml.customize_preferences, rootKey)
12 19
 

+ 5 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/MainPreferenceFragment.kt Dosyayı Görüntüle

@@ -5,9 +5,14 @@ import android.net.Uri
5 5
 import android.os.Bundle
6 6
 import fr.forum_thalie.tsumugi.R
7 7
 import android.annotation.SuppressLint
8
+import androidx.appcompat.app.AppCompatActivity
8 9
 import androidx.preference.*
9 10
 
10 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 17
     @SuppressLint("ApplySharedPref")
13 18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/SleepFragment.kt Dosyayı Görüntüle

@@ -1,13 +1,20 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3
+import android.content.Context
3 4
 import android.os.Bundle
4 5
 import androidx.preference.*
5 6
 import fr.forum_thalie.tsumugi.R
6 7
 import android.text.InputType
8
+import androidx.appcompat.app.AppCompatActivity
7 9
 import fr.forum_thalie.tsumugi.alarm.RadioSleeper
8 10
 
9 11
 
10 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 18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
12 19
         setPreferencesFromResource(R.xml.sleep_preference, rootKey)
13 20
 

+ 5 - 4
app/src/main/res/values-fr/strings.xml Dosyayı Görüntüle

@@ -37,16 +37,16 @@
37 37
     <string name="lp">Derniers titres</string>
38 38
     <string name="programme">Planning</string>
39 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 41
     <string name="setTime">Choisir l\'heure</string>
42 42
     <string name="selectDaysOfWeek">Choisir les jours</string>
43 43
     <string name="SetSnoozeDuration">Choisir le délai de répétition d\'alarme (minutes)</string>
44 44
     <string name="volumeAtStartup">Volume au démarrage</string>
45 45
     <string name="useHorizontalSplitLayout">Utiliser une disposition horizontale adaptée</string>
46 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 50
     <string name="submitABug">Reporter un bug</string>
51 51
     <string name="sleepClosesApp">Minuterie avant fermeture de l\'application</string>
52 52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
@@ -55,5 +55,6 @@
55 55
     <string name="refreshing">Actualisation…</string>
56 56
     <string name="action_refresh">Raffraîchir les données</string>
57 57
     <string name="autoPlay">\"Play\" au branchement de la prise casque</string>
58
+    <string name="settings">Paramètres</string>
58 59
 
59 60
 </resources>

+ 4 - 3
app/src/main/res/values/strings.xml Dosyayı Görüntüle

@@ -64,9 +64,9 @@
64 64
     <string name="volumeAtStartup">Volume at startup</string>
65 65
     <string name="useHorizontalSplitLayout">Use horizontal split layout</string>
66 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 70
     <string name="submitABug">Submit a bug (opens GitHub in a web browser)</string>
71 71
     <string name="sleepClosesApp">Sleep - close app after some time</string>
72 72
     <string name="setSleepDuration">Set duration (minutes)</string>
@@ -75,5 +75,6 @@
75 75
     <string name="refreshing">Refreshing data…</string>
76 76
     <string name="action_refresh">Refresh data</string>
77 77
     <string name="autoPlay">Auto play when plugging headphones</string>
78
+    <string name="settings">Settings</string>
78 79
 
79 80
 </resources>

+ 1 - 1
app/src/main/res/xml/preferences.xml Dosyayı Görüntüle

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