├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── xiangteng
│ │ └── xposed
│ │ └── forcewechatdarkmode
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── xposed_init
│ ├── java
│ │ └── com
│ │ │ └── xiangteng
│ │ │ └── xposed
│ │ │ └── forcewechatdarkmode
│ │ │ ├── Constants.java
│ │ │ ├── HookMain.java
│ │ │ ├── HookSelf.java
│ │ │ ├── MainActivity.java
│ │ │ ├── SettingsFragment.java
│ │ │ ├── WeChatDarkModePreferenceProvider.java
│ │ │ └── util
│ │ │ └── MyLog.java
│ └── res
│ │ ├── drawable
│ │ ├── ic_done.png
│ │ └── ic_launcher.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── values-zh-rCN
│ │ └── strings.xml
│ │ ├── values-zh-rTW
│ │ └── strings.xml
│ │ ├── values
│ │ └── strings.xml
│ │ └── xml
│ │ └── preferences.xml
│ └── test
│ └── java
│ └── com
│ └── xiangteng
│ └── xposed
│ └── forcewechatdarkmode
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | # release/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # IntelliJ
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/assetWizardSettings.xml
45 | .idea/dictionaries
46 | .idea/libraries
47 | # Android Studio 3 in .gitignore file.
48 | .idea/caches
49 | .idea/modules.xml
50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
51 | .idea/navEditor.xml
52 |
53 | # Keystore files
54 | # Uncomment the following lines if you do not want to check your keystore files in.
55 | #*.jks
56 | #*.keystore
57 |
58 | # External native build folder generated in Android Studio 2.2 and later
59 | .externalNativeBuild
60 | .cxx/
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 |
87 | .idea/
88 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ForceWechatDarkMode 开启微信深色主题/暗色主题/深色模式/暗色模式
2 |
3 | 微信曾短暂的推出过深色主题(大约在 7.0.10 版),很快又取消了,但其实后续的版本已内置了一套深色主题,只是没有提供开关。启用该模块后即可开启微信内置的深色主题。
4 |
5 | 需要系统支持深色主题。Android 10 全面支持,Android 9 和 8 部分系统支持。
6 |
7 | ## Bug 收集
8 |
9 | 各位用户烦请关注 Issue 列表,如发现相同的 Bug 请跟帖,发现新 Bug 请提交新 Issue。
10 |
11 | 提交 Issue 前请确保已经过测试:除待测试的模块外,关闭其余所有模块,确认问题仍存在。
12 |
13 | 提交 Issue 时请注明以下信息
14 | + 机型
15 | + 系统及 Android 版本(例如 H2OS Android 10)
16 | + 框架类型(EdXposed / 太极阴 / 太极阳 / rovo89 原版 Xposed 等)及版本
17 | + 微信详细版本(我-设置-关于微信-连续点击微信图标即可看到)以及是 Play 还是国内版
18 | + 视情况可能需要提供日志和提取的微信安装包
19 |
20 |
21 | ## 更新日志
22 |
23 | #### 2020.03.29
24 | + 代码重构,但核心代码不变
25 | + 改用 [RemotePreferences](https://github.com/apsun/RemotePreferences) 处理配置,可能解决了存储重定向带来的潜在问题
26 | + 感谢 [Palatis](https://github.com/Palatis) 的贡献(pull [#8](https://github.com/chouqibao/ForceWechatDarkMode/pull/8))
27 |
28 | #### 2020.03.05
29 | + 增加用户界面
30 | + 增加检测系统深色主题状态
31 | + 增加保持微信深色主题开关
32 | + 增加保存日志至文件选项(保存在 `/sdcard/Android/data/com.xiangteng.xposed.forcewechatdarkmode/log/`)
33 | + 删除针对特定微信版本的 hook(可能导致在相关版本上失效,如果有的话请报告)
34 |
35 | #### 2020.03.03 再次更改 hook 点
36 | 在微信读取配置(MMKV)时进行 hook,将深色主题打开。
37 |
38 | #### 2020.03.03 更改 hook 点
39 | 更改 hook 点后理论上能适配更多版本和机型,但仍不稳定。
40 |
41 | #### 2020.03.02 第一版
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /release
3 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion '30.0.0 rc2'
6 |
7 | defaultConfig {
8 | applicationId "com.xiangteng.xposed.forcewechatdarkmode"
9 | minSdkVersion 19
10 | targetSdkVersion 29
11 | versionCode 5
12 | versionName "2.3"
13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14 | }
15 |
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | compileOptions {
23 | sourceCompatibility = 1.8
24 | targetCompatibility = 1.8
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(dir: 'libs', include: ['*.jar'])
31 | implementation 'androidx.appcompat:appcompat:1.1.0'
32 | implementation "androidx.preference:preference:1.1.0"
33 | implementation 'com.google.android.material:material:1.1.0'
34 | implementation 'com.crossbowffs.remotepreferences:remotepreferences:0.7'
35 | compileOnly 'de.robv.android.xposed:api:82'
36 | compileOnly 'de.robv.android.xposed:api:82:sources'
37 | }
38 |
--------------------------------------------------------------------------------
/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 |
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/androidTest/java/com/xiangteng/xposed/forcewechatdarkmode/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.xiangteng.xposed.forcewechatdarkmode", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
46 |
47 |
50 |
53 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | com.xiangteng.xposed.forcewechatdarkmode.HookMain
2 | com.xiangteng.xposed.forcewechatdarkmode.HookSelf
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/Constants.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import android.os.Environment;
4 |
5 | public class Constants {
6 | public static final String LOG_TAG = "FWDM";
7 | public static final String TARGET_PACKAGE_NAME = "com.tencent.mm";
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/HookMain.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import android.content.res.Configuration;
6 | import android.content.res.Resources;
7 | import android.os.Build;
8 |
9 | import com.crossbowffs.remotepreferences.RemotePreferences;
10 | import com.xiangteng.xposed.forcewechatdarkmode.util.MyLog;
11 |
12 | import java.io.File;
13 |
14 | import de.robv.android.xposed.IXposedHookLoadPackage;
15 | import de.robv.android.xposed.XC_MethodHook;
16 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
17 |
18 | import static com.xiangteng.xposed.forcewechatdarkmode.Constants.LOG_TAG;
19 | import static com.xiangteng.xposed.forcewechatdarkmode.Constants.TARGET_PACKAGE_NAME;
20 | import static de.robv.android.xposed.XposedBridge.hookAllMethods;
21 | import static de.robv.android.xposed.XposedHelpers.callMethod;
22 | import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
23 | import static de.robv.android.xposed.XposedHelpers.findClass;
24 | import static de.robv.android.xposed.XposedHelpers.getIntField;
25 | import static de.robv.android.xposed.XposedHelpers.getObjectField;
26 |
27 | public class HookMain implements IXposedHookLoadPackage {
28 |
29 | private static boolean sEnhancedMode = false;
30 | private static boolean sVerboseLogging = false;
31 | private static boolean sWriteXposedLog = false;
32 |
33 | private static String getPackageVersion(XC_LoadPackage.LoadPackageParam lpparam) {
34 | try {
35 | Class> parserCls = findClass("android.content.pm.PackageParser", lpparam.classLoader);
36 | Object parser = parserCls.newInstance();
37 | File apkPath = new File(lpparam.appInfo.sourceDir);
38 | Object pkg = callMethod(parser, "parsePackage", apkPath, 0);
39 | String versionName = (String) getObjectField(pkg, "mVersionName");
40 | int versionCode = getIntField(pkg, "mVersionCode");
41 | return String.format("%s (%d)", versionName, versionCode);
42 | } catch (Throwable e) {
43 | return "(unknown)";
44 | }
45 | }
46 |
47 | @Override
48 | public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
49 | if (!(TARGET_PACKAGE_NAME.equals(lpparam.packageName) && TARGET_PACKAGE_NAME.equals(lpparam.processName)))
50 | return;
51 |
52 | try {
53 | findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() {
54 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
55 | final Context context = (Context) param.args[0];
56 | final RemotePreferences prefs = new RemotePreferences(context, BuildConfig.APPLICATION_ID + ".preferences", BuildConfig.APPLICATION_ID + "_preferences");
57 |
58 | sEnhancedMode = prefs.getBoolean("preference_enhanced_mode_key", false);
59 | sVerboseLogging = prefs.getBoolean("preference_verbose_logging_key", false);
60 | sWriteXposedLog = prefs.getBoolean("preference_write_xposed_log_key", false);
61 |
62 | MyLog.setXposedLog(sWriteXposedLog);
63 | MyLog.i(LOG_TAG, "WeChat v" + getPackageVersion(lpparam) + " found!");
64 | if (sVerboseLogging) {
65 | MyLog.d(LOG_TAG, " enhance_mode = " + sEnhancedMode);
66 | MyLog.d(LOG_TAG, " verbose_logging = " + sVerboseLogging);
67 | MyLog.d(LOG_TAG, " write_xposed_log = " + sWriteXposedLog);
68 | }
69 |
70 | final ClassLoader loader = context.getClassLoader();
71 |
72 | try {
73 | findAndHookMethod("com.tencent.mm.plugin.expt.d.b", loader, "b", String.class, String.class, boolean.class, boolean.class, new XC_MethodHook() {
74 | @Override
75 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
76 | String para0 = param.args[0].toString();
77 | if (sVerboseLogging)
78 | MyLog.d(LOG_TAG, String.format("com.tencent.mm.plugin.expt.d.b.b() called, para: %s, result: %s", para0, param.getResult().toString()));
79 | if (para0.equals("clicfg_dark_mode_brand_api")) {
80 | if (sVerboseLogging)
81 | MyLog.i(LOG_TAG, "com.tencent.mm.plugin.expt.d.b.b(\"clicfg_dark_mode_brand_api\") called.");
82 | param.setResult(Build.BRAND.toLowerCase() + "&" + Build.VERSION.SDK_INT);
83 | } else if (para0.equals("clicfg_dark_mode_unused_on")) {
84 | if (sVerboseLogging)
85 | MyLog.i(LOG_TAG, "com.tencent.mm.plugin.expt.d.b.b(\"clicfg_dark_mode_unused_on\") called.");
86 | param.setResult("1");
87 | }
88 | }
89 | });
90 | } catch (Throwable t) {
91 | MyLog.e(LOG_TAG, "Hook com.tencent.mm.plugin.expt.d.b.b() error.", t);
92 | }
93 |
94 | try {
95 | hookAllMethods(loader.loadClass("com.tencent.mmkv.MMKV"), "getBoolean", new XC_MethodHook() {
96 | @Override
97 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
98 | String para0 = param.args[0].toString();
99 | if (para0.equals("dark_mode_used") || para0.equals("dark_mode_follow_system")) {
100 | if (sVerboseLogging)
101 | MyLog.i(LOG_TAG, "com.tencent.mmkv.MMKV.getBoolean(\"" + para0 + "\") called.");
102 | param.setResult(true);
103 | }
104 | }
105 | });
106 | } catch (Throwable t) {
107 | MyLog.e(LOG_TAG, "Hook com.tencent.mmkv.MMKV.getBoolean() error.", t);
108 | }
109 |
110 | if (sEnhancedMode) {
111 | try {
112 | findAndHookMethod(Resources.class, "getConfiguration", new XC_MethodHook() {
113 | @Override
114 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
115 | Configuration configuration = (Configuration) param.getResult();
116 | if (sVerboseLogging)
117 | MyLog.i(LOG_TAG, "Resources.getConfiguration() called, uiMode: " + configuration.uiMode);
118 | configuration.uiMode = Configuration.UI_MODE_NIGHT_YES;
119 | }
120 | });
121 | } catch (Throwable t) {
122 | MyLog.e(LOG_TAG, "Hook Resources.getConfiguration() to set uiMode error.", t);
123 | }
124 | }
125 | }
126 | });
127 | } catch (Throwable t) {
128 | MyLog.e(LOG_TAG, "Hook attach() error.", t);
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/HookSelf.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import com.xiangteng.xposed.forcewechatdarkmode.util.MyLog;
4 |
5 | import de.robv.android.xposed.IXposedHookLoadPackage;
6 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
7 |
8 | import static com.xiangteng.xposed.forcewechatdarkmode.BuildConfig.APPLICATION_ID;
9 | import static com.xiangteng.xposed.forcewechatdarkmode.Constants.LOG_TAG;
10 | import static de.robv.android.xposed.XC_MethodReplacement.returnConstant;
11 | import static de.robv.android.xposed.XposedBridge.getXposedVersion;
12 | import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
13 |
14 | public class HookSelf implements IXposedHookLoadPackage {
15 |
16 | @Override
17 | public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
18 | if (!APPLICATION_ID.equals(lpparam.packageName))
19 | return;
20 |
21 | MyLog.d(LOG_TAG, "Hooking " + lpparam.packageName + ", ver = " + getXposedVersion());
22 | findAndHookMethod(SettingsFragment.class.getName(), lpparam.classLoader, "getActiveXposedVersion", returnConstant(getXposedVersion()));
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import android.content.DialogInterface;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.provider.Settings;
8 | import android.view.View;
9 | import android.widget.Toast;
10 |
11 | import com.google.android.material.floatingactionbutton.FloatingActionButton;
12 |
13 | import androidx.appcompat.app.AlertDialog;
14 | import androidx.appcompat.app.AppCompatActivity;
15 |
16 | public class MainActivity extends AppCompatActivity implements SettingsFragment.Callback {
17 |
18 | private FloatingActionButton mFab;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_main);
24 |
25 | getSupportFragmentManager()
26 | .beginTransaction()
27 | .replace(R.id.settings_container, new SettingsFragment())
28 | .commit();
29 |
30 | mFab = findViewById(R.id.fab);
31 | mFab.setOnClickListener((view) -> {
32 | mFab.hide();
33 | goToWechatSettingPage();
34 | });
35 | }
36 |
37 | @Override
38 | public void onPreferenceChanged(String key) {
39 | mFab.show();
40 | }
41 |
42 | private void goToWechatSettingPage() { // 打开系统设置的微信应用信息界面
43 | Toast.makeText(this, R.string.toast_kill_wechat, Toast.LENGTH_LONG).show();
44 | Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
45 | intent.setData(Uri.parse("package:com.tencent.mm"));
46 | startActivity(intent);
47 | }
48 |
49 | @Override
50 | public void onBackPressed() {
51 | if (mFab.getVisibility() == View.VISIBLE) { // 未保存就退出则给出提示
52 | new AlertDialog.Builder(this)
53 | .setMessage(R.string.msg_remind_not_stored)
54 | .setPositiveButton(android.R.string.ok, (dialog, which) -> MainActivity.super.onBackPressed())
55 | .setNegativeButton(android.R.string.cancel, (dialog, which) -> {
56 | }).show();
57 | } else
58 | super.onBackPressed();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/SettingsFragment.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import android.content.ComponentName;
4 | import android.content.pm.PackageManager;
5 | import android.content.res.Configuration;
6 | import android.os.Bundle;
7 |
8 | import com.xiangteng.xposed.forcewechatdarkmode.util.MyLog;
9 |
10 | import androidx.annotation.Keep;
11 | import androidx.preference.Preference;
12 | import androidx.preference.PreferenceFragmentCompat;
13 | import androidx.preference.SwitchPreference;
14 |
15 | import static com.xiangteng.xposed.forcewechatdarkmode.Constants.LOG_TAG;
16 |
17 | public class SettingsFragment extends PreferenceFragmentCompat {
18 |
19 | public interface Callback {
20 | void onPreferenceChanged(String key);
21 | }
22 |
23 | private Callback getCallback() {
24 | return (Callback) requireActivity();
25 | }
26 |
27 | @Keep
28 | public static Integer getActiveXposedVersion() {
29 | MyLog.d(LOG_TAG, "ForceWeChatDarkMode is not active!");
30 | return -1;
31 | }
32 |
33 | @Override
34 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
35 | setPreferencesFromResource(R.xml.preferences, rootKey);
36 |
37 | Preference xposed_version = findPreference("preference_xposed_version_key");
38 | Preference dark_mode_status = findPreference("preference_dark_mode_status_key");
39 | SwitchPreference hide_launcher_icon = findPreference("preference_hide_launcher_icon_key");
40 | SwitchPreference enhanced_mode = findPreference("preference_enhanced_mode_key");
41 | SwitchPreference verbose_logging = findPreference("preference_verbose_logging_key");
42 | SwitchPreference write_xposed_log = findPreference("preference_write_xposed_log_key");
43 |
44 | hide_launcher_icon.setOnPreferenceChangeListener((pref, newValue) -> {
45 | final PackageManager p = requireContext().getPackageManager();
46 | final ComponentName componentName = new ComponentName(requireContext(), BuildConfig.APPLICATION_ID + ".MainActivityLauncher");
47 | p.setComponentEnabledSetting(
48 | componentName,
49 | (boolean) newValue ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED : PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
50 | PackageManager.DONT_KILL_APP);
51 | return true;
52 | });
53 |
54 | final Preference.OnPreferenceChangeListener listener = (preference, newValue) -> {
55 | getCallback().onPreferenceChanged(preference.getKey());
56 | return true;
57 | };
58 |
59 | enhanced_mode.setOnPreferenceChangeListener(listener);
60 | verbose_logging.setOnPreferenceChangeListener(listener);
61 | write_xposed_log.setOnPreferenceChangeListener(listener);
62 |
63 | if (getActiveXposedVersion() == -1) {
64 | dark_mode_status.setEnabled(false);
65 | hide_launcher_icon.setEnabled(false);
66 | enhanced_mode.setEnabled(false);
67 | verbose_logging.setEnabled(false);
68 | write_xposed_log.setEnabled(false);
69 | } else {
70 | xposed_version.setTitle(getString(R.string.preference_xposed_version_title, getActiveXposedVersion()));
71 | }
72 | }
73 |
74 | @Override
75 | public void onResume() {
76 | super.onResume();
77 |
78 | Preference dark_mode_status = findPreference("preference_dark_mode_status_key");
79 | int ui_mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
80 | switch (ui_mode) {
81 | case Configuration.UI_MODE_NIGHT_YES:
82 | dark_mode_status.setTitle(R.string.preference_dark_mode_status_title_on);
83 | break;
84 | case Configuration.UI_MODE_NIGHT_NO:
85 | dark_mode_status.setTitle(R.string.preference_dark_mode_status_title_off);
86 | dark_mode_status.setSummary(R.string.prompt_when_dark_mode_off);
87 | break;
88 | default:
89 | dark_mode_status.setTitle(R.string.preference_dark_mode_status_title_unknown);
90 | dark_mode_status.setSummary(R.string.prompt_when_dark_mode_off);
91 | }
92 | }
93 |
94 | // @Override
95 | // public boolean onPreferenceChange(Preference preference, Object newValue) {
96 | // switch (preference.getKey()) {
97 | // case "preference_switch_enhanced_mode_key":
98 | // case "preference_write_xposed_log_key":
99 | //// mIsPrefChanged = true;
100 | // break;
101 | // case "preference_hide_launcher_icon_key":
102 | // boolean value = (boolean) newValue;
103 | // if (value) {
104 | //
105 | // } else {
106 | //
107 | // }
108 | // break;
109 | // }
110 | // return true;
111 | // }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/WeChatDarkModePreferenceProvider.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import com.crossbowffs.remotepreferences.RemotePreferenceProvider;
4 |
5 | public class WeChatDarkModePreferenceProvider extends RemotePreferenceProvider {
6 | public WeChatDarkModePreferenceProvider() {
7 | super(BuildConfig.APPLICATION_ID + ".preferences", new String[]{
8 | BuildConfig.APPLICATION_ID + "_preferences",
9 | });
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiangteng/xposed/forcewechatdarkmode/util/MyLog.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode.util;
2 |
3 | import android.util.Log;
4 |
5 | import androidx.annotation.NonNull;
6 | import androidx.annotation.Nullable;
7 | import de.robv.android.xposed.XposedBridge;
8 |
9 | import static android.util.Log.getStackTraceString;
10 |
11 | public class MyLog {
12 | private static boolean sWriteXposedLog = false;
13 |
14 | public static void setXposedLog(boolean write_xposed_log) {
15 | sWriteXposedLog = write_xposed_log;
16 | }
17 |
18 | public static void v(@Nullable String tag, @NonNull String msg) {
19 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg);
20 | else Log.v(tag, msg);
21 | }
22 |
23 | public static void v(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
24 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg + '\n' + getStackTraceString(tr));
25 | else Log.v(tag, msg, tr);
26 | }
27 |
28 | public static void d(@Nullable String tag, @NonNull String msg) {
29 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg);
30 | else Log.d(tag, msg);
31 | }
32 |
33 | public static void d(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
34 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg + '\n' + getStackTraceString(tr));
35 | else Log.d(tag, msg, tr);
36 | }
37 |
38 | public static void i(@Nullable String tag, @NonNull String msg) {
39 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg);
40 | else Log.i(tag, msg);
41 | }
42 |
43 | public static void i(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
44 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg + '\n' + getStackTraceString(tr));
45 | else Log.i(tag, msg, tr);
46 | }
47 |
48 | public static void w(@Nullable String tag, @NonNull String msg) {
49 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg);
50 | else Log.w(tag, msg);
51 | }
52 |
53 | public static void w(@Nullable String tag, @Nullable Throwable tr) {
54 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + getStackTraceString(tr));
55 | else Log.w(tag, tr);
56 | }
57 |
58 | public static void w(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
59 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg + '\n' + getStackTraceString(tr));
60 | else Log.w(tag, msg, tr);
61 | }
62 |
63 | public static void e(@Nullable String tag, @NonNull String msg) {
64 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg);
65 | else Log.e(tag, msg);
66 | }
67 |
68 | public static void e(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
69 | if (sWriteXposedLog) XposedBridge.log(tag + ": " + msg + '\n' + getStackTraceString(tr));
70 | else Log.e(tag, msg, tr);
71 | }
72 |
73 | public static void wtf(@Nullable String tag, String msg) {
74 | Log.w(tag, msg);
75 | }
76 |
77 | public static void wtf(@Nullable String tag, @Nullable Throwable tr) {
78 | Log.w(tag, tr);
79 | }
80 |
81 | public static void wtf(@Nullable String tag, @Nullable String msg, @Nullable Throwable tr) {
82 | Log.w(tag, msg, tr);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chouqibao/ForceWechatDarkMode/61d1bf3d03893f55e7e9a79dcf4eea7809f9f31d/app/src/main/res/drawable/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 强制深色微信
5 | 强制开启微信深色主题
6 |
7 | 强行停止微信并重启后生效
8 | 设置尚未保存(点击右下角悬浮按钮保存),确定退出?
9 |
10 | 深色主题
11 |
12 | Xposed 框架
13 | Xposed 模块未生效!
14 | 版本:%d
15 |
16 | 系统深色主题状态:开
17 | 系统深色主题状态:关
18 | 系统深色主题状态:未知
19 | 当前系统不支持深色主题或未打开。若为前者,可试试增强模式,还不行的话可尝试使用《深色模式切换》(可在酷安找到)等软件。
20 |
21 | 增强模式(试验性)
22 | 总是使用深色模式,重启微信后生效。
23 | 跟随系统主题状态,重启微信后生效。
24 |
25 | 隐藏启动器图标
26 | 你还是可以从 Xposed Installer 或应用程序资讯页中进入本页
27 | 在启动器中显示图标
28 |
29 | 调试信息
30 |
31 | 详细日志
32 | 记录更详细的调试日志
33 |
34 | 使用 Xposed 日志
35 | 使用 XposedBridge.log() 记录日志(使用 Xposed Installer 读取)
36 | 闭嘴,别吵!
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rTW/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 強制暗黑微信
5 | 強迫微信使用深色主題。
6 |
7 | Xposed 框架
8 | Xposed 模組未生效!
9 | 版本:%d
10 |
11 | 強制停止微信並重新啟動後生效
12 | 設定尚未保存(點擊右下角浮動按鈕保存),確定要退出嗎?
13 |
14 | 暗黑模式
15 |
16 | 系統深色主題狀態:開
17 | 系統深色主題狀態:關
18 | 系統深色主題狀態:未知
19 | 目前系統不支援深色模式,試試增強模式吧!
20 |
21 | 增強模式(實驗性)
22 | 總是使用深色模式,重新啟動微信後生效。
23 | 跟隨系統主題狀態,重新啟動微信後生效。
24 |
25 | 隱藏啟動器圖示
26 | 您還是可以從 Xposed Installer 或應用程式資訊頁中進入本頁
27 | 在啟動器中顯示圖示
28 |
29 | 除錯訊息
30 |
31 | 詳細記錄
32 | 記錄更詳細的除錯訊息
33 |
34 | 使用 Xposed 記錄
35 | 使用 XposedBridge.log() 記錄除錯訊息(使用 Xposed Installer 讀取)
36 | 閉嘴,別吵!
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Force WeChat Dark Mode
5 | Force enable WeChat Dark Mode.
6 |
7 | Xposed Framework
8 | Xposed module inactive!
9 | Version: %d
10 |
11 | Force-stop WeChat and restart to apply
12 | Settings are not saved (click on the floating button at the right bottom corner to save), exit?
13 |
14 | Dark Mode
15 |
16 | System Dark Mode: On
17 | System Dark Mode: Off
18 | System Dark Mode: Unknown
19 | Dark Mode not enabled or unsupported. Try \"Enhanced Mode\" if unsupported.
20 |
21 | Enhanced Mode (Experimental)
22 | Always apply Dark Mode, restart WeChat to take effect.
23 | Follow system Dark Mode settings, restart WeChat to take effect.
24 |
25 | Hide launcher icon
26 | Enter this page through Xposed Installer or Application Detail page
27 | Display icon in launcher
28 |
29 | Debugging
30 |
31 | Verbose logging
32 | Log more diagnostic messages
33 |
34 | Log to Xposed
35 | Log with XposedBridge.log() (Read them with Xposed Installer)
36 | Stay silent
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
16 |
17 |
23 |
24 |
30 |
31 |
32 |
33 |
34 |
39 |
40 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/test/java/com/xiangteng/xposed/forcewechatdarkmode/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.xiangteng.xposed.forcewechatdarkmode;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 |
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.6.1'
12 |
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 |
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chouqibao/ForceWechatDarkMode/61d1bf3d03893f55e7e9a79dcf4eea7809f9f31d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Feb 29 21:19:58 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='强制开启微信深色主题'
2 | include ':app'
3 |
--------------------------------------------------------------------------------