Skip to content

Commit 06f7d65

Browse files
authored
MODE_NIGHT_AUTO (deprecated) -> FOLLOW_SYSTEM (#463)
closes #457
1 parent a7cc3dc commit 06f7d65

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

android/src/main/java/org/ligi/passandroid/model/AndroidSettings.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package org.ligi.passandroid.model
22

33
import android.content.Context
44
import androidx.preference.PreferenceManager
5-
import androidx.appcompat.app.AppCompatDelegate
5+
import androidx.appcompat.app.AppCompatDelegate.*
66
import org.ligi.passandroid.R
77
import org.ligi.passandroid.R.string.preference_key_autolight
88
import org.ligi.passandroid.R.string.preference_key_condensed
@@ -33,10 +33,10 @@ class AndroidSettings(val context: Context) : Settings {
3333

3434
override fun getNightMode(): Int {
3535
return when (sharedPreferences.getString(context.getString(R.string.preference_key_nightmode), "auto")) {
36-
"day" -> AppCompatDelegate.MODE_NIGHT_NO
37-
"night" -> AppCompatDelegate.MODE_NIGHT_YES
38-
"auto" -> AppCompatDelegate.MODE_NIGHT_AUTO
39-
else -> AppCompatDelegate.MODE_NIGHT_AUTO
36+
"day" -> MODE_NIGHT_NO
37+
"night" -> MODE_NIGHT_YES
38+
"auto" -> MODE_NIGHT_FOLLOW_SYSTEM
39+
else -> MODE_NIGHT_FOLLOW_SYSTEM
4040
}
4141
}
4242

android/src/main/java/org/ligi/passandroid/ui/PrefsFragment.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ class PrefsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPref
3030
if (key == getString(R.string.preference_key_nightmode)) {
3131
@AppCompatDelegate.NightMode val nightMode = settings.getNightMode()
3232

33-
if (nightMode == MODE_NIGHT_AUTO) {
34-
constructPermissionsRequest(Manifest.permission.ACCESS_COARSE_LOCATION) {}.launch()
35-
}
36-
3733
AppCompatDelegate.setDefaultNightMode(nightMode)
3834
activity?.let { ActivityCompat.recreate(it) }
3935
}

android/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
161161
</string-array>
162162
<string name="night_mode_night">Nacht</string>
163163
<string name="night_mode_day">Tag</string>
164-
<string name="night_mode_auto">Automatisch</string>
164+
<string name="night_mode_auto">Wie System</string>
165165
<string name="preference_autolight_title">Automatische Helligkeit</string>
166166
<string name="preference_autolight_summary">Soll ich die Helligkeit des Bildschirmes erhöhen, wenn ein Barcode gezeigt wird?</string>
167167
<string name="preference_condensed_title">Kompakt-Modus</string>

android/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
178178

179179
<string name="night_mode_night">Night</string>
180180
<string name="night_mode_day">Day</string>
181-
<string name="night_mode_auto">Auto</string>
181+
<string name="night_mode_auto">Follow System</string>
182182

183183
<string name="preference_autolight_title">Automatic light</string>
184184
<string name="preference_autolight_summary">Should I increase brightness when showing barcode?</string>

0 commit comments

Comments
 (0)