-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加解锁 添加夜间模式 目前版本支持直接安装
- Loading branch information
Showing
33 changed files
with
678 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/tignioj/freezeapp/InitApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.tignioj.freezeapp; | ||
|
||
import android.app.Application; | ||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceManager; | ||
|
||
import androidx.appcompat.app.AppCompatDelegate; | ||
|
||
import com.tignioj.freezeapp.config.MyConfig; | ||
|
||
public class InitApplication extends Application { | ||
private boolean isNightModeEnabled = false; | ||
|
||
private static InitApplication singleton = null; | ||
|
||
public static InitApplication getInstance() { | ||
if (singleton == null) { | ||
singleton = new InitApplication(); | ||
} | ||
return singleton; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
singleton = this; | ||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
this.isNightModeEnabled = mPrefs.getBoolean(MyConfig.PERSONAL_SHP_CONFIG_KEY_IS_NIGHT_MODE, true); | ||
} | ||
|
||
public boolean isNightModeEnabled() { | ||
return isNightModeEnabled; | ||
} | ||
|
||
public void setIsNightModeEnabled(boolean isNightModeEnabled) { | ||
this.isNightModeEnabled = isNightModeEnabled; | ||
|
||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
SharedPreferences.Editor editor = mPrefs.edit(); | ||
editor.putBoolean(MyConfig.PERSONAL_SHP_CONFIG_KEY_IS_NIGHT_MODE, isNightModeEnabled); | ||
editor.apply(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.