├── app
├── .gitignore
├── src
│ └── main
│ │ ├── assets
│ │ ├── xposed_init
│ │ └── license.html
│ │ ├── res
│ │ ├── drawable-xxhdpi
│ │ │ ├── bg_test.jpg
│ │ │ ├── main_chat.png
│ │ │ ├── main_more.png
│ │ │ ├── me_posts.png
│ │ │ ├── me_wallet.png
│ │ │ ├── notify_dot.png
│ │ │ ├── sns_games.png
│ │ │ ├── sns_scan.png
│ │ │ ├── sns_shake.png
│ │ │ ├── avatar_test.jpg
│ │ │ ├── main_contact.png
│ │ │ ├── me_favorites.png
│ │ │ ├── me_settings.png
│ │ │ ├── sns_moments.png
│ │ │ ├── sns_shopping.png
│ │ │ ├── main_addcontact.png
│ │ │ ├── me_card_package.png
│ │ │ ├── me_emoji_store.png
│ │ │ ├── sns_drift_bottle.png
│ │ │ └── sns_people_nearby.png
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxxhdpi
│ │ │ ├── main_chat.png
│ │ │ ├── main_more.png
│ │ │ ├── me_posts.png
│ │ │ ├── me_wallet.png
│ │ │ ├── sns_games.png
│ │ │ ├── sns_scan.png
│ │ │ ├── sns_shake.png
│ │ │ ├── me_settings.png
│ │ │ ├── notify_dot.png
│ │ │ ├── sns_moments.png
│ │ │ ├── main_contact.png
│ │ │ ├── me_emoji_store.png
│ │ │ ├── me_favorites.png
│ │ │ ├── sns_shopping.png
│ │ │ ├── main_addcontact.png
│ │ │ ├── me_card_package.png
│ │ │ ├── sns_drift_bottle.png
│ │ │ └── sns_people_nearby.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ │ └── styles.xml
│ │ ├── values
│ │ │ ├── styles.xml
│ │ │ ├── color.xml
│ │ │ ├── arrays.xml
│ │ │ └── strings.xml
│ │ ├── layout
│ │ │ ├── header.xml
│ │ │ ├── actionbar_container.xml
│ │ │ ├── drawer_list_item.xml
│ │ │ └── drawer.xml
│ │ ├── xml
│ │ │ └── preference.xml
│ │ └── values-zh-rCN
│ │ │ └── strings.xml
│ │ ├── java
│ │ ├── dg
│ │ │ └── shenm233
│ │ │ │ └── wechatmod
│ │ │ │ ├── LicenseActivity.java
│ │ │ │ ├── hooks
│ │ │ │ ├── ResReplacement.java
│ │ │ │ └── ui
│ │ │ │ │ ├── LauncherUIBottomTabView.java
│ │ │ │ │ └── LauncherUI.java
│ │ │ │ ├── widget
│ │ │ │ └── CircleImageView.java
│ │ │ │ ├── MainHook.java
│ │ │ │ ├── Common.java
│ │ │ │ ├── ObfuscationHelper.java
│ │ │ │ └── SettingsActivity.java
│ │ └── chrisrenke
│ │ │ └── drawerarrowdrawable
│ │ │ └── DrawerArrowDrawable.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── README.md
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | *.iml
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | dg.shenm233.wechatmod.MainHook
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea
4 | *.iml
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/bg_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/bg_test.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/main_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/main_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/main_more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/main_more.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_posts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_posts.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_wallet.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/notify_dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/notify_dot.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_games.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_games.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_scan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_scan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_shake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_shake.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/main_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/main_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/main_more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/main_more.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_posts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_posts.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_wallet.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_games.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_games.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_scan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_scan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_shake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_shake.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/avatar_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/avatar_test.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/main_contact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/main_contact.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_favorites.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_favorites.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_moments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_moments.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_shopping.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_shopping.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/notify_dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/notify_dot.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_moments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_moments.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/main_addcontact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/main_addcontact.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_card_package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_card_package.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/me_emoji_store.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/me_emoji_store.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/main_contact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/main_contact.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_emoji_store.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_emoji_store.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_favorites.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_favorites.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_shopping.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_shopping.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_drift_bottle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_drift_bottle.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sns_people_nearby.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxhdpi/sns_people_nearby.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/main_addcontact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/main_addcontact.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/me_card_package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/me_card_package.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_drift_bottle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_drift_bottle.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sns_people_nearby.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenm233/WechatMOD/HEAD/app/src/main/res/drawable-xxxhdpi/sns_people_nearby.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Apr 22 18:33:03 CST 2016
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #E0E0E0
5 | #009688
6 | #212121
7 | #009688
8 | #00796B
9 | #FFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WechatMOD
2 | a xposed module for modifying Wechat
3 |
4 | License
5 | _________________________
6 | Copyright 2015 Shen Zhang
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\darkcat\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "dg.shenm233.wechatmod"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 10
12 | versionName "2.0.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | zipAlignEnabled true
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | compile 'com.android.support:support-v4:23.2.1'
25 | provided 'de.robv.android.xposed:api:53'
26 | provided 'de.robv.android.xposed:api:53:sources'
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/LicenseActivity.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod;
2 |
3 | import android.app.Activity;
4 | import android.app.AlertDialog;
5 | import android.content.DialogInterface;
6 | import android.os.Bundle;
7 | import android.webkit.WebView;
8 |
9 | public class LicenseActivity extends Activity implements DialogInterface.OnCancelListener {
10 | @Override
11 | public void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | WebView mWebView = new WebView(this);
14 | mWebView.loadUrl("file:///android_asset/license.html");
15 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
16 | builder.setCancelable(true)
17 | .setView(mWebView)
18 | .setTitle(R.string.preference_license)
19 | .setOnCancelListener(this)
20 | .show();
21 | }
22 |
23 | @Override
24 | public void onCancel(DialogInterface dialog) {
25 | finish();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/actionbar_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
18 |
19 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/hooks/ResReplacement.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod.hooks;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageManager;
5 |
6 | import de.robv.android.xposed.callbacks.XC_InitPackageResources;
7 | import dg.shenm233.wechatmod.ObfuscationHelper;
8 |
9 | import static de.robv.android.xposed.XposedHelpers.callMethod;
10 | import static de.robv.android.xposed.XposedHelpers.callStaticMethod;
11 | import static de.robv.android.xposed.XposedHelpers.findClass;
12 | import static dg.shenm233.wechatmod.Common.WECHAT_PACKAGENAME;
13 |
14 | public class ResReplacement {
15 | public static void init(XC_InitPackageResources.InitPackageResourcesParam resparam) {
16 | Object activityThread = callStaticMethod(findClass("android.app.ActivityThread", null), "currentActivityThread");
17 | Context context = (Context) callMethod(activityThread, "getSystemContext");
18 | try {
19 | String versionName = context.getPackageManager().getPackageInfo(WECHAT_PACKAGENAME, 0).versionName;
20 | int versionCode = context.getPackageManager().getPackageInfo(WECHAT_PACKAGENAME, 0).versionCode;
21 | int versionIndex = ObfuscationHelper.isSupportedVersion(versionCode, versionName);
22 | if (versionIndex < 0) return;
23 |
24 | } catch (PackageManager.NameNotFoundException e) {
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
26 |
27 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - default
5 | - notabs
6 | - navidrawer
7 |
8 |
9 | - @string/sns_moments
10 | - @string/sns_shake
11 | - @string/sns_people_nearby
12 | - @string/sns_drift_bottle
13 | - @string/sns_shopping
14 | - @string/sns_games
15 | - @string/me_card_package
16 | - @string/me_emoji_store
17 |
18 |
19 | - item_sns_moments
20 | - item_sns_shake
21 | - item_sns_people_nearby
22 | - item_sns_drift_bottle
23 | - item_sns_shopping
24 | - item_sns_games
25 | - item_me_card_package
26 | - item_me_emoji_store
27 |
28 |
29 | - #000000
30 | - #009688
31 | - #2196F3
32 | - #F44336
33 | - #FF5722
34 | - #9C27B0
35 | - #263238
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/assets/license.html:
--------------------------------------------------------------------------------
1 |
2 | DrawerArrowDrawable.java
3 |
4 |
5 | Copyright 2014 Chris Renke
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 |
20 |
21 | android-support-*.jar
22 |
23 |
24 | Copyright (C) 2013 The Android Open Source Project
25 |
26 | Licensed under the Apache License, Version 2.0 (the "License");
27 | you may not use this file except in compliance with the License.
28 | You may obtain a copy of the License at
29 |
30 | http://www.apache.org/licenses/LICENSE-2.0
31 |
32 | Unless required by applicable law or agreed to in writing, software
33 | distributed under the License is distributed on an "AS IS" BASIS,
34 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | See the License for the specific language governing permissions and
36 | limitations under the License.
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
11 |
16 |
17 |
23 |
24 |
29 |
30 |
37 |
38 |
39 |
40 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/hooks/ui/LauncherUIBottomTabView.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod.hooks.ui;
2 |
3 | import android.view.View;
4 | import android.view.ViewGroup;
5 | import android.widget.TextView;
6 |
7 | import de.robv.android.xposed.XC_MethodHook;
8 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
9 | import dg.shenm233.wechatmod.Common;
10 |
11 | import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
12 | import static de.robv.android.xposed.XposedHelpers.getObjectField;
13 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Classes;
14 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Fields;
15 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Methods;
16 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Res;
17 |
18 | public class LauncherUIBottomTabView {
19 | public static void init(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
20 | XC_MethodHook methodHook;
21 |
22 | methodHook = new XC_MethodHook() {
23 | @Override
24 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
25 | Object result = param.getResult();
26 | TextView tabBottom = (TextView) getObjectField(result,
27 | MM_Fields.LauncherUIBottomTabView$Tab.tabName);
28 | tabBottom.setVisibility(View.GONE);
29 | View bg = (View) getObjectField(result,
30 | MM_Fields.LauncherUIBottomTabView$Tab.tabBackground);
31 | bg.setBackgroundColor(Common.MM_AppContext.getResources().getColor(MM_Res.color.action_bar_color));
32 | }
33 | };
34 | findAndHookMethod(MM_Classes.LauncherUIBottomTabView,
35 | MM_Methods.LauncherUIBottomTabView.initSingleTab,
36 | int.class, ViewGroup.class, methodHook);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
13 |
16 |
19 |
22 |
23 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/widget/CircleImageView.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapShader;
6 | import android.graphics.Canvas;
7 | import android.graphics.Paint;
8 | import android.graphics.Shader;
9 | import android.util.AttributeSet;
10 | import android.util.Log;
11 | import android.widget.ImageView;
12 |
13 | public class CircleImageView extends ImageView {
14 | private static Bitmap mBitmap;
15 | private static Canvas mCanvas = new Canvas();
16 | private final static Paint mBitmapPaint = new Paint();
17 | private static BitmapShader mBitmapShader;
18 | private static float radius;
19 |
20 | public CircleImageView(Context context) {
21 | super(context);
22 | }
23 |
24 | public CircleImageView(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | }
27 |
28 | public CircleImageView(Context context, AttributeSet attrs, int defStyleAttr) {
29 | super(context, attrs, defStyleAttr);
30 | }
31 |
32 | @Override
33 | public void onDraw(Canvas imageViewCanvas) {
34 | //Hack for wechat!
35 | try {
36 | final int mMeasuredWidth = getMeasuredWidth();
37 | final int mMeasuredHeight = getMeasuredHeight();
38 |
39 | if (mMeasuredWidth <= 0 || mMeasuredHeight <= 0) {
40 | Log.d("WechatMOD", "getMeasuredWidth() or getMeasuredHeight() <= 0 stop drawing!");
41 | return;
42 | }
43 |
44 | if (mBitmap == null) {
45 | mBitmap = Bitmap.createBitmap(mMeasuredWidth, mMeasuredHeight, Bitmap.Config.ARGB_8888);
46 | Log.d("WechatMOD", "created bitmap! width=" + mMeasuredWidth + " height=" + mMeasuredHeight);
47 | mCanvas.setBitmap(mBitmap);
48 | radius = Math.min(mMeasuredWidth, mMeasuredHeight) / 2;
49 | mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
50 | mBitmapPaint.setAntiAlias(true);
51 | mBitmapPaint.setShader(mBitmapShader);
52 | }
53 |
54 | //draw bitmap on canvas for getting another bitmap
55 | super.onDraw(mCanvas);
56 |
57 | imageViewCanvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, mBitmapPaint);
58 |
59 | Log.d("WechatMOD", "draw Circle!");
60 | } catch (OutOfMemoryError e) {
61 | super.onDraw(imageViewCanvas);
62 | Log.d("WechatMOD", "[OutOfMemoryError] draw original!");
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
26 |
30 |
33 |
34 |
35 |
36 |
39 |
42 |
45 |
48 |
51 |
52 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | WechatMOD
4 | 发现
5 | 聊天
6 | 联系人
7 | 我
8 | 收藏
9 | 相册
10 | 设置
11 | 钱包
12 | 卡包
13 | 表情
14 | 漂流瓶
15 | 游戏
16 | 朋友圈
17 | 附近的人
18 | 扫一扫
19 | 摇一摇
20 | 购物
21 | 微信号:
22 | 关于
23 | 作者
24 | 捐赠
25 | 支付宝:
26 | 内容已复制到剪切板
27 | 开源协议
28 | 注意
29 | 界面设置
30 | 选择微信导航方式
31 |
32 | - 默认(iOS tabs)
33 | - 无tabs(保留左右滑动)
34 | - 导航抽屉
35 |
36 | ActionBar颜色
37 |
38 | - 蠢黑
39 | - 鸭绿
40 | - 蓝蓝路
41 | - 骚x红
42 | - Play橙
43 | - 基佬紫
44 | - 灰蓝
45 |
46 | 强制开启状态栏变色
47 | 虚拟导航键的机型不建议启用
48 | 关闭抽屉里的部分功能
49 | 勾选以关闭功能
50 | WechatMOD模块设置
51 | 版本
52 | (支持该微信版本)
53 | (未支持该微信版本)
54 | 使用本修改模块代表你要承担一切后果,如隐私泄露、财产损失等,与本模块无关!
55 | \n推荐从可信网站下载并安装本模块。
56 | 请重新启动微信使设置生效\n(提示:可以将微信从最近任务列表删除来重启微信)
57 | 设置抽屉的头像背景
58 | 隐藏启动图标
59 | 你仍可以从Xposed Installer中的“模块”进入本设置
60 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | WechatMOD
3 |
4 | Chatting
5 | Contact
6 | Discovery
7 | Me
8 |
9 | Moments
10 | Scan QR Code
11 | Shake
12 | People Nearby
13 | Drift Bottle
14 | Games
15 | Shopping
16 |
17 | My Posts
18 | Favorites
19 | Wallet
20 | Settings
21 | Card Pack
22 | Sticker Gallery
23 |
24 | ID:
25 |
26 | WechatMOD Settings
27 | Note
28 | Use this mod at your risk!
29 |
30 | UI Settings
31 | Select Wechat Navigation
32 |
33 | - Default(iOS tabs)
34 | - No any tabs(keep Swiping)
35 | - Navigation Drawer
36 |
37 | Action bar color
38 |
39 | - Black
40 | - Teal
41 | - Blue
42 | - Red
43 | - Orange
44 | - Purple
45 | - Blue Grey
46 |
47 | Force enable status bar color
48 | not compatible with Navigation Bar
49 | Disable items in drawer
50 | Select to disable
51 | Pick up a pic for background in drawer
52 |
53 | About
54 | Version
55 | (supported Wechat version)
56 | (unsupported Wechat version)
57 | Dev
58 | Donate
59 | alipay:
60 | content has been copied to clipboard
61 | Open source licenses
62 | Hide launcher icon
63 | you can access this settings from Xposed Installer
64 |
65 | Please reboot Wechat to take effect.
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/MainHook.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod;
2 |
3 | import android.content.Context;
4 | import android.content.res.XModuleResources;
5 |
6 | import de.robv.android.xposed.IXposedHookInitPackageResources;
7 | import de.robv.android.xposed.IXposedHookLoadPackage;
8 | import de.robv.android.xposed.IXposedHookZygoteInit;
9 | import de.robv.android.xposed.XC_MethodHook;
10 | import de.robv.android.xposed.XSharedPreferences;
11 | import de.robv.android.xposed.XposedBridge;
12 | import de.robv.android.xposed.callbacks.XC_InitPackageResources;
13 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
14 | import dg.shenm233.wechatmod.hooks.ResReplacement;
15 | import dg.shenm233.wechatmod.hooks.ui.LauncherUI;
16 | import dg.shenm233.wechatmod.hooks.ui.LauncherUIBottomTabView;
17 |
18 | import static de.robv.android.xposed.XposedHelpers.callMethod;
19 | import static de.robv.android.xposed.XposedHelpers.callStaticMethod;
20 | import static de.robv.android.xposed.XposedHelpers.findClass;
21 | import static dg.shenm233.wechatmod.BuildConfig.DEBUG;
22 | import static dg.shenm233.wechatmod.Common.WECHAT_PACKAGENAME;
23 |
24 | public class MainHook extends XC_MethodHook
25 | implements IXposedHookZygoteInit, IXposedHookLoadPackage, IXposedHookInitPackageResources {
26 | private static String MODULE_PATH = null;
27 |
28 | @Override
29 | public void initZygote(IXposedHookZygoteInit.StartupParam startupParam)
30 | throws Throwable {
31 | MODULE_PATH = startupParam.modulePath;
32 | Common.XMOD_PREFS = new XSharedPreferences(Common.MOD_PACKAGENAME, Common.MOD_PREFS);
33 | Common.XMOD_PREFS.makeWorldReadable();
34 | }
35 |
36 | @Override
37 | public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam)
38 | throws Throwable {
39 | if (!lpparam.packageName.equals(WECHAT_PACKAGENAME)) return;
40 |
41 | try {
42 | ////////////////////////////////////////////////////
43 | // thanks to KeepChat for the following snippet:
44 | // http://git.io/JJZPaw
45 | Object activityThread = callStaticMethod(findClass("android.app.ActivityThread", null),
46 | "currentActivityThread");
47 | Context context = (Context) callMethod(activityThread, "getSystemContext");
48 | ///////////////////////////////////////////////////
49 |
50 | String versionName = context.getPackageManager().getPackageInfo(WECHAT_PACKAGENAME, 0).versionName;
51 | int versionCode = context.getPackageManager().getPackageInfo(WECHAT_PACKAGENAME, 0).versionCode;
52 | if (DEBUG)
53 | XposedBridge.log("Wechat versionName: " + versionName + " versionCode: " + Integer.toString(versionCode));
54 |
55 | //If it's not supported,goodbye!
56 | if (!ObfuscationHelper.init(versionCode, versionName, lpparam)) return;
57 |
58 | Common.MOD_Context = context.createPackageContext(Common.MOD_PACKAGENAME,
59 | Context.CONTEXT_IGNORE_SECURITY);
60 |
61 | //Let do it!
62 | LauncherUI.init(lpparam);
63 | LauncherUIBottomTabView.init(lpparam);
64 | } catch (Throwable l) {
65 | XposedBridge.log(l);
66 | }
67 | }
68 |
69 | @Override
70 | public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam)
71 | throws Throwable {
72 | if (!resparam.packageName.equals(WECHAT_PACKAGENAME)) return;
73 | if (Common.MOD_RES == null)
74 | Common.MOD_RES = XModuleResources.createInstance(MODULE_PATH, null);
75 | ResReplacement.init(resparam);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/Common.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod;
2 |
3 | import android.content.Context;
4 | import android.content.res.XModuleResources;
5 | import android.graphics.Color;
6 |
7 | import de.robv.android.xposed.XSharedPreferences;
8 |
9 | public class Common {
10 | public static final String MOD_PACKAGENAME = Common.class.getPackage().getName();
11 | public static final String WECHAT_PACKAGENAME = "com.tencent.mm";
12 | public static final String MOD_PREFS = "mod_settings";
13 |
14 | public static Context MM_AppContext;
15 | public static Context MOD_Context;
16 |
17 | public static XModuleResources MOD_RES;
18 | public static XSharedPreferences XMOD_PREFS;
19 |
20 | public static final String KEY_SETNAV = "setnav";
21 | public static final String KEY_DISABLED_ITEMS = "disabled_items";
22 | public static final String KEY_ACTIONBAR_COLOR = "actionbar_color";
23 | public static final String KEY_FORCE_STATUSBAR_COLOR = "force_statusbar_color";
24 | public static final String DRAWER_BG_PNG = "drawer_bg.jpg";
25 |
26 | //**************************************************************************
27 | public static final int item_main_chat = 0;
28 | public static final int item_main_contact = 1;
29 |
30 | public static final int item_main_addcontact = 20; //category Discovery
31 | public static final int item_sns_moments = 21;
32 | public static final int item_sns_scan = 22;
33 | public static final int item_sns_shake = 23;
34 | public static final int item_sns_people_nearby = 24;
35 | public static final int item_sns_drift_bottle = 25;
36 | public static final int item_sns_shopping = 26;
37 | public static final int item_sns_games = 27;
38 |
39 | public static final int item_main_more = 30; //category Me
40 | public static final int item_me_posts = 31;
41 | public static final int item_me_favorites = 32;
42 | public static final int item_me_wallet = 33;
43 | public static final int item_me_card_package = 34;
44 | public static final int item_me_emoji_store = 35;
45 | public static final int item_me_settings = 36;
46 | //**************************************************************************
47 |
48 | //**************************************************************************
49 | public static boolean item_sns_moments_enabled;
50 | public static boolean item_sns_shake_enabled;
51 | public static boolean item_sns_people_nearby_enabled;
52 | public static boolean item_sns_drift_bottle_enabled;
53 | public static boolean item_sns_shopping_enabled;
54 | public static boolean item_sns_games_enabled;
55 | public static boolean item_me_card_package_enabled;
56 | public static boolean item_me_emoji_store_enabled;
57 | //**************************************************************************
58 |
59 | public static int dipTopx(Context context, long dip) {
60 | float density = context.getResources().getDisplayMetrics().density;
61 | return (int) (dip * density + 0.5f);
62 | }
63 |
64 | public static long getDrawerWidthdip(Context context) {
65 | final int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
66 | if (widthPixels <= 480) {
67 | return 260L;
68 | } else {
69 | return 296L;
70 | }
71 | }
72 |
73 | ////////////////////////////////////////////////////
74 | // thanks to Lolistat for the following snippet:
75 | // https://github.com/PeterCxy/Lolistat/blob/aide/app/src/main/java/info/papdt/lolistat/support/Utility.java#L19
76 | public static int getDarkerColor(int color, float factor) {
77 | float[] hsv = new float[3];
78 | Color.colorToHSV(color, hsv);
79 | hsv[2] *= factor; //value
80 | return Color.HSVToColor(hsv);
81 | }
82 | ////////////////////////////////////////////////////
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/hooks/ui/LauncherUI.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod.hooks.ui;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.LinearLayout;
8 |
9 | import de.robv.android.xposed.XC_MethodHook;
10 | import de.robv.android.xposed.XposedBridge;
11 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
12 | import dg.shenm233.wechatmod.Common;
13 |
14 | import static de.robv.android.xposed.XposedHelpers.callStaticMethod;
15 | import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
16 | import static de.robv.android.xposed.XposedHelpers.getAdditionalInstanceField;
17 | import static de.robv.android.xposed.XposedHelpers.getObjectField;
18 | import static de.robv.android.xposed.XposedHelpers.removeAdditionalInstanceField;
19 | import static de.robv.android.xposed.XposedHelpers.setAdditionalInstanceField;
20 | import static dg.shenm233.wechatmod.BuildConfig.DEBUG;
21 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Classes;
22 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Fields;
23 | import static dg.shenm233.wechatmod.ObfuscationHelper.MM_Methods;
24 |
25 |
26 | public class LauncherUI {
27 | public static final String TAG = "launcherUIMod";
28 |
29 | public static void init(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
30 | XC_MethodHook methodHook;
31 |
32 | methodHook = new XC_MethodHook() {
33 | @Override
34 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
35 | if (DEBUG) XposedBridge.log("wechat onCreate hook!");
36 | Activity launcherUIInstance = (Activity) param.thisObject;
37 | Common.MM_AppContext = launcherUIInstance.getApplicationContext();
38 |
39 | LauncherUI launcherUIMod = new LauncherUI(launcherUIInstance);
40 | setAdditionalInstanceField(launcherUIInstance, TAG, launcherUIMod);
41 | }
42 | };
43 | findAndHookMethod(MM_Classes.LauncherUI, "onCreate", Bundle.class, methodHook);
44 |
45 | methodHook = new XC_MethodHook() {
46 | @Override
47 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
48 | LauncherUI launcherUIMod = (LauncherUI) getAdditionalInstanceField(param.thisObject, TAG);
49 | launcherUIMod.isMainTabCreated = (boolean) getObjectField(param.thisObject,
50 | MM_Fields.LauncherUI.isMainTabCreated);
51 | }
52 |
53 | @Override
54 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
55 | LauncherUI launcherUIMod = (LauncherUI) getAdditionalInstanceField(param.thisObject, TAG);
56 | if (!launcherUIMod.isMainTabCreated) {
57 | if (DEBUG) XposedBridge.log("on maintab create");
58 | if ((boolean) callStaticMethod(MM_Classes.AccountStorage,
59 | MM_Methods.AccountStorage.isMMcoreReady)) {
60 | launcherUIMod.moveTabsToTop();
61 | } else {
62 | if (DEBUG)
63 | XposedBridge.log("mmcore has not ready, finish LauncherUI hook");
64 | }
65 | }
66 | }
67 | };
68 | findAndHookMethod(MM_Classes.LauncherUI, MM_Methods.LauncherUI.startMainUI, methodHook);
69 |
70 | methodHook = new XC_MethodHook() {
71 | @Override
72 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
73 | LauncherUI launcherUIMod = (LauncherUI) getAdditionalInstanceField(param.thisObject, TAG);
74 | launcherUIMod.onDestroy();
75 | removeAdditionalInstanceField(param.thisObject, TAG);
76 | }
77 | };
78 | findAndHookMethod(MM_Classes.LauncherUI, "onDestroy", methodHook); // fix activity leak
79 | }
80 |
81 | /***********************************
82 | * Let's do magic!
83 | ***********************************/
84 | private boolean isMainTabCreated;
85 | private Activity mLauncherUI;
86 |
87 | public LauncherUI(Activity launcherUI) {
88 | mLauncherUI = launcherUI;
89 | }
90 |
91 | private void moveTabsToTop() {
92 | ViewGroup customViewPager = (ViewGroup) getObjectField(mLauncherUI,
93 | MM_Fields.LauncherUI.customViewPager);
94 | View tabView = (View) getObjectField(mLauncherUI, MM_Fields.LauncherUI.tabView);
95 | LinearLayout parent = (LinearLayout) customViewPager.getParent();
96 | parent.removeView(tabView);
97 | parent.addView(tabView, 0);
98 | }
99 |
100 | private void onDestroy() {
101 | mLauncherUI = null;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/ObfuscationHelper.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.XmlResourceParser;
6 |
7 | import org.xmlpull.v1.XmlPullParser;
8 | import org.xmlpull.v1.XmlPullParserException;
9 |
10 | import java.io.IOException;
11 |
12 | import de.robv.android.xposed.XC_MethodHook;
13 | import de.robv.android.xposed.XposedBridge;
14 | import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
15 |
16 | import static de.robv.android.xposed.XposedHelpers.findClass;
17 | import static dg.shenm233.wechatmod.BuildConfig.DEBUG;
18 |
19 | public class ObfuscationHelper {
20 |
21 | //a helper for analyzing StackTrace,I want to know who called method.
22 | public static XC_MethodHook getStackTraceHelper;
23 |
24 | /**
25 | * init ObfuscationHelper according to versionname and versioncode
26 | * if it is supported,return true,otherwise return false
27 | */
28 | public static boolean init(int versioncode, String versionName, LoadPackageParam lpparam) throws Throwable {
29 | int versionIndex;
30 | versionIndex = isSupportedVersion(versioncode, versionName);
31 | if (versionIndex < 0) {
32 | return false;
33 | }
34 |
35 | MM_Classes.init(versionIndex, lpparam);
36 | MM_Methods.init(versionIndex);
37 | MM_Fields.init(versionIndex);
38 | MM_Res.init(versionIndex, lpparam);
39 |
40 | if (DEBUG) {
41 | getStackTraceHelper = new XC_MethodHook() {
42 | @Override
43 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
44 | XposedBridge.log("********");
45 | StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
46 | for (int i = 0; i < stackTraceElements.length; i++) {
47 | StackTraceElement stackTraceElement = stackTraceElements[i];
48 | XposedBridge.log(i + ": " + stackTraceElement.getClassName() + "."
49 | + stackTraceElement.getMethodName() + "\n");
50 | }
51 | XposedBridge.log("********");
52 | }
53 | };
54 | }
55 | return true;
56 | }
57 |
58 | /*
59 | *if it is supported,return >= 0,otherwise return -1
60 | */
61 | public static int isSupportedVersion(int versioncode, String versionName) {
62 | if (versionName.contains("6.3.16.49")) {
63 | return 0;
64 | } else if (versionName.contains("6.3.15.65")) {
65 | return 1;
66 | } else if (versionName.contains("6.3.16.64")) {
67 | return 2;
68 | } else {
69 | return -1;
70 | }
71 | }
72 |
73 | public static class MM_Classes {
74 | public static Class> LauncherUI;
75 | public static Class> LauncherUIBottomTabView;
76 | public static Class> LauncherUIBottomTabView$Tab;
77 |
78 | public static Class> AccountStorage;
79 |
80 | private static void init(int idx, LoadPackageParam lpparam) throws Throwable {
81 | String MM_UI_PACKAGENAME = "com.tencent.mm.ui.";
82 | String MM_PLUGINSDK_UI_PACKNAME = "com.tencent.mm.pluginsdk.ui.";
83 | String MM_MODEL_PACKAGENAME = "com.tencent.mm.model.";
84 |
85 | LauncherUI = findClass("com.tencent.mm.ui.LauncherUI", lpparam.classLoader);
86 | LauncherUIBottomTabView = findClass(MM_UI_PACKAGENAME + "LauncherUIBottomTabView", lpparam.classLoader);
87 | LauncherUIBottomTabView$Tab = findClass(MM_UI_PACKAGENAME + "LauncherUIBottomTabView" +
88 | new String[]{"$a", "$a", "$a"}[idx], lpparam.classLoader);
89 | AccountStorage = findClass(MM_MODEL_PACKAGENAME +
90 | new String[]{"ah", "ah", "ah"}[idx], lpparam.classLoader);
91 | }
92 | }
93 |
94 | public static class MM_Methods {
95 |
96 | //methods in LauncherUI class:
97 | public static class LauncherUI {
98 | public static String startMainUI;
99 | }
100 |
101 | //methods in LauncherUIBottomTabView class:
102 | public static class LauncherUIBottomTabView {
103 | public static String initSingleTab;
104 | }
105 |
106 | //methods in AccountStorage class:
107 | public static class AccountStorage {
108 | public static String isMMcoreReady;
109 | }
110 |
111 | private static void init(int idx) throws Throwable {
112 | /*com.tencent.mm.ui.LauncherUI*/
113 | LauncherUI.startMainUI = new String[]{"bbu", "ban", "bbu"}[idx]; /*"on main tab create"*/
114 |
115 | /*com.tencent.mm.ui.LauncherUIBottomTabView*/
116 | LauncherUIBottomTabView.initSingleTab = new String[]{"a", "a", "a"}[idx];
117 |
118 | /*com.tencent.mm.ui.LauncherUI*/
119 | AccountStorage.isMMcoreReady = new String[]{"qy", "qw", "qy"}[idx]; /*mmcore has not ready 的上面第三行if(...) break Label...*/
120 | }
121 | }
122 |
123 | public static class MM_Fields {
124 |
125 | //fields in LauncherUI class:
126 | public static class LauncherUI {
127 | public static String customViewPager;
128 | public static String tabView;
129 | public static String isMainTabCreated;
130 | }
131 |
132 | //fields in LauncherUIBottomTabView$Tab class:
133 | public static class LauncherUIBottomTabView$Tab {
134 | public static String tabName;
135 | public static String tabBackground;
136 | }
137 |
138 | private static void init(int idx) throws Throwable {
139 | /*com.tencent.mm.ui.LauncherUI*/
140 | LauncherUI.customViewPager = new String[]{"koj", "kfj", "koj"}[idx]; /*CustomViewPager*/
141 | LauncherUI.tabView = new String[]{"koi", "kfi", "koi"}[idx]; /*= launcheruibottomtabview*/
142 | LauncherUI.isMainTabCreated = new String[]{"knZ", "keZ", "knZ"}[idx]; /*on main tab create*/
143 |
144 | /*com.tencent.mm.ui.LauncherUIBottomTabView$Tab*/
145 | LauncherUIBottomTabView$Tab.tabName = new String[]{"kqx", "khx", "kqx"}[idx];
146 | LauncherUIBottomTabView$Tab.tabBackground = new String[]{"kqv", "khv", "kqv"}[idx]; /*View*/
147 | }
148 | }
149 |
150 | //this class is used for get resource(such as layout,drawable..) id
151 | public static class MM_Res {
152 |
153 | public static class color {
154 | public static int action_bar_color;
155 | }
156 |
157 | private static void init(int idx, LoadPackageParam lpparam) throws Throwable {
158 | color.action_bar_color = new int[]{2131231144, 2131231131, 2131231144}[idx];
159 | }
160 | }
161 |
162 | //a tool for analysis,because obfuscation is toooo crazy.
163 | public static void getRawXml(int resid, Context context) {
164 | try {
165 | XmlResourceParser xml = context.getResources().getXml(resid);
166 |
167 | // check state
168 | int eventType = xml.getEventType();
169 | while (eventType != XmlPullParser.END_DOCUMENT) {
170 | if (eventType == XmlPullParser.START_DOCUMENT) {
171 | XposedBridge.log("Start document resid:" + Integer.toString(resid));
172 | } else if (eventType == XmlPullParser.START_TAG) {
173 | XposedBridge.log("Start tag : " + xml.getName());
174 | } else if (eventType == XmlPullParser.END_TAG) {
175 | XposedBridge.log("End tag : " + xml.getName());
176 | } else if (eventType == XmlPullParser.TEXT) {
177 | XposedBridge.log("Text : " + xml.getText());
178 | }
179 | eventType = xml.next();
180 | }
181 | // indicate app done reading the resource.
182 | xml.close();
183 | } catch (Resources.NotFoundException e) {
184 | XposedBridge.log(e);
185 | } catch (IOException | XmlPullParserException e) {
186 | e.printStackTrace();
187 | }
188 | }
189 | }
190 |
--------------------------------------------------------------------------------
/app/src/main/java/dg/shenm233/wechatmod/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package dg.shenm233.wechatmod;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.ActivityNotFoundException;
5 | import android.content.ClipData;
6 | import android.content.ClipboardManager;
7 | import android.content.ComponentName;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.content.SharedPreferences;
11 | import android.content.pm.PackageManager;
12 | import android.graphics.Bitmap;
13 | import android.graphics.BitmapFactory;
14 | import android.net.Uri;
15 | import android.os.Bundle;
16 | import android.os.Environment;
17 | import android.preference.CheckBoxPreference;
18 | import android.preference.ListPreference;
19 | import android.preference.MultiSelectListPreference;
20 | import android.preference.Preference;
21 | import android.preference.PreferenceActivity;
22 | import android.provider.MediaStore;
23 | import android.util.Log;
24 | import android.widget.Toast;
25 |
26 | import java.io.File;
27 | import java.io.FileInputStream;
28 | import java.io.FileNotFoundException;
29 | import java.io.FileOutputStream;
30 | import java.io.IOException;
31 | import java.util.Set;
32 |
33 | import static dg.shenm233.wechatmod.Common.dipTopx;
34 | import static dg.shenm233.wechatmod.ObfuscationHelper.isSupportedVersion;
35 |
36 | @SuppressLint("WorldReadableFiles")
37 | public class SettingsActivity extends PreferenceActivity implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
38 | private SharedPreferences prefs;
39 |
40 | private int PICK_BG = 0;
41 |
42 | private Preference mLicense;
43 | private ListPreference mSetNav;
44 | private MultiSelectListPreference mDisabledItems;
45 | private ListPreference mActionBarColor;
46 | private CheckBoxPreference mForceStatusBarColor;
47 | private Preference mPickBg;
48 | private CheckBoxPreference mHideLauncherIcon;
49 |
50 | @Override
51 | public void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | prefs = getSharedPreferences(Common.MOD_PREFS, Context.MODE_WORLD_READABLE);
54 | addPreferencesFromResource(R.xml.preference);
55 | PackageManager pm = getPackageManager();
56 | StringBuilder ver = new StringBuilder("MOD Version: ");
57 | ver.append(BuildConfig.VERSION_NAME).append("\n");
58 | ver.append("Wechat Version: ");
59 | try {
60 | int versionCode = pm.getPackageInfo(Common.WECHAT_PACKAGENAME, 0).versionCode;
61 | String versionName = pm.getPackageInfo(Common.WECHAT_PACKAGENAME, 0).versionName;
62 | ver.append(versionName).append("(").append(versionCode).append(")");
63 | if (isSupportedVersion(versionCode, versionName) < 0) {
64 | ver.append("\n").append(getString(R.string.unsupported));
65 | } else {
66 | ver.append("\n").append(getString(R.string.supported));
67 | }
68 | } catch (PackageManager.NameNotFoundException e) {
69 | ver.append("not installed.");
70 | }
71 | findPreference("version").setSummary(ver);
72 |
73 | findPreference("dev").setSummary("shenm233 (darkgenlotus@gmail.com)");
74 | findPreference("donate").setSummary(getText(R.string.alipay) + " darkgentry@hotmail.com");
75 | findPreference("donate").setOnPreferenceClickListener(this);
76 |
77 | mLicense = findPreference("license");
78 | mSetNav = (ListPreference) findPreference(Common.KEY_SETNAV);
79 | mDisabledItems = (MultiSelectListPreference) findPreference(Common.KEY_DISABLED_ITEMS);
80 | mActionBarColor = (ListPreference) findPreference(Common.KEY_ACTIONBAR_COLOR);
81 | mForceStatusBarColor = (CheckBoxPreference) findPreference(Common.KEY_FORCE_STATUSBAR_COLOR);
82 | mPickBg = findPreference("pickup_bg");
83 | mHideLauncherIcon = (CheckBoxPreference) findPreference("hide_launcher_icon");
84 | mLicense.setOnPreferenceClickListener(this);
85 | mSetNav.setOnPreferenceChangeListener(this);
86 | mDisabledItems.setOnPreferenceChangeListener(this);
87 | mActionBarColor.setOnPreferenceChangeListener(this);
88 | mForceStatusBarColor.setOnPreferenceChangeListener(this);
89 | mPickBg.setOnPreferenceClickListener(this);
90 | mHideLauncherIcon.setOnPreferenceChangeListener(this);
91 | }
92 |
93 | @Override
94 | public void onResume() {
95 | super.onResume();
96 | String navMode = prefs.getString(Common.KEY_SETNAV, "default");
97 | int index = mSetNav.findIndexOfValue(navMode);
98 | CharSequence[] entries = mSetNav.getEntries();
99 | mSetNav.setValueIndex(index);
100 | mSetNav.setSummary(entries[index]);
101 |
102 | String actionBarColor = prefs.getString(Common.KEY_ACTIONBAR_COLOR, "#263238");
103 | index = mActionBarColor.findIndexOfValue(actionBarColor);
104 | entries = mActionBarColor.getEntries();
105 | if (index >= 0) {
106 | mActionBarColor.setValueIndex(index);
107 | mActionBarColor.setSummary(entries[index]);
108 | }
109 |
110 | boolean forceStatusbarColor = prefs.getBoolean(Common.KEY_FORCE_STATUSBAR_COLOR, false);
111 | mForceStatusBarColor.setChecked(forceStatusbarColor);
112 | }
113 |
114 | @Override
115 | public void onDestroy() {
116 | super.onDestroy();
117 | prefs = null;
118 | mLicense.setOnPreferenceClickListener(null);
119 | mSetNav.setOnPreferenceChangeListener(null);
120 | mDisabledItems.setOnPreferenceChangeListener(null);
121 | mActionBarColor.setOnPreferenceChangeListener(null);
122 | mForceStatusBarColor.setOnPreferenceChangeListener(null);
123 | mPickBg.setOnPreferenceClickListener(null);
124 | mHideLauncherIcon.setOnPreferenceChangeListener(null);
125 | findPreference("donate").setOnPreferenceClickListener(null);
126 | }
127 |
128 | @Override
129 | public boolean onPreferenceChange(Preference preference, Object newValue) {
130 | if (preference == mSetNav) {
131 | CharSequence[] entries = mSetNav.getEntries();
132 | String key = (String) newValue;
133 | int index = mSetNav.findIndexOfValue(key);
134 | mSetNav.setSummary(entries[index]);
135 | SharedPreferences.Editor editor = prefs.edit();
136 | editor.putString(Common.KEY_SETNAV, key);
137 | editor.commit();
138 | Toast.makeText(this, R.string.preference_reboot_note, Toast.LENGTH_SHORT).show();
139 | return true;
140 | } else if (preference == mDisabledItems) {
141 | Set strs = (Set) newValue;
142 | SharedPreferences.Editor editor = prefs.edit();
143 | editor.putStringSet(Common.KEY_DISABLED_ITEMS, strs);
144 | editor.commit();
145 | Toast.makeText(this, R.string.preference_reboot_note, Toast.LENGTH_SHORT).show();
146 | return true;
147 | } else if (preference == mActionBarColor) {
148 | CharSequence[] entries = mActionBarColor.getEntries();
149 | String key = (String) newValue;
150 | int index = mActionBarColor.findIndexOfValue(key);
151 | mActionBarColor.setSummary(entries[index]);
152 | SharedPreferences.Editor editor = prefs.edit();
153 | editor.putString(Common.KEY_ACTIONBAR_COLOR, key);
154 | editor.commit();
155 | return true;
156 | } else if (preference == mForceStatusBarColor) {
157 | SharedPreferences.Editor editor = prefs.edit();
158 | editor.putBoolean(Common.KEY_FORCE_STATUSBAR_COLOR, (boolean) newValue);
159 | editor.commit();
160 | Toast.makeText(this, R.string.preference_reboot_note, Toast.LENGTH_SHORT).show();
161 | return true;
162 | } else if (preference == mHideLauncherIcon) {
163 | PackageManager packageManager = this.getPackageManager();
164 | ComponentName aliasName = new ComponentName(this, Common.MOD_PACKAGENAME + ".SettingsActivityLauncher");
165 | if ((boolean) newValue) {
166 | packageManager.setComponentEnabledSetting(aliasName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
167 | } else {
168 | packageManager.setComponentEnabledSetting(aliasName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
169 | }
170 | return true;
171 | }
172 | return false;
173 | }
174 |
175 | @Override
176 | public boolean onPreferenceClick(Preference preference) {
177 | if (preference == mLicense) {
178 | Intent intent = new Intent();
179 | intent.setAction(Intent.ACTION_MAIN);
180 | intent.setClass(this, LicenseActivity.class);
181 | startActivity(intent);
182 | return true;
183 | } else if (preference == mPickBg) {
184 | Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
185 | long drawerWidthdip = Common.getDrawerWidthdip(this);
186 | intent.setType("image/*")
187 | .putExtra("crop", "true")
188 | .putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString())
189 | .putExtra("outputX", dipTopx(this, drawerWidthdip)).putExtra("outputY", dipTopx(this, 160L))
190 | .putExtra("aspectX", 2).putExtra("aspectY", 1)
191 | .putExtra("scale", 1)
192 | .putExtra(MediaStore.EXTRA_OUTPUT, getUriFromFile(getFile(Common.DRAWER_BG_PNG)));
193 | // .putExtra("return-data", true);
194 | try {
195 | startActivityForResult(intent, PICK_BG);
196 | } catch (ActivityNotFoundException e) {
197 | Log.e("WechatMOD", "can not pick pic");
198 | }
199 | } else if (preference.getKey().equals("donate")) {
200 | ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
201 | ClipData clip = ClipData.newPlainText("donate", "darkgentry@hotmail.com");
202 | clipboard.setPrimaryClip(clip);
203 | Toast.makeText(this, getText(R.string.copy_to_clipboard), Toast.LENGTH_LONG).show();
204 | return true;
205 | }
206 | return false;
207 | }
208 |
209 | @Override
210 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
211 | if (requestCode == PICK_BG) {
212 | compressBitmapFileAndcopyToFilesDir(getFile(Common.DRAWER_BG_PNG));
213 | Toast.makeText(this, "Done!", Toast.LENGTH_SHORT).show();
214 | }
215 | }
216 |
217 | private File getFile(String path) {
218 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
219 | File file = new File(this.getExternalFilesDir(null), "/" + path);
220 | return file;
221 | }
222 | return null;
223 | }
224 |
225 | private Uri getUriFromFile(File file) {
226 | if (file != null) {
227 | return Uri.fromFile(file);
228 | } else {
229 | return null;
230 | }
231 | }
232 |
233 | private void compressBitmapFileAndcopyToFilesDir(File file) {
234 | if (file != null) {
235 | FileInputStream fileInputStream = null;
236 | FileOutputStream fileOutputStream = null;
237 | try {
238 | fileInputStream = new FileInputStream(file);
239 | fileOutputStream = this.openFileOutput(file.getName(), Context.MODE_WORLD_READABLE);
240 | BitmapFactory.Options options = new BitmapFactory.Options();
241 | Bitmap bitmap = BitmapFactory.decodeStream(fileInputStream, null, options);
242 | bitmap.compress(Bitmap.CompressFormat.JPEG, 50, fileOutputStream);
243 | bitmap.recycle();
244 | fileInputStream.close();
245 | fileOutputStream.flush();
246 | fileOutputStream.close();
247 | } catch (FileNotFoundException e) {
248 | Log.e("WechatMOD", "FileNotFoundException");
249 | } catch (IOException e) {
250 | Log.e("WechatMOD", "IOException");
251 | }
252 | if (fileInputStream != null) {
253 | try {
254 | fileInputStream.close();
255 | } catch (IOException e) {
256 | Log.e("WechatMOD", "IOException:fileInputStream.close()");
257 | }
258 | }
259 | }
260 | }
261 | }
262 |
--------------------------------------------------------------------------------
/app/src/main/java/chrisrenke/drawerarrowdrawable/DrawerArrowDrawable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 Chris Renke
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package chrisrenke.drawerarrowdrawable;
17 |
18 | import android.content.res.Resources;
19 | import android.graphics.Canvas;
20 | import android.graphics.ColorFilter;
21 | import android.graphics.Matrix;
22 | import android.graphics.Paint;
23 | import android.graphics.Path;
24 | import android.graphics.PathMeasure;
25 | import android.graphics.Rect;
26 | import android.graphics.drawable.Drawable;
27 | import android.view.View;
28 |
29 | import static android.graphics.Color.BLACK;
30 | import static android.graphics.Paint.ANTI_ALIAS_FLAG;
31 | import static android.graphics.Paint.Cap;
32 | import static android.graphics.Paint.Cap.BUTT;
33 | import static android.graphics.Paint.Cap.ROUND;
34 | import static android.graphics.Paint.SUBPIXEL_TEXT_FLAG;
35 | import static android.graphics.Paint.Style.STROKE;
36 | import static android.graphics.PixelFormat.TRANSLUCENT;
37 | import static android.support.v4.widget.DrawerLayout.DrawerListener;
38 | import static java.lang.Math.sqrt;
39 |
40 | /**
41 | * A drawable that rotates between a drawer icon and a back arrow based on parameter.
42 | */
43 | public class DrawerArrowDrawable extends Drawable {
44 |
45 | /**
46 | * Joins two {@link Path}s as if they were one where the first 50% of the path is {@code
47 | * PathFirst} and the second 50% of the path is {@code pathSecond}.
48 | */
49 | private static class JoinedPath {
50 |
51 | private final PathMeasure measureFirst;
52 | private final PathMeasure measureSecond;
53 | private final float lengthFirst;
54 | private final float lengthSecond;
55 |
56 | private JoinedPath(Path pathFirst, Path pathSecond) {
57 | measureFirst = new PathMeasure(pathFirst, false);
58 | measureSecond = new PathMeasure(pathSecond, false);
59 | lengthFirst = measureFirst.getLength();
60 | lengthSecond = measureSecond.getLength();
61 | }
62 |
63 | /**
64 | * Returns a point on this curve at the given {@code parameter}.
65 | * For {@code parameter} values less than .5f, the first path will drive the point.
66 | * For {@code parameter} values greater than .5f, the second path will drive the point.
67 | * For {@code parameter} equal to .5f, the point will be the point where the two
68 | * internal paths connect.
69 | */
70 | private void getPointOnLine(float parameter, float[] coords) {
71 | if (parameter <= .5f) {
72 | parameter *= 2;
73 | measureFirst.getPosTan(lengthFirst * parameter, coords, null);
74 | } else {
75 | parameter -= .5f;
76 | parameter *= 2;
77 | measureSecond.getPosTan(lengthSecond * parameter, coords, null);
78 | }
79 | }
80 | }
81 |
82 | /**
83 | * Draws a line between two {@link JoinedPath}s at distance {@code parameter} along each path.
84 | */
85 | private class BridgingLine {
86 |
87 | private final JoinedPath pathA;
88 | private final JoinedPath pathB;
89 |
90 | private BridgingLine(JoinedPath pathA, JoinedPath pathB) {
91 | this.pathA = pathA;
92 | this.pathB = pathB;
93 | }
94 |
95 | /**
96 | * Draw a line between the points defined on the paths backing {@code measureA} and
97 | * {@code measureB} at the current parameter.
98 | */
99 | private void draw(Canvas canvas) {
100 | pathA.getPointOnLine(parameter, coordsA);
101 | pathB.getPointOnLine(parameter, coordsB);
102 | if (rounded) insetPointsForRoundCaps();
103 | canvas.drawLine(coordsA[0], coordsA[1], coordsB[0], coordsB[1], linePaint);
104 | }
105 |
106 | /**
107 | * Insets the end points of the current line to account for the protruding
108 | * ends drawn for {@link Cap#ROUND} style lines.
109 | */
110 | private void insetPointsForRoundCaps() {
111 | vX = coordsB[0] - coordsA[0];
112 | vY = coordsB[1] - coordsA[1];
113 |
114 | magnitude = (float) sqrt((vX * vX + vY * vY));
115 | paramA = (magnitude - halfStrokeWidthPixel) / magnitude;
116 | paramB = halfStrokeWidthPixel / magnitude;
117 |
118 | coordsA[0] = coordsB[0] - (vX * paramA);
119 | coordsA[1] = coordsB[1] - (vY * paramA);
120 | coordsB[0] = coordsB[0] - (vX * paramB);
121 | coordsB[1] = coordsB[1] - (vY * paramB);
122 | }
123 | }
124 |
125 | /**
126 | * Paths were generated at a 3px/dp density; this is the scale factor for different densities.
127 | */
128 | private final static float PATH_GEN_DENSITY = 3;
129 |
130 | /**
131 | * Paths were generated with at this size for {@link DrawerArrowDrawable#PATH_GEN_DENSITY}.
132 | */
133 | private final static float DIMEN_DP = 23.5f;
134 |
135 | /**
136 | * Paths were generated targeting this stroke width to form the arrowhead properly, modification
137 | * may cause the arrow to not for nicely.
138 | */
139 | private final static float STROKE_WIDTH_DP = 2;
140 |
141 | private BridgingLine topLine;
142 | private BridgingLine middleLine;
143 | private BridgingLine bottomLine;
144 |
145 | private final Rect bounds;
146 | private final float halfStrokeWidthPixel;
147 | private final Paint linePaint;
148 | private final boolean rounded;
149 |
150 | private boolean flip;
151 | private float parameter;
152 |
153 | // Helper fields during drawing calculations.
154 | private float vX, vY, magnitude, paramA, paramB;
155 | private final float coordsA[] = {0f, 0f};
156 | private final float coordsB[] = {0f, 0f};
157 |
158 | public DrawerArrowDrawable(Resources resources) {
159 | this(resources, false);
160 | }
161 |
162 | public DrawerArrowDrawable(Resources resources, boolean rounded) {
163 | this.rounded = rounded;
164 | float density = resources.getDisplayMetrics().density;
165 | float strokeWidthPixel = STROKE_WIDTH_DP * density;
166 | halfStrokeWidthPixel = strokeWidthPixel / 2;
167 |
168 | linePaint = new Paint(SUBPIXEL_TEXT_FLAG | ANTI_ALIAS_FLAG);
169 | linePaint.setStrokeCap(rounded ? ROUND : BUTT);
170 | linePaint.setColor(BLACK);
171 | linePaint.setStyle(STROKE);
172 | linePaint.setStrokeWidth(strokeWidthPixel);
173 |
174 | int dimen = (int) (DIMEN_DP * density);
175 | bounds = new Rect(0, 0, dimen, dimen);
176 |
177 | Path first, second;
178 | JoinedPath joinedA, joinedB;
179 |
180 | // Top
181 | first = new Path();
182 | first.moveTo(5.042f, 20f);
183 | first.rCubicTo(8.125f, -16.317f, 39.753f, -27.851f, 55.49f, -2.765f);
184 | second = new Path();
185 | second.moveTo(60.531f, 17.235f);
186 | second.rCubicTo(11.301f, 18.015f, -3.699f, 46.083f, -23.725f, 43.456f);
187 | scalePath(first, density);
188 | scalePath(second, density);
189 | joinedA = new JoinedPath(first, second);
190 |
191 | first = new Path();
192 | first.moveTo(64.959f, 20f);
193 | first.rCubicTo(4.457f, 16.75f, 1.512f, 37.982f, -22.557f, 42.699f);
194 | second = new Path();
195 | second.moveTo(42.402f, 62.699f);
196 | second.cubicTo(18.333f, 67.418f, 8.807f, 45.646f, 8.807f, 32.823f);
197 | scalePath(first, density);
198 | scalePath(second, density);
199 | joinedB = new JoinedPath(first, second);
200 | topLine = new BridgingLine(joinedA, joinedB);
201 |
202 | // Middle
203 | first = new Path();
204 | first.moveTo(5.042f, 35f);
205 | first.cubicTo(5.042f, 20.333f, 18.625f, 6.791f, 35f, 6.791f);
206 | second = new Path();
207 | second.moveTo(35f, 6.791f);
208 | second.rCubicTo(16.083f, 0f, 26.853f, 16.702f, 26.853f, 28.209f);
209 | scalePath(first, density);
210 | scalePath(second, density);
211 | joinedA = new JoinedPath(first, second);
212 |
213 | first = new Path();
214 | first.moveTo(64.959f, 35f);
215 | first.rCubicTo(0f, 10.926f, -8.709f, 26.416f, -29.958f, 26.416f);
216 | second = new Path();
217 | second.moveTo(35f, 61.416f);
218 | second.rCubicTo(-7.5f, 0f, -23.946f, -8.211f, -23.946f, -26.416f);
219 | scalePath(first, density);
220 | scalePath(second, density);
221 | joinedB = new JoinedPath(first, second);
222 | middleLine = new BridgingLine(joinedA, joinedB);
223 |
224 | // Bottom
225 | first = new Path();
226 | first.moveTo(5.042f, 50f);
227 | first.cubicTo(2.5f, 43.312f, 0.013f, 26.546f, 9.475f, 17.346f);
228 | second = new Path();
229 | second.moveTo(9.475f, 17.346f);
230 | second.rCubicTo(9.462f, -9.2f, 24.188f, -10.353f, 27.326f, -8.245f);
231 | scalePath(first, density);
232 | scalePath(second, density);
233 | joinedA = new JoinedPath(first, second);
234 |
235 | first = new Path();
236 | first.moveTo(64.959f, 50f);
237 | first.rCubicTo(-7.021f, 10.08f, -20.584f, 19.699f, -37.361f, 12.74f);
238 | second = new Path();
239 | second.moveTo(27.598f, 62.699f);
240 | second.rCubicTo(-15.723f, -6.521f, -18.8f, -23.543f, -18.8f, -25.642f);
241 | scalePath(first, density);
242 | scalePath(second, density);
243 | joinedB = new JoinedPath(first, second);
244 | bottomLine = new BridgingLine(joinedA, joinedB);
245 | }
246 |
247 | @Override
248 | public int getIntrinsicHeight() {
249 | return bounds.height();
250 | }
251 |
252 | @Override
253 | public int getIntrinsicWidth() {
254 | return bounds.width();
255 | }
256 |
257 | @Override
258 | public void draw(Canvas canvas) {
259 | if (flip) {
260 | canvas.save();
261 | canvas.scale(1f, -1f, getIntrinsicWidth() / 2, getIntrinsicHeight() / 2);
262 | }
263 |
264 | topLine.draw(canvas);
265 | middleLine.draw(canvas);
266 | bottomLine.draw(canvas);
267 |
268 | if (flip) canvas.restore();
269 | }
270 |
271 | @Override
272 | public void setAlpha(int alpha) {
273 | linePaint.setAlpha(alpha);
274 | invalidateSelf();
275 | }
276 |
277 | @Override
278 | public void setColorFilter(ColorFilter cf) {
279 | linePaint.setColorFilter(cf);
280 | invalidateSelf();
281 | }
282 |
283 | @Override
284 | public int getOpacity() {
285 | return TRANSLUCENT;
286 | }
287 |
288 | public void setStrokeColor(int color) {
289 | linePaint.setColor(color);
290 | invalidateSelf();
291 | }
292 |
293 | /**
294 | * Sets the rotation of this drawable based on {@code parameter} between 0 and 1. Usually driven
295 | * via {@link DrawerListener#onDrawerSlide(View, float)}'s {@code slideOffset} parameter.
296 | */
297 | public void setParameter(float parameter) {
298 | if (parameter > 1 || parameter < 0) {
299 | throw new IllegalArgumentException("Value must be between 1 and zero inclusive!");
300 | }
301 | this.parameter = parameter;
302 | invalidateSelf();
303 | }
304 |
305 | /**
306 | * When false, rotates from 3 o'clock to 9 o'clock between a drawer icon and a back arrow.
307 | * When true, rotates from 9 o'clock to 3 o'clock between a back arrow and a drawer icon.
308 | */
309 | public void setFlip(boolean flip) {
310 | this.flip = flip;
311 | invalidateSelf();
312 | }
313 |
314 | /**
315 | * Scales the paths to the given screen density. If the density matches the
316 | * {@link DrawerArrowDrawable#PATH_GEN_DENSITY}, no scaling needs to be done.
317 | */
318 | private static void scalePath(Path path, float density) {
319 | if (density == PATH_GEN_DENSITY) return;
320 | Matrix scaleMatrix = new Matrix();
321 | scaleMatrix.setScale(density / PATH_GEN_DENSITY, density / PATH_GEN_DENSITY, 0, 0);
322 | path.transform(scaleMatrix);
323 | }
324 | }
--------------------------------------------------------------------------------