Skip to content

Commit 8af6189

Browse files
committed
small fix
1 parent 290b17d commit 8af6189

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed
Binary file not shown.

app/src/main/java/com/josh/trackcovid19v2/HomeActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public class HomeActivity extends AppCompatActivity {
2626
private int SPLASH_SCREEN_TIME_OUT = 30000;
2727
private Button button;
2828
private Handler handler;
29-
private int STORAGE_PERMISSION_CODE = 1;
30-
private int INTERNET_PERMISSION_CODE = 1;
29+
private final int STORAGE_PERMISSION_CODE = 1;
30+
private final int INTERNET_PERMISSION_CODE = 1;
3131
private Runnable myRunnable;
3232
protected void onCreate(Bundle savedInstanceState) {
3333
super.onCreate(savedInstanceState);

app/src/main/java/com/josh/trackcovid19v2/SettingsActivity.java

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.josh.trackcovid19v2;
22

33
import android.os.Bundle;
4+
import android.util.Log;
45

56
import androidx.appcompat.app.ActionBar;
67
import androidx.appcompat.app.AppCompatActivity;
@@ -36,8 +37,13 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
3637
public boolean onPreferenceChange(Preference preference, Object newValue) {
3738
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
3839
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
40+
darkModeSwitch.setDefaultValue(true);
41+
Log.i("aa","set off dark mode");
3942
} else {
4043
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
44+
darkModeSwitch.setDefaultValue(false);
45+
Log.i("aa","set on dark mode");
46+
4147
}
4248
return false;
4349
}

app/src/main/res/xml/root_preferences.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
<SwitchPreference
88
android:key="darkMode"
9-
android:title="Dark Mode" />
9+
android:title="Dark Mode"
10+
android:defaultValue="false"
11+
android:summaryOff="Disabled"
12+
android:summaryOn="Enabled"/>
1013

1114

1215

0 commit comments

Comments
 (0)