diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-12 14:58:47 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-12 18:55:28 +0200 |
commit | 96b44c1771c528264cc1e83b725bfc8a96e7cc73 (patch) | |
tree | 6c32284e431471ef10b96f96cb1f314f32f7079e /app/src/main/java/com/wireguard/android/Application.java | |
parent | 4a1d07b36430af788a7d65e880a077d6685eba13 (diff) |
Activity: make dark/night theme follow system on Q
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/Application.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/Application.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/Application.java b/app/src/main/java/com/wireguard/android/Application.java index 7bc07d6b..1ffaa250 100644 --- a/app/src/main/java/com/wireguard/android/Application.java +++ b/app/src/main/java/com/wireguard/android/Application.java @@ -115,9 +115,13 @@ public class Application extends android.app.Application { toolsInstaller = new ToolsInstaller(getApplicationContext()); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - AppCompatDelegate.setDefaultNightMode( - sharedPreferences.getBoolean("dark_theme", false) ? - AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + AppCompatDelegate.setDefaultNightMode( + sharedPreferences.getBoolean("dark_theme", false) ? + AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); + } else { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + } tunnelManager = new TunnelManager(new FileConfigStore(getApplicationContext())); tunnelManager.onCreate(); |