├── .gitignore ├── LICENSE ├── README-en.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── xposed_init │ ├── ic_launcher-playstore.png │ ├── ic_launcher-web.png │ ├── ic_launcher_battery_saver-playstore.png │ ├── ic_launcher_dark_mode-playstore.png │ ├── ic_launcher_force_dark-playstore.png │ ├── ic_launcher_gray_scale-playstore.png │ ├── ic_launcher_invert_colors-playstore.png │ ├── ic_launcher_night_display-playstore.png │ ├── ic_launcher_night_displayl-playstore.png │ ├── java │ │ └── com │ │ │ └── modosa │ │ │ └── switchnightui │ │ │ ├── activity │ │ │ ├── AboutActivity.java │ │ │ ├── AbstractSwitchActivity.java │ │ │ ├── AbstractSwitchDisplayActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── SettingsActivity.java │ │ │ ├── SwitchBatterySaverActivity.java │ │ │ ├── SwitchDarkModeActivity.java │ │ │ ├── SwitchForceDarkActivity.java │ │ │ ├── SwitchGrayScaleActivity.java │ │ │ ├── SwitchInvertColorsActivity.java │ │ │ ├── SwitchNightDisplayActivity.java │ │ │ ├── TimingSwitchActivity.java │ │ │ └── XFeatureActivity.java │ │ │ ├── base │ │ │ ├── Application.java │ │ │ ├── BaseActivity.java │ │ │ └── BaseAppCompatActivity.java │ │ │ ├── fragment │ │ │ ├── SettingsFragment.java │ │ │ ├── TimingSwitchFragment.java │ │ │ └── XFeatureFragment.java │ │ │ ├── provider │ │ │ └── MyPreferenceProvider.java │ │ │ ├── receiver │ │ │ ├── TimingSwitchReceiver.java │ │ │ └── widgets │ │ │ │ ├── AbstractSwitchWidget.java │ │ │ │ ├── SwitchBatterySaverWidget.java │ │ │ │ ├── SwitchDarkModeWidget.java │ │ │ │ ├── SwitchForceDarkWidget.java │ │ │ │ ├── SwitchGrayScaleWidget.java │ │ │ │ ├── SwitchInvertColorsWidget.java │ │ │ │ └── SwitchNightDisplayWidget.java │ │ │ ├── service │ │ │ ├── NotificationService.java │ │ │ └── tiles │ │ │ │ ├── AbstractSwitchDisplayTile.java │ │ │ │ ├── SwitchBatterySaverTile.java │ │ │ │ ├── SwitchDarkModeTile.java │ │ │ │ ├── SwitchForceDarkTile.java │ │ │ │ ├── SwitchGrayScaleTile.java │ │ │ │ ├── SwitchInvertColorsTile.java │ │ │ │ └── SwitchNightDisplayTile.java │ │ │ └── util │ │ │ ├── AppInfoUtil.java │ │ │ ├── Constants.java │ │ │ ├── LocationUtil.java │ │ │ ├── MyTimePickerDialog.java │ │ │ ├── OpUtil.java │ │ │ ├── ResultMsg.java │ │ │ ├── ShellUtil.java │ │ │ ├── SpUtil.java │ │ │ ├── SwitchBatterySaverUtil.java │ │ │ ├── SwitchDarkModeUtil.java │ │ │ ├── SwitchDisplayUtil.java │ │ │ ├── SwitchForceDarkUtil.java │ │ │ ├── TimingSwitchUtil.java │ │ │ ├── WriteSettingsUtil.java │ │ │ ├── XModule.java │ │ │ └── oneplus │ │ │ ├── OPThemeUtils.java │ │ │ ├── OpSwitchDarkModeUtil.java │ │ │ ├── OpSwitchForceDarkUtil.java │ │ │ └── OpTheme.java │ └── res │ │ ├── drawable-night │ │ ├── ic_daynight_about.xml │ │ ├── ic_daynight_battery_saver.xml │ │ ├── ic_daynight_carmode.xml │ │ ├── ic_daynight_excludefromrecents.xml │ │ ├── ic_daynight_gray_scale.xml │ │ ├── ic_daynight_help.xml │ │ ├── ic_daynight_instructions_before_use.xml │ │ ├── ic_daynight_invert_colors.xml │ │ ├── ic_daynight_night_display.xml │ │ ├── ic_daynight_oneplus.xml │ │ ├── ic_daynight_permanent_notification.xml │ │ ├── ic_daynight_stablemode.xml │ │ └── ic_daynight_timeup.xml │ │ ├── drawable │ │ ├── alertdialog_background.xml │ │ ├── avatar_dadaewq_circle_middle.xml │ │ ├── ic_daynight_about.xml │ │ ├── ic_daynight_battery_saver.xml │ │ ├── ic_daynight_carmode.xml │ │ ├── ic_daynight_excludefromrecents.xml │ │ ├── ic_daynight_gray_scale.xml │ │ ├── ic_daynight_help.xml │ │ ├── ic_daynight_instructions_before_use.xml │ │ ├── ic_daynight_invert_colors.xml │ │ ├── ic_daynight_night_display.xml │ │ ├── ic_daynight_oneplus.xml │ │ ├── ic_daynight_permanent_notification.xml │ │ ├── ic_daynight_stablemode.xml │ │ ├── ic_daynight_timeup.xml │ │ ├── ic_launcher_battery_saver_foreground.xml │ │ ├── ic_launcher_dark_mode_foreground.xml │ │ ├── ic_launcher_force_dark_foreground.xml │ │ ├── ic_launcher_foreground.xml │ │ ├── ic_launcher_gray_scale_foreground.xml │ │ ├── ic_launcher_invert_colors_foreground.xml │ │ ├── ic_launcher_night_display_foreground.xml │ │ ├── ic_passed.xml │ │ ├── ic_qq.xml │ │ ├── ic_qs_battery_saver.xml │ │ ├── ic_qs_dark_mode.xml │ │ ├── ic_qs_force_dark.xml │ │ ├── ic_qs_gray_scale.xml │ │ ├── ic_qs_invert_colors.xml │ │ ├── ic_qs_night_display.xml │ │ ├── ic_rate.xml │ │ ├── ic_update.xml │ │ ├── ic_url.xml │ │ ├── ic_warnning.xml │ │ └── ic_wechat.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_preference.xml │ │ ├── app_widget_switch_battery_saver.xml │ │ ├── app_widget_switch_dark_mode.xml │ │ ├── app_widget_switch_force_dark.xml │ │ ├── app_widget_switch_gray_scale.xml │ │ ├── app_widget_switch_invert_colors.xml │ │ ├── app_widget_switch_night_display.xml │ │ └── confirm_checkbox.xml │ │ ├── menu │ │ ├── menu_about.xml │ │ └── menu_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ ├── ic_launcher_battery_saver.xml │ │ ├── ic_launcher_battery_saver_round.xml │ │ ├── ic_launcher_dark_mode.xml │ │ ├── ic_launcher_dark_mode_round.xml │ │ ├── ic_launcher_force_dark.xml │ │ ├── ic_launcher_force_dark_round.xml │ │ ├── ic_launcher_gray_scale.xml │ │ ├── ic_launcher_gray_scale_round.xml │ │ ├── ic_launcher_invert_colors.xml │ │ ├── ic_launcher_invert_colors_round.xml │ │ ├── ic_launcher_night_display.xml │ │ ├── ic_launcher_night_display_round.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_battery_saver.png │ │ ├── ic_launcher_battery_saver_round.png │ │ ├── ic_launcher_dark_mode.png │ │ ├── ic_launcher_dark_mode_round.png │ │ ├── ic_launcher_force_dark.png │ │ ├── ic_launcher_force_dark_round.png │ │ ├── ic_launcher_gray_scale.png │ │ ├── ic_launcher_gray_scale_round.png │ │ ├── ic_launcher_invert_colors.png │ │ ├── ic_launcher_invert_colors_round.png │ │ ├── ic_launcher_night_display.png │ │ ├── ic_launcher_night_display_round.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_battery_saver.png │ │ ├── ic_launcher_battery_saver_round.png │ │ ├── ic_launcher_dark_mode.png │ │ ├── ic_launcher_dark_mode_round.png │ │ ├── ic_launcher_force_dark.png │ │ ├── ic_launcher_force_dark_round.png │ │ ├── ic_launcher_gray_scale.png │ │ ├── ic_launcher_gray_scale_round.png │ │ ├── ic_launcher_invert_colors.png │ │ ├── ic_launcher_invert_colors_round.png │ │ ├── ic_launcher_night_display.png │ │ ├── ic_launcher_night_display_round.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_green_apps.png │ │ ├── ic_install_lion.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_battery_saver.png │ │ ├── ic_launcher_battery_saver_round.png │ │ ├── ic_launcher_dark_mode.png │ │ ├── ic_launcher_dark_mode_round.png │ │ ├── ic_launcher_force_dark.png │ │ ├── ic_launcher_force_dark_round.png │ │ ├── ic_launcher_gray_scale.png │ │ ├── ic_launcher_gray_scale_round.png │ │ ├── ic_launcher_invert_colors.png │ │ ├── ic_launcher_invert_colors_round.png │ │ ├── ic_launcher_night_display.png │ │ ├── ic_launcher_night_display_round.png │ │ ├── ic_launcher_round.png │ │ └── ic_unblock_darkmode.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_battery_saver.png │ │ ├── ic_launcher_battery_saver_round.png │ │ ├── ic_launcher_dark_mode.png │ │ ├── ic_launcher_dark_mode_round.png │ │ ├── ic_launcher_force_dark.png │ │ ├── ic_launcher_force_dark_round.png │ │ ├── ic_launcher_gray_scale.png │ │ ├── ic_launcher_gray_scale_round.png │ │ ├── ic_launcher_invert_colors.png │ │ ├── ic_launcher_invert_colors_round.png │ │ ├── ic_launcher_night_display.png │ │ ├── ic_launcher_night_display_round.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_battery_saver.png │ │ ├── ic_launcher_battery_saver_round.png │ │ ├── ic_launcher_dark_mode.png │ │ ├── ic_launcher_dark_mode_round.png │ │ ├── ic_launcher_force_dark.png │ │ ├── ic_launcher_force_dark_round.png │ │ ├── ic_launcher_gray_scale.png │ │ ├── ic_launcher_gray_scale_round.png │ │ ├── ic_launcher_invert_colors.png │ │ ├── ic_launcher_invert_colors_round.png │ │ ├── ic_launcher_night_display.png │ │ ├── ic_launcher_night_display_round.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── colors.xml │ │ ├── values-zh │ │ └── strings.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_launcher_battery_saver_background.xml │ │ ├── ic_launcher_dark_mode_background.xml │ │ ├── ic_launcher_force_dark_background.xml │ │ ├── ic_launcher_gray_scale_background.xml │ │ ├── ic_launcher_invert_colors_background.xml │ │ ├── ic_launcher_night_display_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ ├── xml-v17 │ │ ├── app_widget_info_switch_battery_saver.xml │ │ ├── app_widget_info_switch_dark_mode.xml │ │ ├── app_widget_info_switch_force_dark.xml │ │ ├── app_widget_info_switch_gray_scale.xml │ │ ├── app_widget_info_switch_invert_colors.xml │ │ └── app_widget_info_switch_night_display.xml │ │ ├── xml-v25 │ │ └── shortcuts.xml │ │ ├── xml-v29 │ │ └── shortcuts.xml │ │ └── xml │ │ ├── app_widget_info_switch_battery_saver.xml │ │ ├── app_widget_info_switch_dark_mode.xml │ │ ├── app_widget_info_switch_force_dark.xml │ │ ├── app_widget_info_switch_gray_scale.xml │ │ ├── app_widget_info_switch_invert_colors.xml │ │ ├── app_widget_info_switch_night_display.xml │ │ ├── appcenter_backup_rule.xml │ │ ├── pref_settings.xml │ │ ├── pref_timingswitch.xml │ │ └── pref_xfeature.xml │ └── test │ └── java │ └── com │ └── modosa │ └── switchnightui │ ├── CheckUtil.java │ └── CheckUtil1.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | -------------------------------------------------------------------------------- /README-en.md: -------------------------------------------------------------------------------- 1 | ## Dark Mode Switch 2 | 3 | ### [中文](https://github.com/dadaewq/Dark-Mode-Switch/blob/master/README.md) 4 | 5 | This application is designed to switch the dark/night/ theme/UI of the Android system. (Supports timing switching) 6 | 7 | This switch is the night mode in the Android9.0 developer options and the dark theme that began in Android10. This application supports Android4.1 +. 8 | 9 | 10 | ##### Android 10 and above can use **Root** to try to switch the forced dark, which is equivalent to the developer options "Override force-dark", MIUI's "Global Inverse Color" and other switches. (Adapted to OnePlus) 11 | 12 | We provides 3 equivalent methods to switch the dark mode: 13 | 14 | ##### Method 1 Its availability is determined by the system 15 | 16 | ##### Method 2 requires authorization 17 | 18 | ` adb shell pm grant com.modosa.switchnightui android.permission.WRITE_SECURE_SETTINGS ` 19 | 20 | ##### Method 3 requires Root 21 | 22 | We provides tiles, widgets, static shortcuts,pinned shortcuts and setting assistant applications to quickly switch. The switching method follows the main interface selection. 23 | 24 | ## Download 25 | [Get it on CoolApk](https://www.coolapk.com/apk/com.modosa.switchnightui) 28 | 29 | 30 | #### Matters need attention: 31 | 32 | OPPO and other devices may be automatically turned off by the system after turning on the dark mode. Only then need to turn on **stable mode** to switch. Clicking the refresh in the stable mode can make this APP theme follow the system. According to feedback, some OPPO devices will automatically turn off the dark mode after the screen is locked. This is temporarily unsolved. Android 10 will force the system to enter the dark mode when the power saving mode is turned on. At this time, the application cannot turn off the dark mode. 33 | 34 | (If the device has a Android core patch, methods 1, 2, and 3 can be used directly without additional operations.) 35 | 36 | ##### About method 1: 37 | 38 | Part of the system limits method 1, we provide two methods that require **Root** to remove this restriction: 39 | 40 | (1) Move this application to `/system/priv-app/` and reboot the device. 41 | 42 | (2) Need to modify a bool value of resources in **framework-res.apk**, open the apk to modify the bool in **resources.arsc**, find **config_lockDayNightMode**, modify it to false, replace the original Apk, and reboot the device. 43 | (This has the advantage that at the same time you can also use some previous applications that could not be switched, because this operation is equivalent to canceling the system lock on modifying the night theme.) 44 | 45 | ### [LICENSE](https://github.com/dadaewq/Dark-Mode-Switch/blob/master/LICENSE) 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 深色模式切换 2 | 3 | ### [English](https://github.com/dadaewq/Dark-Mode-Switch/blob/master/README-en.md) 4 | 5 | 本应用旨在切换Android系统的 深色/夜间/黑暗/暗色 模式/主题/UI。(支持定时切换) 6 | 7 | 另提供Xposed功能,解除部分应用对深色模式相关功能的限制(目前支持微信、QQ和酷安的部分版本) 8 | 9 | 此开关就是Android9.0开发者选项中的夜间模式和Android10开始有的深色主题,本应用支持了Android4.1+。 10 | 11 | ##### Android 10及以上可用Root尝试切换强制深色,等同于开发者选项的"覆盖'强制启用 SmartDark功能'的设置"、MIUI的"全局反色"等开关。(已适配一加) 12 | 13 | 本应用提供3个等效方法来切换深色模式: 14 | 15 | ##### 方法1 可用性由系统决定 16 | 17 | ##### 方法2 需要授权 18 | 19 | ` adb shell pm grant com.modosa.switchnightui android.permission.WRITE_SECURE_SETTINGS ` 20 | 21 | ##### 方法3 需要Root 22 | 23 | 应用提供磁贴、微件、Shortcut、快捷方式和设置助手应用来快捷切换,切换方法跟随主界面选择。 24 | 25 | ## 下载 26 | [Get it on CoolApk](https://www.coolapk.com/apk/com.modosa.switchnightui) 29 | 30 | 31 | #### 注意事项: 32 | 33 | OPPO等设备开启深色模式后可能会被系统自动关闭,此时需要开启稳定模式以切换,稳定模式下点刷新可以让本APP主题跟随系统。据反馈,部分OPPO设备在锁屏后还是会自动关闭深色模式,这个暂时无解。Android10在打开省电模式时会强制系统进入深色模式,此时本应用无法关闭深色模式。 34 | 35 | (如果设备有核心破解的话,方法1、2、3都可以直接用,无需其他多余的操作。) 36 | 37 | ##### 有关方法1: 38 | 39 | 部分系统限制了方法1,提供两种方法需要用到Root权限来解除这个限制: 40 | 41 | (1)把本应用移动到`/system/priv-app/`下,重启设备即可。 42 | 43 | (2)需要修改**framework-res.apk**中资源的一个bool值,打开apk修改resources.arsc中的bool,找到**config_lockDayNightMode**,修改为false后,替换原来的Apk,重启设备即可。 44 | (这样做有一个好处就是同时你也可以用之前一些无法切换的应用了,因为这个操作相当于取消了系统对修改夜间主题的锁。) 45 | 46 | ### [LICENSE](https://github.com/dadaewq/Dark-Mode-Switch/blob/master/LICENSE) 47 | 48 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 31 7 | 8 | defaultConfig { 9 | resConfig 'zh' 10 | applicationId "com.modosa.switchnightui" 11 | minSdkVersion 16 12 | targetSdkVersion 31 13 | versionCode 55 14 | versionName "2.7.2" 15 | } 16 | buildTypes { 17 | release { 18 | shrinkResources true 19 | minifyEnabled true 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | compileOptions { 24 | sourceCompatibility = 11 25 | targetCompatibility = 11 26 | } 27 | android.applicationVariants.all { variant -> 28 | variant.outputs.all { 29 | outputFileName = "${applicationId}_${versionName}_${versionCode}.apk" 30 | } 31 | } 32 | } 33 | 34 | dependencies { 35 | implementation fileTree(include: ['*.jar'], dir: 'libs') 36 | def appCenterSdkVersion = '4.3.1' 37 | implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" 38 | implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" 39 | 40 | //noinspection GradleDependency 41 | implementation 'androidx.appcompat:appcompat:1.4.0-beta01' 42 | implementation 'androidx.preference:preference:1.1.1' 43 | implementation 'androidx.browser:browser:1.4.0-rc01' 44 | 45 | //be careful to dump this 46 | // implementation 'com.google.android.material:material:1.2.0-alpha05' 47 | implementation 'com.google.android.material:material:1.5.0-alpha04' 48 | 49 | implementation 'com.drakeet.about:about:2.4.1' 50 | implementation 'com.drakeet.multitype:multitype:4.3.0' 51 | 52 | 53 | // implementation 'androidx.constraintlayout:constraintlayout:2.1.1' 54 | compileOnly 'de.robv.android.xposed:api:82' 55 | // compileOnly 'de.robv.android.xposed:api:82:sources' 56 | 57 | // implementation 'com.blankj:utilcodex:1.28.1' 58 | implementation 'com.luckycatlabs:SunriseSunsetCalculator:1.2' 59 | 60 | implementation 'com.crossbowffs.remotepreferences:remotepreferences:0.8' 61 | } 62 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | #-keep class com.modosa.switchnightui.util.XModule 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | com.modosa.switchnightui.util.XModule -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_battery_saver-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_battery_saver-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_dark_mode-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_dark_mode-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_force_dark-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_force_dark-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_gray_scale-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_gray_scale-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_invert_colors-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_invert_colors-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_night_display-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_night_display-playstore.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher_night_displayl-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dadaewq/Dark-Mode-Switch/97bbbc6253f5903c29fd2ff7c984f957b171c817/app/src/main/ic_launcher_night_displayl-playstore.png -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/AbstractSwitchActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | 6 | import androidx.core.content.pm.ShortcutInfoCompat; 7 | import androidx.core.content.pm.ShortcutManagerCompat; 8 | import androidx.core.graphics.drawable.IconCompat; 9 | 10 | import com.modosa.switchnightui.R; 11 | import com.modosa.switchnightui.base.BaseActivity; 12 | import com.modosa.switchnightui.util.OpUtil; 13 | 14 | /** 15 | * @author dadaewq 16 | */ 17 | abstract public class AbstractSwitchActivity extends BaseActivity { 18 | 19 | String shortcutId; 20 | int shortcutLongLabelId; 21 | int iconId; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | 27 | if (Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) { 28 | createShortCut(); 29 | } else { 30 | switchMethod(); 31 | } 32 | finish(); 33 | } 34 | 35 | void showSwitchTipNeedSdk(int what1, String what2) { 36 | OpUtil.showToast1(this, String.format( 37 | getString(R.string.tip_switch_what1_need_android_what2), 38 | getString(what1), 39 | what2 40 | )); 41 | } 42 | 43 | /** 44 | * 切换的具体方法 45 | */ 46 | abstract void switchMethod(); 47 | 48 | private void createShortCut() { 49 | if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) { 50 | 51 | Intent intent = new Intent(new Intent(Intent.ACTION_VIEW)) 52 | .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) 53 | .setClass(this, getClass()); 54 | String label = getString(shortcutLongLabelId); 55 | ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(this, shortcutId) 56 | .setLongLabel(label) 57 | .setShortLabel(label) 58 | .setIcon(IconCompat.createWithResource(this, iconId)) 59 | .setIntent(intent) 60 | .build(); 61 | 62 | Intent pinnedShortcutCallbackIntent = ShortcutManagerCompat.createShortcutResultIntent(this, shortcut); 63 | setResult(RESULT_OK, pinnedShortcutCallbackIntent); 64 | } 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/AbstractSwitchDisplayActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 7 | 8 | /** 9 | * @author dadaewq 10 | */ 11 | abstract public class AbstractSwitchDisplayActivity extends AbstractSwitchActivity { 12 | String key; 13 | int lowestSdk; 14 | String nameLowestSdk; 15 | 16 | @Override 17 | void switchMethod() { 18 | if (Build.VERSION.SDK_INT >= lowestSdk) { 19 | new SwitchDisplayUtil(this).switchDisplayKeyWithResult(key, getString(shortcutLongLabelId)); 20 | } else { 21 | showSwitchTipNeedSdk(shortcutLongLabelId, nameLowestSdk); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.Window; 5 | 6 | import androidx.annotation.Nullable; 7 | import androidx.appcompat.app.ActionBar; 8 | import androidx.appcompat.widget.Toolbar; 9 | import androidx.fragment.app.FragmentManager; 10 | 11 | import com.modosa.switchnightui.R; 12 | import com.modosa.switchnightui.base.BaseAppCompatActivity; 13 | import com.modosa.switchnightui.fragment.SettingsFragment; 14 | 15 | /** 16 | * @author dadaewq 17 | */ 18 | public class SettingsActivity extends BaseAppCompatActivity { 19 | @Override 20 | protected void onCreate(@Nullable Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | init(); 23 | } 24 | 25 | private void init() { 26 | setContentView(R.layout.activity_preference); 27 | Toolbar toolbar = findViewById(R.id.toolbar); 28 | setSupportActionBar(toolbar); 29 | ActionBar actionBar = getSupportActionBar(); 30 | if (actionBar != null) { 31 | actionBar.setDisplayHomeAsUpEnabled(true); 32 | } 33 | Window window = getWindow(); 34 | if (window != null) { 35 | window.setBackgroundDrawableResource(R.drawable.alertdialog_background); 36 | } 37 | 38 | FragmentManager fragmentManager = getSupportFragmentManager(); 39 | fragmentManager.beginTransaction().replace(R.id.framelayout, new SettingsFragment()).commit(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchBatterySaverActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.R; 7 | import com.modosa.switchnightui.util.SwitchBatterySaverUtil; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public class SwitchBatterySaverActivity extends AbstractSwitchActivity { 13 | 14 | 15 | public SwitchBatterySaverActivity() { 16 | shortcutId = "SwitchBatterySaver"; 17 | shortcutLongLabelId = R.string.title_battery_saver; 18 | iconId = R.mipmap.ic_launcher_battery_saver; 19 | } 20 | 21 | 22 | @Override 23 | void switchMethod() { 24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 25 | new SwitchBatterySaverUtil(this).switchBatterySaverWithResult(); 26 | } else { 27 | showSwitchTipNeedSdk(R.string.title_battery_saver, "5.0"); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchDarkModeActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.content.Intent; 5 | import android.content.res.Configuration; 6 | import android.os.Bundle; 7 | 8 | import androidx.annotation.NonNull; 9 | 10 | import com.modosa.switchnightui.R; 11 | import com.modosa.switchnightui.util.SpUtil; 12 | import com.modosa.switchnightui.util.SwitchDarkModeUtil; 13 | import com.modosa.switchnightui.util.WriteSettingsUtil; 14 | 15 | import java.util.Objects; 16 | 17 | /** 18 | * @author dadaewq 19 | */ 20 | public class SwitchDarkModeActivity extends AbstractSwitchActivity { 21 | 22 | private SpUtil spUtil; 23 | private SwitchDarkModeUtil switchDarkModeUtil; 24 | private boolean enable; 25 | 26 | public SwitchDarkModeActivity() { 27 | shortcutId = "SwitchDarkMode"; 28 | shortcutLongLabelId = R.string.title_dark_mode; 29 | iconId = R.mipmap.ic_launcher_dark_mode; 30 | } 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | 35 | spUtil = new SpUtil(this); 36 | switchDarkModeUtil = new SwitchDarkModeUtil(this); 37 | 38 | super.onCreate(savedInstanceState); 39 | } 40 | 41 | @Override 42 | void switchMethod() { 43 | Intent intent = getIntent(); 44 | if (intent != null && intent.hasExtra("darkMode")) { 45 | int nightMode = Objects.requireNonNull(intent.getExtras()).getInt("darkMode"); 46 | switchDarkModeUtil.setDarkModeWithResult(nightMode); 47 | } else { 48 | if (new SpUtil(this).getWorkMode() == 2) { 49 | enable = !WriteSettingsUtil.isNightMode(this); 50 | } else { 51 | enable = !switchDarkModeUtil.isDarkMode(); 52 | } 53 | switchDarkModeUtil.setDarkModeWithResult(enable); 54 | } 55 | } 56 | 57 | 58 | @Override 59 | public void onConfigurationChanged(@NonNull Configuration newconfig) { 60 | super.onConfigurationChanged(newconfig); 61 | 62 | if (spUtil.isStableMode()) { 63 | switchDarkModeUtil.setDarkModeWithResult(enable); 64 | } else { 65 | finish(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchForceDarkActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.R; 7 | import com.modosa.switchnightui.util.SwitchForceDarkUtil; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public class SwitchForceDarkActivity extends AbstractSwitchActivity { 13 | 14 | public SwitchForceDarkActivity() { 15 | shortcutId = "SwitchForceDark"; 16 | shortcutLongLabelId = R.string.title_force_dark; 17 | iconId = R.mipmap.ic_launcher_force_dark; 18 | } 19 | 20 | 21 | @Override 22 | void switchMethod() { 23 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 24 | new SwitchForceDarkUtil(this).switchForceDark(); 25 | } else { 26 | showSwitchTipNeedSdk(R.string.title_force_dark, "10"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchGrayScaleActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.R; 7 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public class SwitchGrayScaleActivity extends AbstractSwitchDisplayActivity { 13 | 14 | 15 | public SwitchGrayScaleActivity() { 16 | key = SwitchDisplayUtil.GRAYSCALE; 17 | lowestSdk = Build.VERSION_CODES.LOLLIPOP; 18 | nameLowestSdk = "5.0"; 19 | shortcutId = "SwitchGrayScale"; 20 | shortcutLongLabelId = R.string.title_gray_scale; 21 | iconId = R.mipmap.ic_launcher_gray_scale; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchInvertColorsActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.R; 7 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public class SwitchInvertColorsActivity extends AbstractSwitchDisplayActivity { 13 | 14 | public SwitchInvertColorsActivity() { 15 | key = SwitchDisplayUtil.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED; 16 | lowestSdk = Build.VERSION_CODES.LOLLIPOP; 17 | nameLowestSdk = "5.0"; 18 | shortcutId = "SwitchInvertColors"; 19 | shortcutLongLabelId = R.string.title_invert_colors; 20 | iconId = R.mipmap.ic_launcher_invert_colors; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/SwitchNightDisplayActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | 4 | import android.os.Build; 5 | 6 | import com.modosa.switchnightui.R; 7 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public class SwitchNightDisplayActivity extends AbstractSwitchDisplayActivity { 13 | 14 | public SwitchNightDisplayActivity() { 15 | key = SwitchDisplayUtil.NIGHT_DISPLAY_ACTIVATED; 16 | lowestSdk = Build.VERSION_CODES.N_MR1; 17 | nameLowestSdk = "7.1"; 18 | shortcutId = "SwitchNightDisplay"; 19 | shortcutLongLabelId = R.string.title_night_display; 20 | iconId = R.mipmap.ic_launcher_night_display; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/TimingSwitchActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | import android.Manifest; 4 | import android.annotation.SuppressLint; 5 | import android.app.Activity; 6 | import android.content.Intent; 7 | import android.content.pm.PackageManager; 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import android.os.PowerManager; 11 | import android.provider.Settings; 12 | import android.view.View; 13 | import android.view.Window; 14 | import android.widget.Button; 15 | 16 | import androidx.annotation.NonNull; 17 | import androidx.annotation.Nullable; 18 | import androidx.appcompat.app.ActionBar; 19 | import androidx.appcompat.widget.Toolbar; 20 | import androidx.core.app.ActivityCompat; 21 | import androidx.fragment.app.FragmentManager; 22 | 23 | import com.modosa.switchnightui.R; 24 | import com.modosa.switchnightui.base.BaseAppCompatActivity; 25 | import com.modosa.switchnightui.fragment.TimingSwitchFragment; 26 | 27 | import java.util.Objects; 28 | 29 | /** 30 | * @author dadaewq 31 | */ 32 | public class TimingSwitchActivity extends BaseAppCompatActivity { 33 | @Override 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | 37 | setContentView(R.layout.activity_preference); 38 | Toolbar toolbar = findViewById(R.id.toolbar); 39 | setSupportActionBar(toolbar); 40 | ActionBar actionBar = getSupportActionBar(); 41 | if (actionBar != null) { 42 | actionBar.setDisplayHomeAsUpEnabled(true); 43 | } 44 | Window window = getWindow(); 45 | if (window != null) { 46 | window.setBackgroundDrawableResource(R.drawable.alertdialog_background); 47 | } 48 | ignoreBatteryOptimization(); 49 | 50 | Button button = findViewById(R.id.uptateSun); 51 | Activity activity = this; 52 | button.setVisibility(View.VISIBLE); 53 | button.setOnClickListener(v -> { 54 | 55 | if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { 56 | ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 666); 57 | } else { 58 | Objects.requireNonNull(getSupportFragmentManager().findFragmentByTag("TimingSwitch")).onActivityResult(665, 666, null); 59 | } 60 | }); 61 | FragmentManager fragmentManager = getSupportFragmentManager(); 62 | fragmentManager.beginTransaction().replace(R.id.framelayout, new TimingSwitchFragment(), "TimingSwitch").commit(); 63 | 64 | 65 | } 66 | 67 | @Override 68 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, 69 | @NonNull int[] grantResults) { 70 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); 71 | if (requestCode == 666) { 72 | if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 73 | Objects.requireNonNull(getSupportFragmentManager().findFragmentByTag("TimingSwitch")).onActivityResult(665, 666, null); 74 | } 75 | } 76 | } 77 | 78 | @SuppressLint("BatteryLife") 79 | private void ignoreBatteryOptimization() { 80 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { 81 | PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); 82 | if (powerManager != null && !powerManager.isIgnoringBatteryOptimizations(getPackageName())) { 83 | Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) 84 | .setData(Uri.parse("package:" + getPackageName())); 85 | try { 86 | startActivity(intent); 87 | } catch (Exception ignore) { 88 | } 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/activity/XFeatureActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.Window; 5 | 6 | import androidx.annotation.Nullable; 7 | import androidx.appcompat.widget.Toolbar; 8 | 9 | import com.modosa.switchnightui.R; 10 | import com.modosa.switchnightui.base.BaseAppCompatActivity; 11 | import com.modosa.switchnightui.fragment.XFeatureFragment; 12 | 13 | /** 14 | * @author dadaewq 15 | */ 16 | public class XFeatureActivity extends BaseAppCompatActivity { 17 | @Override 18 | protected void onCreate(@Nullable Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | 21 | setContentView(R.layout.activity_preference); 22 | Toolbar toolbar = findViewById(R.id.toolbar); 23 | setSupportActionBar(toolbar); 24 | Window window = getWindow(); 25 | if (window != null) { 26 | window.setBackgroundDrawableResource(R.drawable.alertdialog_background); 27 | } 28 | 29 | getSupportFragmentManager().beginTransaction().replace(R.id.framelayout, new XFeatureFragment(), "XFeature").commit(); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/base/Application.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.base; 2 | 3 | import android.os.Build; 4 | 5 | import com.microsoft.appcenter.AppCenter; 6 | import com.microsoft.appcenter.analytics.Analytics; 7 | import com.microsoft.appcenter.crashes.Crashes; 8 | import com.modosa.switchnightui.util.OpUtil; 9 | import com.modosa.switchnightui.util.SpUtil; 10 | 11 | /** 12 | * @author dadaewq 13 | */ 14 | @SuppressWarnings("WeakerAccess") 15 | public class Application extends android.app.Application { 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | 21 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 22 | return; 23 | } 24 | 25 | if (new SpUtil(this).getBoolean(OpUtil.SP_KEY_ENABLE_BUG_REPORT, true)) { 26 | String scretCode = null; 27 | //TODO 28 | 29 | 30 | AppCenter.start(this, scretCode, Analytics.class, Crashes.class); 31 | } 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.base; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | 7 | import com.modosa.switchnightui.fragment.SettingsFragment; 8 | import com.modosa.switchnightui.util.OpUtil; 9 | import com.modosa.switchnightui.util.SpUtil; 10 | import com.modosa.switchnightui.util.TimingSwitchUtil; 11 | 12 | /** 13 | * @author dadaewq 14 | */ 15 | abstract public class BaseActivity extends Activity { 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | Context context = getApplicationContext(); 21 | SpUtil spUtil = new SpUtil(context); 22 | 23 | if (spUtil.getFalseBoolean(SettingsFragment.SP_KEY_PERMANENT_NOTIFICATION)) { 24 | OpUtil.addPermanentNotification(context); 25 | } 26 | 27 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH)) { 28 | new TimingSwitchUtil(getApplicationContext()).setAllSwitchAlarm(); 29 | } 30 | 31 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH2)) { 32 | new TimingSwitchUtil(getApplicationContext()).setAllSwitchAlarm2(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/base/BaseAppCompatActivity.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.base; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.view.MenuItem; 6 | 7 | import androidx.appcompat.app.AppCompatActivity; 8 | 9 | import com.modosa.switchnightui.fragment.SettingsFragment; 10 | import com.modosa.switchnightui.util.OpUtil; 11 | import com.modosa.switchnightui.util.SpUtil; 12 | import com.modosa.switchnightui.util.TimingSwitchUtil; 13 | 14 | /** 15 | * @author dadaewq 16 | */ 17 | abstract public class BaseAppCompatActivity extends AppCompatActivity { 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | Context context = getApplicationContext(); 23 | SpUtil spUtil = new SpUtil(context); 24 | 25 | if (spUtil.getFalseBoolean(SettingsFragment.SP_KEY_PERMANENT_NOTIFICATION)) { 26 | OpUtil.addPermanentNotification(context); 27 | } 28 | 29 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH)) { 30 | new TimingSwitchUtil(getApplicationContext()).setAllSwitchAlarm(); 31 | } 32 | 33 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH2)) { 34 | new TimingSwitchUtil(getApplicationContext()).setAllSwitchAlarm2(); 35 | } 36 | } 37 | 38 | @Override 39 | public boolean onOptionsItemSelected(MenuItem item) { 40 | if (item.getItemId() == android.R.id.home) { 41 | finish(); 42 | return true; 43 | } else { 44 | return super.onOptionsItemSelected(item); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/provider/MyPreferenceProvider.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.provider; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import com.crossbowffs.remotepreferences.RemotePreferenceProvider; 7 | import com.crossbowffs.remotepreferences.RemotePreferences; 8 | import com.modosa.switchnightui.util.Constants; 9 | 10 | public class MyPreferenceProvider extends RemotePreferenceProvider { 11 | 12 | private static SharedPreferences spInstance; 13 | 14 | 15 | public MyPreferenceProvider() { 16 | super(Constants.AUTHORITY, new String[]{Constants.PREF_FILE}); 17 | } 18 | 19 | public static SharedPreferences getRemoteSharedPreference(Context context) { 20 | if (spInstance == null) { 21 | synchronized (MyPreferenceProvider.class) { 22 | if (spInstance == null) { 23 | spInstance = new RemotePreferences(context, Constants.AUTHORITY, Constants.PREF_FILE); 24 | } 25 | } 26 | } 27 | return spInstance; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/TimingSwitchReceiver.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.util.Log; 8 | 9 | import com.modosa.switchnightui.fragment.SettingsFragment; 10 | import com.modosa.switchnightui.util.OpUtil; 11 | import com.modosa.switchnightui.util.SpUtil; 12 | import com.modosa.switchnightui.util.SwitchDarkModeUtil; 13 | import com.modosa.switchnightui.util.SwitchForceDarkUtil; 14 | import com.modosa.switchnightui.util.TimingSwitchUtil; 15 | 16 | import java.util.Objects; 17 | 18 | /** 19 | * @author dadaewq 20 | */ 21 | public class TimingSwitchReceiver extends BroadcastReceiver { 22 | 23 | @SuppressLint("UnsafeProtectedBroadcastReceiver") 24 | @Override 25 | public void onReceive(Context context, Intent intent) { 26 | SpUtil spUtil = new SpUtil(context); 27 | 28 | // Log.e("TimingSwitchReceiver", ": " + intent); 29 | if (spUtil.getFalseBoolean(SettingsFragment.SP_KEY_PERMANENT_NOTIFICATION)) { 30 | OpUtil.addPermanentNotification(context); 31 | } 32 | 33 | if (intent != null && intent.hasExtra("darkMode")) { 34 | int nightMode = Objects.requireNonNull(intent.getExtras()).getInt("darkMode"); 35 | new SwitchDarkModeUtil(context).setDarkModeWithResult(nightMode); 36 | } else { 37 | 38 | boolean allowSwitch = !(spUtil.getFalseBoolean("switchScreenOff") && OpUtil.isScreenOn(context)); 39 | Log.e("allowSwitch", ": " + allowSwitch); 40 | //Switch Dark Mode 41 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH)) { 42 | if (intent != null && intent.hasExtra("nightMode") && allowSwitch) { 43 | int nightMode = Objects.requireNonNull(intent.getExtras()).getInt("nightMode"); 44 | new SwitchDarkModeUtil(context).setDarkModeWithResult(nightMode); 45 | 46 | } 47 | new TimingSwitchUtil(context).setAllSwitchAlarm(); 48 | } 49 | 50 | //Switch Force Dark 51 | if (spUtil.getFalseBoolean(TimingSwitchUtil.ENABLE_TIMING_SWITCH2)) { 52 | if (intent != null && intent.hasExtra("froceDark") && allowSwitch) { 53 | int froceDark = Objects.requireNonNull(intent.getExtras()).getInt("froceDark"); 54 | new SwitchForceDarkUtil(context).setForceDark(froceDark); 55 | } 56 | new TimingSwitchUtil(context).setAllSwitchAlarm2(); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/AbstractSwitchWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import android.app.PendingIntent; 4 | import android.appwidget.AppWidgetManager; 5 | import android.appwidget.AppWidgetProvider; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.widget.RemoteViews; 9 | 10 | /** 11 | * Abstract of SwitchWidget functionality. 12 | * 13 | * @author dadaewq 14 | */ 15 | abstract public class AbstractSwitchWidget extends AppWidgetProvider { 16 | 17 | static int imgId; 18 | static int layoutId; 19 | static Class myClass; 20 | 21 | private static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, 22 | int appWidgetId) { 23 | 24 | RemoteViews views = new RemoteViews(context.getPackageName(), layoutId); 25 | 26 | views.setOnClickPendingIntent( 27 | imgId, 28 | PendingIntent.getActivity(context, imgId, new Intent(context, myClass), 0) 29 | ); 30 | 31 | appWidgetManager.updateAppWidget(appWidgetId, views); 32 | } 33 | 34 | @Override 35 | public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { 36 | // There may be multiple widgets active, so update all of them 37 | 38 | for (int appWidgetId : appWidgetIds) { 39 | updateAppWidget(context, appWidgetManager, appWidgetId); 40 | } 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchBatterySaverWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchBatterySaverActivity; 5 | 6 | /** 7 | * Implementation of SwitchBatterySaverWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchBatterySaverWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchBatterySaverWidget() { 14 | imgId = R.id.img_switch_battery_saver; 15 | layoutId = R.layout.app_widget_switch_battery_saver; 16 | myClass = SwitchBatterySaverActivity.class; 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchDarkModeWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchDarkModeActivity; 5 | 6 | /** 7 | * Implementation of SwitchDarkModeWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchDarkModeWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchDarkModeWidget() { 14 | imgId = R.id.img_switch_dark_mode; 15 | layoutId = R.layout.app_widget_switch_dark_mode; 16 | myClass = SwitchDarkModeActivity.class; 17 | } 18 | 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchForceDarkWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchForceDarkActivity; 5 | 6 | /** 7 | * Implementation of SwitchForceDarkWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchForceDarkWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchForceDarkWidget() { 14 | imgId = R.id.img_switch_force_dark; 15 | layoutId = R.layout.app_widget_switch_force_dark; 16 | myClass = SwitchForceDarkActivity.class; 17 | } 18 | 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchGrayScaleWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchGrayScaleActivity; 5 | 6 | /** 7 | * Implementation of SwitchGrayScaleWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchGrayScaleWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchGrayScaleWidget() { 14 | imgId = R.id.img_switch_gray_scale; 15 | layoutId = R.layout.app_widget_switch_gray_scale; 16 | myClass = SwitchGrayScaleActivity.class; 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchInvertColorsWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchInvertColorsActivity; 5 | 6 | /** 7 | * Implementation of SwitchInvertColorsWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchInvertColorsWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchInvertColorsWidget() { 14 | imgId = R.id.img_switch_invert_colors; 15 | layoutId = R.layout.app_widget_switch_invert_colors; 16 | myClass = SwitchInvertColorsActivity.class; 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/receiver/widgets/SwitchNightDisplayWidget.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.receiver.widgets; 2 | 3 | import com.modosa.switchnightui.R; 4 | import com.modosa.switchnightui.activity.SwitchNightDisplayActivity; 5 | 6 | /** 7 | * Implementation of SwitchNightDisplayWidget functionality. 8 | * 9 | * @author dadaewq 10 | */ 11 | public class SwitchNightDisplayWidget extends AbstractSwitchWidget { 12 | 13 | public SwitchNightDisplayWidget() { 14 | imgId = R.id.img_switch_night_display; 15 | layoutId = R.layout.app_widget_switch_night_display; 16 | myClass = SwitchNightDisplayActivity.class; 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/NotificationService.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | 7 | import androidx.annotation.Nullable; 8 | 9 | import com.modosa.switchnightui.R; 10 | import com.modosa.switchnightui.util.OpUtil; 11 | 12 | public class NotificationService extends Service { 13 | 14 | @Override 15 | public int onStartCommand(Intent intent, int flags, int startId) { 16 | startForegroundService(); 17 | return START_STICKY; 18 | } 19 | 20 | @Override 21 | public void onDestroy() { 22 | stopForeground(true); 23 | super.onDestroy(); 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public IBinder onBind(Intent intent) { 29 | return null; 30 | } 31 | 32 | private void startForegroundService() { 33 | try { 34 | startForeground(R.string.title_permanent_notification, OpUtil.getPermanentNotification(this)); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/AbstractSwitchDisplayTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | import android.service.quicksettings.Tile; 5 | import android.service.quicksettings.TileService; 6 | 7 | import androidx.annotation.RequiresApi; 8 | 9 | import com.modosa.switchnightui.util.OpUtil; 10 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 11 | 12 | /** 13 | * @author dadaewq 14 | */ 15 | @RequiresApi(api = Build.VERSION_CODES.N) 16 | public abstract class AbstractSwitchDisplayTile extends TileService { 17 | String key; 18 | int shortcutLongLabelId; 19 | private SwitchDisplayUtil switchDisplayUtil; 20 | 21 | @Override 22 | public void onStartListening() { 23 | super.onStartListening(); 24 | refreshState(); 25 | } 26 | 27 | @Override 28 | public void onClick() { 29 | super.onClick(); 30 | switchMethod(); 31 | refreshState(); 32 | } 33 | 34 | private void switchMethod() { 35 | refreshUtil(); 36 | switchDisplayUtil.switchDisplayKeyWithResult(key, getString(shortcutLongLabelId)); 37 | } 38 | 39 | private void refreshState() { 40 | refreshUtil(); 41 | Tile qsTile = getQsTile(); 42 | try { 43 | if (isShouldActive()) { 44 | qsTile.setState(Tile.STATE_ACTIVE); 45 | } else { 46 | qsTile.setState(Tile.STATE_INACTIVE); 47 | } 48 | qsTile.updateTile(); 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | OpUtil.showToast0(this, e + ""); 52 | } 53 | 54 | } 55 | 56 | private void refreshUtil() { 57 | if (switchDisplayUtil == null) { 58 | switchDisplayUtil = new SwitchDisplayUtil(this); 59 | } 60 | } 61 | 62 | private boolean isShouldActive() { 63 | return switchDisplayUtil.isDisplayKeyEnabled(key); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchBatterySaverTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | import android.service.quicksettings.Tile; 5 | import android.service.quicksettings.TileService; 6 | 7 | import androidx.annotation.RequiresApi; 8 | 9 | import com.modosa.switchnightui.R; 10 | import com.modosa.switchnightui.util.OpUtil; 11 | import com.modosa.switchnightui.util.SwitchBatterySaverUtil; 12 | 13 | /** 14 | * @author dadaewq 15 | */ 16 | @RequiresApi(api = Build.VERSION_CODES.N) 17 | public class SwitchBatterySaverTile extends TileService { 18 | 19 | private SwitchBatterySaverUtil switchBatterySaverUtil; 20 | 21 | @Override 22 | public void onStartListening() { 23 | super.onStartListening(); 24 | refreshState(); 25 | } 26 | 27 | @Override 28 | public void onClick() { 29 | super.onClick(); 30 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 31 | switchForceDark(); 32 | refreshState(); 33 | } else { 34 | OpUtil.showTipNeedSdk(this, R.string.title_battery_saver, "5.0"); 35 | } 36 | } 37 | 38 | private void switchForceDark() { 39 | refreshUtil(); 40 | switchBatterySaverUtil.switchBatterySaverWithResult(); 41 | } 42 | 43 | private void refreshState() { 44 | refreshUtil(); 45 | Tile qsTile = getQsTile(); 46 | try { 47 | if (switchBatterySaverUtil.isPowerSaveMode()) { 48 | qsTile.setState(Tile.STATE_ACTIVE); 49 | } else { 50 | qsTile.setState(Tile.STATE_INACTIVE); 51 | } 52 | qsTile.updateTile(); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | OpUtil.showToast0(this, e + ""); 56 | } 57 | 58 | } 59 | 60 | private void refreshUtil() { 61 | if (switchBatterySaverUtil == null) { 62 | switchBatterySaverUtil = new SwitchBatterySaverUtil(this); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchDarkModeTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.content.res.Configuration; 4 | import android.os.Build; 5 | import android.service.quicksettings.Tile; 6 | import android.service.quicksettings.TileService; 7 | 8 | import androidx.annotation.RequiresApi; 9 | 10 | import com.modosa.switchnightui.R; 11 | import com.modosa.switchnightui.util.OpUtil; 12 | import com.modosa.switchnightui.util.SpUtil; 13 | import com.modosa.switchnightui.util.SwitchBatterySaverUtil; 14 | import com.modosa.switchnightui.util.SwitchDarkModeUtil; 15 | import com.modosa.switchnightui.util.WriteSettingsUtil; 16 | 17 | /** 18 | * @author dadaewq 19 | */ 20 | @RequiresApi(api = Build.VERSION_CODES.N) 21 | public class SwitchDarkModeTile extends TileService { 22 | 23 | private SwitchDarkModeUtil switchDarkModeUtil; 24 | private SwitchBatterySaverUtil switchBatterySaverUtil; 25 | private boolean enable; 26 | private boolean isClick = false; 27 | 28 | @Override 29 | public void onStartListening() { 30 | super.onStartListening(); 31 | refreshState(); 32 | } 33 | 34 | @Override 35 | public void onClick() { 36 | super.onClick(); 37 | isClick = true; 38 | switchDarkMode(); 39 | refreshState(); 40 | } 41 | 42 | private void switchDarkMode() { 43 | refreshUtil(); 44 | if (new SpUtil(this).getWorkMode() == 2) { 45 | enable = !WriteSettingsUtil.isNightMode(this); 46 | } else { 47 | enable = !switchDarkModeUtil.isDarkMode(); 48 | } 49 | switchDarkModeUtil.setDarkModeWithResult(enable); 50 | } 51 | 52 | private void refreshState() { 53 | refreshUtil(); 54 | Tile qsTile = getQsTile(); 55 | try { 56 | if (switchDarkModeUtil.isDarkMode()) { 57 | qsTile.setState(Tile.STATE_ACTIVE); 58 | } else { 59 | qsTile.setState(Tile.STATE_INACTIVE); 60 | } 61 | if (switchBatterySaverUtil.isPowerSaveMode()) { 62 | qsTile.setLabel(getString(R.string.title_dark_mode) + "*"); 63 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 64 | qsTile.setSubtitle(getString(R.string.title_battery_saver)); 65 | } 66 | } else { 67 | qsTile.setLabel(getString(R.string.title_dark_mode)); 68 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 69 | qsTile.setSubtitle(null); 70 | } 71 | } 72 | qsTile.updateTile(); 73 | } catch (Exception e) { 74 | e.printStackTrace(); 75 | OpUtil.showToast0(this, e + ""); 76 | } 77 | 78 | } 79 | 80 | private void refreshUtil() { 81 | if (switchDarkModeUtil == null) { 82 | switchDarkModeUtil = new SwitchDarkModeUtil(this); 83 | } 84 | if (switchBatterySaverUtil == null) { 85 | switchBatterySaverUtil = new SwitchBatterySaverUtil(this); 86 | } 87 | } 88 | 89 | @Override 90 | public void onConfigurationChanged(Configuration newConfig) { 91 | super.onConfigurationChanged(newConfig); 92 | 93 | if (isClick && new SpUtil(this).isStableMode()) { 94 | new SwitchDarkModeUtil(this).setDarkModeWithResult(enable); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchForceDarkTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | import android.service.quicksettings.Tile; 5 | import android.service.quicksettings.TileService; 6 | 7 | import androidx.annotation.RequiresApi; 8 | 9 | import com.modosa.switchnightui.R; 10 | import com.modosa.switchnightui.util.OpUtil; 11 | import com.modosa.switchnightui.util.SwitchForceDarkUtil; 12 | 13 | 14 | /** 15 | * @author dadaewq 16 | */ 17 | @RequiresApi(api = Build.VERSION_CODES.N) 18 | public class SwitchForceDarkTile extends TileService { 19 | 20 | private SwitchForceDarkUtil switchForceDarkUtil; 21 | 22 | 23 | @Override 24 | public void onStartListening() { 25 | super.onStartListening(); 26 | refreshState(); 27 | } 28 | 29 | @Override 30 | public void onClick() { 31 | super.onClick(); 32 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 33 | switchForceDark(); 34 | refreshState(); 35 | } else { 36 | OpUtil.showTipNeedSdk(this, R.string.title_force_dark, "10"); 37 | } 38 | } 39 | 40 | private void switchForceDark() { 41 | refreshUtil(); 42 | switchForceDarkUtil.switchForceDark(); 43 | } 44 | 45 | private void refreshState() { 46 | refreshUtil(); 47 | Tile qsTile = getQsTile(); 48 | try { 49 | if (switchForceDarkUtil.isForceDark()) { 50 | qsTile.setState(Tile.STATE_ACTIVE); 51 | } else { 52 | qsTile.setState(Tile.STATE_INACTIVE); 53 | } 54 | qsTile.updateTile(); 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | OpUtil.showToast0(this, e + ""); 58 | } 59 | 60 | } 61 | 62 | private void refreshUtil() { 63 | if (switchForceDarkUtil == null) { 64 | switchForceDarkUtil = new SwitchForceDarkUtil(this); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchGrayScaleTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | 5 | import androidx.annotation.RequiresApi; 6 | 7 | import com.modosa.switchnightui.R; 8 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 9 | 10 | 11 | /** 12 | * @author dadaewq 13 | */ 14 | @RequiresApi(api = Build.VERSION_CODES.N) 15 | public class SwitchGrayScaleTile extends AbstractSwitchDisplayTile { 16 | 17 | public SwitchGrayScaleTile() { 18 | key = SwitchDisplayUtil.GRAYSCALE; 19 | shortcutLongLabelId = R.string.title_gray_scale; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchInvertColorsTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | 5 | import androidx.annotation.RequiresApi; 6 | 7 | import com.modosa.switchnightui.R; 8 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 9 | 10 | /** 11 | * @author dadaewq 12 | */ 13 | @RequiresApi(api = Build.VERSION_CODES.N) 14 | public class SwitchInvertColorsTile extends AbstractSwitchDisplayTile { 15 | 16 | public SwitchInvertColorsTile() { 17 | key = SwitchDisplayUtil.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED; 18 | shortcutLongLabelId = R.string.title_invert_colors; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/service/tiles/SwitchNightDisplayTile.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.service.tiles; 2 | 3 | import android.os.Build; 4 | 5 | import androidx.annotation.RequiresApi; 6 | 7 | import com.modosa.switchnightui.R; 8 | import com.modosa.switchnightui.util.OpUtil; 9 | import com.modosa.switchnightui.util.SwitchDisplayUtil; 10 | 11 | /** 12 | * @author dadaewq 13 | */ 14 | @RequiresApi(api = Build.VERSION_CODES.N) 15 | public class SwitchNightDisplayTile extends AbstractSwitchDisplayTile { 16 | 17 | public SwitchNightDisplayTile() { 18 | key = SwitchDisplayUtil.NIGHT_DISPLAY_ACTIVATED; 19 | shortcutLongLabelId = R.string.title_night_display; 20 | } 21 | 22 | @Override 23 | public void onClick() { 24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { 25 | super.onClick(); 26 | } else { 27 | OpUtil.showTipNeedSdk(this, R.string.title_night_display, "7.1"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/AppInfoUtil.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import android.content.Context; 4 | import android.content.pm.ApplicationInfo; 5 | import android.content.pm.PackageInfo; 6 | import android.content.pm.PackageManager; 7 | import android.os.Build; 8 | 9 | /** 10 | * @author dadaewq 11 | */ 12 | public final class AppInfoUtil { 13 | 14 | public static String getAppVersion(Context context, String pkgName) { 15 | PackageManager pm = context.getPackageManager(); 16 | ApplicationInfo applicationInfo = null; 17 | try { 18 | applicationInfo = pm.getApplicationInfo(pkgName, 0); 19 | } catch (Exception ignore) { 20 | } 21 | 22 | if (applicationInfo != null) { 23 | return getApkVersion(context, applicationInfo.sourceDir)[0]; 24 | } 25 | return null; 26 | } 27 | 28 | public static String getAppVersions(Context context, String pkgName) { 29 | PackageManager pm = context.getPackageManager(); 30 | ApplicationInfo applicationInfo = null; 31 | try { 32 | applicationInfo = pm.getApplicationInfo(pkgName, 0); 33 | } catch (Exception ignore) { 34 | } 35 | 36 | if (applicationInfo != null) { 37 | return getApkVersion(context, applicationInfo.sourceDir)[0] + 38 | "_" + 39 | getApkVersion(context, applicationInfo.sourceDir)[1]; 40 | } 41 | return null; 42 | } 43 | 44 | // private static String getApkVersion(Context context, String apkPath) { 45 | // PackageManager pm = context.getPackageManager(); 46 | // PackageInfo pkgInfo = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); 47 | // 48 | // if (pkgInfo != null) { 49 | // pkgInfo.applicationInfo.sourceDir = apkPath; 50 | // pkgInfo.applicationInfo.publicSourceDir = apkPath; 51 | // 52 | // return new StringBuilder().append(pkgInfo.versionName).append("_").append(Build.VERSION.SDK_INT < Build.VERSION_CODES.P ? Integer.toString(pkgInfo.versionCode) : Long.toString(pkgInfo.getLongVersionCode())).toString(); 53 | // } else { 54 | // return null; 55 | // } 56 | // } 57 | 58 | private static String[] getApkVersion(Context context, String apkPath) { 59 | PackageManager pm = context.getPackageManager(); 60 | PackageInfo pkgInfo = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); 61 | 62 | if (pkgInfo != null) { 63 | pkgInfo.applicationInfo.sourceDir = apkPath; 64 | pkgInfo.applicationInfo.publicSourceDir = apkPath; 65 | 66 | return new String[]{pkgInfo.versionName, 67 | Build.VERSION.SDK_INT < Build.VERSION_CODES.P ? Integer.toString(pkgInfo.versionCode) : Long.toString(pkgInfo.getLongVersionCode()) 68 | }; 69 | } else { 70 | return null; 71 | } 72 | } 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import com.modosa.switchnightui.BuildConfig; 4 | 5 | public class Constants { 6 | public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".preferences"; 7 | public static final String PREF_FILE = BuildConfig.APPLICATION_ID + "_preferences"; 8 | public static final String PACKAGE_NAME_COOLAPK = "com.coolapk.market"; 9 | public static final String PACKAGE_NAME_DINGTALK = "com.alibaba.android.rimet"; 10 | public static final String PACKAGE_NAME_DINGTALK_GLOBAL = "com.alibaba.dingtalk.global"; 11 | public static final String PACKAGE_NAME_MOBILEQQ = "com.tencent.mobileqq"; 12 | public static final String PACKAGE_NAME_WECHAT = "com.tencent.mm"; 13 | public static final String PACKAGE_NAME_FLYTEK_INPUTMETHOD = "com.iflytek.inputmethod"; 14 | public static final String PACKAGE_NAME_CAIJ_SEE = "com.caij.see"; 15 | public static final String PACKAGE_NAME_GBOARD = "com.google.android.inputmethod.latin"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/MyTimePickerDialog.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import android.app.AlertDialog; 4 | import android.app.TimePickerDialog; 5 | import android.content.Context; 6 | import android.content.res.Resources; 7 | 8 | import com.modosa.switchnightui.R; 9 | 10 | 11 | public class MyTimePickerDialog extends TimePickerDialog { 12 | public MyTimePickerDialog(Context context, OnTimeSetListener listener, int hourOfDay, int minute, boolean is24HourView) { 13 | super(context, listener, hourOfDay, minute, is24HourView); 14 | } 15 | 16 | @Override 17 | public void show() { 18 | super.show(); 19 | try { 20 | getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(getContext().getResources().getColor(R.color.rBackground)); 21 | getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(getContext().getResources().getColor(R.color.rBackground)); 22 | } catch (Resources.NotFoundException e) { 23 | e.printStackTrace(); 24 | } catch (Exception e2) { 25 | e2.printStackTrace(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/ResultMsg.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | /** 4 | * @author dadaewq 5 | */ 6 | class ResultMsg { 7 | private boolean success = false; 8 | private String msg; 9 | 10 | boolean isSuccess() { 11 | return success; 12 | } 13 | 14 | void setSuccess() { 15 | this.success = true; 16 | } 17 | 18 | String getMsg() { 19 | return msg; 20 | } 21 | 22 | void setMsg(String msg) { 23 | this.msg = msg; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/SpUtil.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import androidx.preference.PreferenceManager; 7 | 8 | /** 9 | * @author dadaewq 10 | */ 11 | public class SpUtil { 12 | private final SharedPreferences sharedPreferences; 13 | private SharedPreferences.Editor editor; 14 | 15 | public SpUtil(Context context) { 16 | // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 17 | // sharedPreferences = context.createDeviceProtectedStorageContext().getSharedPreferences(BuildConfig.APPLICATION_ID + "_preferences", Context.MODE_PRIVATE); 18 | // } else { 19 | sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 20 | // } 21 | } 22 | 23 | private SharedPreferences.Editor getEditor() { 24 | if (editor == null) { 25 | editor = sharedPreferences.edit(); 26 | } 27 | return editor; 28 | } 29 | 30 | public int getWorkMode() { 31 | return sharedPreferences.getInt("method", -1); 32 | } 33 | 34 | public void putWorkMode(int checked) { 35 | getEditor().putInt("method", checked).apply(); 36 | } 37 | 38 | public boolean isStableMode() { 39 | String stablemode = "stablemode"; 40 | return sharedPreferences.getBoolean(stablemode, false); 41 | } 42 | 43 | public boolean getBoolean(String key, boolean defValue) { 44 | return sharedPreferences.getBoolean(key, defValue); 45 | } 46 | 47 | public boolean getFalseBoolean(String key) { 48 | return sharedPreferences.getBoolean(key, false); 49 | } 50 | 51 | void putBoolean(String key, boolean value) { 52 | getEditor().putBoolean(key, value).apply(); 53 | } 54 | 55 | public String getString(String key) { 56 | return sharedPreferences.getString(key, null); 57 | } 58 | 59 | public void putString(String key, String value) { 60 | getEditor().putString(key, value).apply(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/SwitchForceDarkUtil.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import android.content.Context; 4 | 5 | import com.modosa.switchnightui.R; 6 | import com.modosa.switchnightui.util.oneplus.OpSwitchForceDarkUtil; 7 | 8 | /** 9 | * @author dadaewq 10 | */ 11 | public class SwitchForceDarkUtil { 12 | private static final String CMD_GET_FORCE_DARK = "getprop debug.hwui.force_dark"; 13 | private static final String CMD_SET_FORCE_DARK = "setprop debug.hwui.force_dark "; 14 | private final Context context; 15 | private final boolean isOneplus; 16 | 17 | 18 | public SwitchForceDarkUtil(Context context) { 19 | this.context = context; 20 | isOneplus = OpSwitchForceDarkUtil.isOnePlus(context); 21 | } 22 | 23 | public boolean isForceDark() { 24 | if (isOneplus) { 25 | return OpSwitchForceDarkUtil.isOnePlusForceDark(context); 26 | } else { 27 | String[] result = ShellUtil.exec(CMD_GET_FORCE_DARK, false); 28 | return Boolean.parseBoolean(result[0]); 29 | } 30 | 31 | } 32 | 33 | public void setForceDark(int forceDark) { 34 | if (forceDark == 22) { 35 | setForceDark(true); 36 | } else if (forceDark == 11) { 37 | setForceDark(false); 38 | } 39 | } 40 | 41 | /** 42 | * Set Force Dark 43 | * 44 | * @param enable is enable force dark 45 | */ 46 | private void setForceDark(boolean enable) { 47 | String msg = ""; 48 | boolean isSu, isForceDark; 49 | if (isOneplus) { 50 | OpSwitchForceDarkUtil opSwitchForceDarkUtil = new OpSwitchForceDarkUtil(context); 51 | isSu = opSwitchForceDarkUtil.setForceDark(enable); 52 | //也加入普通的切换,增加覆盖 53 | setNormalForceDark(enable); 54 | 55 | isForceDark = opSwitchForceDarkUtil.isForceDark(); 56 | } else { 57 | isSu = setNormalForceDark(enable); 58 | 59 | isForceDark = isForceDark(); 60 | } 61 | if (!isSu) { 62 | msg = context.getString(R.string.no_root) + "\n"; 63 | } 64 | 65 | if (isForceDark) { 66 | OpUtil.showToast0(context, msg + context.getString(R.string.tip_on_force_dark)); 67 | } else { 68 | OpUtil.showToast0(context, msg + context.getString(R.string.tip_off_force_dark)); 69 | } 70 | 71 | } 72 | 73 | public void switchForceDark() { 74 | setForceDark(!isForceDark()); 75 | } 76 | 77 | private boolean setNormalForceDark(boolean enable) { 78 | String[] checkRoot = ShellUtil.execWithRoot("exit"); 79 | 80 | if ("0".equals(checkRoot[3])) { 81 | ShellUtil.execWithRoot(CMD_SET_FORCE_DARK + enable); 82 | return true; 83 | 84 | } else { 85 | ShellUtil.exec(CMD_SET_FORCE_DARK + enable, false); 86 | return false; 87 | } 88 | 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/WriteSettingsUtil.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.provider.Settings; 6 | 7 | import com.modosa.switchnightui.R; 8 | 9 | /** 10 | * WriteSettings 工具类 11 | * 12 | * @author dadaewq 13 | */ 14 | public class WriteSettingsUtil { 15 | private static final String KEY_NIGHT_MODE = "ui_night_mode"; 16 | 17 | /** 18 | * need permission {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}, 19 | */ 20 | 21 | public static boolean isNightMode(Context context) { 22 | int mNightMode = -1; 23 | 24 | try { 25 | mNightMode = Settings.Secure.getInt(context.getContentResolver(), 26 | WriteSettingsUtil.KEY_NIGHT_MODE, -1); 27 | } catch (Exception e) { 28 | e.printStackTrace(); 29 | } 30 | return (2 == mNightMode); 31 | 32 | } 33 | 34 | 35 | static ResultMsg putKey(Context context, int nightmode) { 36 | ResultMsg resultMsg = new ResultMsg(); 37 | String msg = null; 38 | try { 39 | if (Settings.Secure.putInt(context.getContentResolver(), KEY_NIGHT_MODE, nightmode)) { 40 | resultMsg.setSuccess(); 41 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { 42 | msg = String.format(context.getString(R.string.yes2old), 43 | nightmode == 2 ? context.getString(R.string.on) : context.getString(R.string.off)); 44 | } else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { 45 | msg = String.format(context.getString(R.string.yes2), 46 | nightmode == 2 ? context.getString(R.string.on) : context.getString(R.string.off)); 47 | } 48 | } else { 49 | msg = String.format(context.getString(R.string.failworkmode), context.getString(R.string.WorkMode2)); 50 | } 51 | 52 | } catch (Exception e) { 53 | msg = String.format(context.getString(R.string.error), "\n\n" + e); 54 | } 55 | resultMsg.setMsg(msg); 56 | return resultMsg; 57 | } 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/oneplus/OpSwitchDarkModeUtil.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util.oneplus; 2 | 3 | import static com.modosa.switchnightui.util.OpUtil.BLANK; 4 | 5 | import android.content.Context; 6 | 7 | import com.modosa.switchnightui.util.ShellUtil; 8 | import com.modosa.switchnightui.util.SpUtil; 9 | 10 | import java.util.ArrayList; 11 | import java.util.HashMap; 12 | import java.util.List; 13 | 14 | /** 15 | * @author dadaewq 16 | */ 17 | public class OpSwitchDarkModeUtil { 18 | private final Context context; 19 | 20 | public OpSwitchDarkModeUtil(Context context) { 21 | this.context = context; 22 | } 23 | 24 | public void setDarkMode(boolean enable) { 25 | List cmds; 26 | int theme = 0; 27 | if (enable) { 28 | theme = 1; 29 | } else if (new SpUtil(context).getFalseBoolean("oneplus_use_colorful_theme")) { 30 | theme = 2; 31 | } 32 | cmds = getOneplusCommands(theme); 33 | ShellUtil.execWithRoot(cmds); 34 | enableThemes(theme); 35 | } 36 | 37 | private List getOneplusCommands(int theme) { 38 | switch (theme) { 39 | case 1: 40 | return getOneplusCommands(1, 2); 41 | case 2: 42 | return getOneplusCommands(2, 1); 43 | default: 44 | return getOneplusCommands(0, 1); 45 | } 46 | } 47 | 48 | private List getOneplusCommands(int parm1, int parm2) { 49 | String cmd; 50 | List cmds = new ArrayList<>(); 51 | cmd = OPThemeUtils.CMD_SETTINGS_PUT_SYSTEM + OPThemeUtils.KEY_DARK_MODE_ACTION + BLANK + parm1; 52 | cmds.add(cmd); 53 | 54 | cmd = OPThemeUtils.CMD_SETTINGS_PUT_SYSTEM + OPThemeUtils.KEY_ORIGIN_DARK_MODE_ACTION + BLANK + parm1; 55 | cmds.add(cmd); 56 | 57 | cmd = OpSwitchForceDarkUtil.CMD_SETPROP_THEME + parm2; 58 | cmds.add(cmd); 59 | 60 | cmd = OPThemeUtils.CMD_SETPROP_THEME_STATUS + parm1; 61 | cmds.add(cmd); 62 | 63 | return cmds; 64 | } 65 | 66 | private void enableThemes(int theme) { 67 | OpTheme opTheme = new OpTheme(context); 68 | HashMap map = new HashMap<>(); 69 | switch (theme) { 70 | case 1: 71 | map.clear(); 72 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_WHITE); 73 | opTheme.disableTheme(map); 74 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_BLCAK); 75 | opTheme.enableTheme(map); 76 | break; 77 | case 2: 78 | map.clear(); 79 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_WHITE); 80 | opTheme.disableTheme(map); 81 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_BLCAK); 82 | opTheme.disableTheme(map); 83 | break; 84 | default: 85 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_BLCAK); 86 | opTheme.disableTheme(map); 87 | map.clear(); 88 | map.put(OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR, OPThemeUtils.OP_CUSTOMIZATION_THEME_ONEPLUS_BASICCOLOR_WHITE); 89 | opTheme.enableTheme(map); 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/modosa/switchnightui/util/oneplus/OpTheme.java: -------------------------------------------------------------------------------- 1 | package com.modosa.switchnightui.util.oneplus; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.util.Log; 6 | 7 | import java.util.HashMap; 8 | 9 | class OpTheme { 10 | 11 | private final Context mContext; 12 | 13 | OpTheme(Context context) { 14 | this.mContext = context; 15 | } 16 | 17 | void enableTheme(HashMap categoryMap) { 18 | try { 19 | Intent intent = new Intent("android.settings.oneplus_theme_enable"); 20 | intent.putExtra("category_map", categoryMap); 21 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 22 | this.mContext.sendBroadcast(intent); 23 | } catch (Exception e) { 24 | Log.e("OpTheme", "Exception " + e); 25 | } 26 | } 27 | 28 | void disableTheme(HashMap categoryMap) { 29 | try { 30 | Intent intent = new Intent("android.settings.oneplus_theme_disable"); 31 | intent.putExtra("category_map", categoryMap); 32 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 33 | this.mContext.sendBroadcast(intent); 34 | } catch (Exception e) { 35 | Log.e("OpTheme", "Exception " + e); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_about.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_battery_saver.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_carmode.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_excludefromrecents.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_gray_scale.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_help.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_instructions_before_use.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_invert_colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_night_display.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_oneplus.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_permanent_notification.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_stablemode.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-night/ic_daynight_timeup.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/alertdialog_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/avatar_dadaewq_circle_middle.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_about.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_battery_saver.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_carmode.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_excludefromrecents.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_gray_scale.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_help.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_instructions_before_use.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_invert_colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_night_display.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_oneplus.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_permanent_notification.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_stablemode.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daynight_timeup.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_battery_saver_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_dark_mode_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_force_dark_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_gray_scale_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_invert_colors_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_night_display_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_passed.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qq.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_battery_saver.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_dark_mode.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_force_dark.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_gray_scale.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_invert_colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_qs_night_display.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rate.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_update.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_url.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_warnning.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_wechat.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 17 | 18 |