From a55506e6072aec69aaf5f380c42256ca108e139d Mon Sep 17 00:00:00 2001
From: RetrogisusDEV <99091223+RetrogisusDEV@users.noreply.github.com>
Date: Wed, 17 Jan 2024 09:18:10 -0400
Subject: [PATCH] Light and dark themes for the launcher and settings
---
AndroidManifest.xml | 4 ++--
res/values-night-v21/styles.xml | 4 ++++
res/values-v21/styles.xml | 4 ++++
res/values/styles.xml | 1 +
srcs/juloo.keyboard2/LauncherActivity.java | 1 +
srcs/juloo.keyboard2/SettingsActivity.java | 13 -------------
6 files changed, 12 insertions(+), 15 deletions(-)
create mode 100644 res/values-night-v21/styles.xml
create mode 100644 res/values-v21/styles.xml
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2cb8b17..7cdbcda 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -7,12 +7,12 @@
-
+
-
+
diff --git a/res/values-night-v21/styles.xml b/res/values-night-v21/styles.xml
new file mode 100644
index 0000000..9daa919
--- /dev/null
+++ b/res/values-night-v21/styles.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/res/values-v21/styles.xml b/res/values-v21/styles.xml
new file mode 100644
index 0000000..56a4b58
--- /dev/null
+++ b/res/values-v21/styles.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index fc753c3..07ed490 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -22,4 +22,5 @@
- 16dp
- center
+
diff --git a/srcs/juloo.keyboard2/LauncherActivity.java b/srcs/juloo.keyboard2/LauncherActivity.java
index f766466..b8906b5 100644
--- a/srcs/juloo.keyboard2/LauncherActivity.java
+++ b/srcs/juloo.keyboard2/LauncherActivity.java
@@ -25,6 +25,7 @@ public class LauncherActivity extends Activity
@Override
public void onCreate(Bundle savedInstanceState)
{
+
super.onCreate(savedInstanceState);
setContentView(R.layout.launcher_activity);
_intro_video = (VideoView)findViewById(R.id.launcher_intro_video);
diff --git a/srcs/juloo.keyboard2/SettingsActivity.java b/srcs/juloo.keyboard2/SettingsActivity.java
index d053552..2b7ae91 100644
--- a/srcs/juloo.keyboard2/SettingsActivity.java
+++ b/srcs/juloo.keyboard2/SettingsActivity.java
@@ -12,7 +12,6 @@ public class SettingsActivity extends PreferenceActivity
@Override
public void onCreate(Bundle savedInstanceState)
{
- detectSystemTheme();
super.onCreate(savedInstanceState);
// The preferences can't be read when in direct-boot mode. Avoid crashing
// and don't allow changing the settings.
@@ -26,18 +25,6 @@ public class SettingsActivity extends PreferenceActivity
addPreferencesFromResource(R.xml.settings);
}
- /** The default theme is [Theme.DeviceDefault], which is dark. Detect if the
- system is using light theme. */
- void detectSystemTheme()
- {
- if (Build.VERSION.SDK_INT >= 14)
- {
- int ui_mode = getResources().getConfiguration().uiMode;
- if ((ui_mode & Configuration.UI_MODE_NIGHT_NO) != 0)
- setTheme(android.R.style.Theme_DeviceDefault_Light);
- }
- }
-
void fallbackEncrypted()
{
// Can't communicate with the user here.