From 47a8a375d0616f13c458ecf1f0bb92990c564c21 Mon Sep 17 00:00:00 2001 From: Richard <55950829+Anonyzh@users.noreply.github.com> Date: Sat, 23 Apr 2022 17:50:54 +0800 Subject: [PATCH 1/2] Update LauncherActivity.java --- .../subhamtyagi/lastlauncher/LauncherActivity.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java index e9a11865..e4fa2dfb 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java @@ -157,6 +157,9 @@ public class LauncherActivity extends Activity implements View.OnClickListener, // gesture detector private Gestures detector; private ShortcutUtils shortcutUtils; + + private static boolean judge; + private static final TextWatcher mTextWatcher= new TextWatcher() { @@ -217,7 +220,14 @@ protected void onCreate(Bundle savedInstanceState) { int theme = DbUtils.getTheme(); //theme must be set before setContentView - setTheme(theme); + if(judge){ + int hour = new Date(System.currentTimeMillis()).getHours(); + setTheme(hour<=19 && hour>=7 ? R.style.BlackOnGrey : R.style.Black); + judge = false; + } + else{ + setTheme(theme); + } setContentView(R.layout.activity_launcher); @@ -1333,4 +1343,4 @@ protected Void doInBackground(final Integer... integers) { return null; } } -} \ No newline at end of file +} From 3ac308980b13b128cd050c89784b9634ef120ed8 Mon Sep 17 00:00:00 2001 From: Richard <55950829+Anonyzh@users.noreply.github.com> Date: Sat, 23 Apr 2022 19:02:09 +0800 Subject: [PATCH 2/2] Update LauncherActivity.java --- .../io/github/subhamtyagi/lastlauncher/LauncherActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java index e4fa2dfb..894206d0 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java @@ -158,7 +158,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener, private Gestures detector; private ShortcutUtils shortcutUtils; - private static boolean judge; + private static boolean judge = true; private static final TextWatcher mTextWatcher= new TextWatcher() {