-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2、修复高版本底部Tab变成发现/播客 3、修复推送 4、修复高版本播放页面黑胶无法隐藏 5、修复高版本广告拦截造成的阻塞
- Loading branch information
Showing
10 changed files
with
155 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/raincat/dolby_beta/hook/NightModeHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.raincat.dolby_beta.hook; | ||
|
||
import android.content.Context; | ||
import android.content.res.Configuration; | ||
import android.util.Pair; | ||
|
||
import com.raincat.dolby_beta.helper.SettingHelper; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
import static de.robv.android.xposed.XposedHelpers.findClass; | ||
|
||
/** | ||
* <pre> | ||
* author : RainCat | ||
* e-mail : [email protected] | ||
* time : 2021/12/03 | ||
* desc : 夜间模式 | ||
* version: 1.0 | ||
* </pre> | ||
*/ | ||
|
||
public class NightModeHook { | ||
private String resourceRouterInstanceMethodString = "getInstance"; | ||
private String resourceRouterIsNightThemeMethodString = "isNightTheme"; | ||
private String themeAgentInstanceMethodString = "getInstance"; | ||
private String themeAgentSwitchTheme = "switchTheme"; | ||
|
||
public NightModeHook(Context context, int versionCode) { | ||
if (!SettingHelper.getInstance().isEnable(SettingHelper.beauty_night_mode_key)) | ||
return; | ||
Class<?> superActivityClass = findClass("com.netease.cloudmusic.activity.MainActivity", context.getClassLoader()); | ||
while (superActivityClass != null && !superActivityClass.getName().contains("AppCompatActivity")) | ||
superActivityClass = superActivityClass.getSuperclass(); | ||
|
||
String resourceRouterClassString = "com.netease.cloudmusic.theme.core.ResourceRouter"; | ||
String themeAgentClassString = "com.netease.cloudmusic.theme.core.ThemeAgent"; | ||
String themeConfigClassString = "com.netease.cloudmusic.theme.core.ThemeConfig"; | ||
String themeInfoClassString = "com.netease.cloudmusic.theme.core.ThemeInfo"; | ||
|
||
if (versionCode == 110) { | ||
resourceRouterClassString = "com.netease.cloudmusic.theme.core.b"; | ||
themeAgentClassString = "com.netease.cloudmusic.theme.core.c"; | ||
themeConfigClassString = "com.netease.cloudmusic.theme.core.f"; | ||
resourceRouterInstanceMethodString = "a"; | ||
resourceRouterIsNightThemeMethodString = "d"; | ||
themeAgentInstanceMethodString = "a"; | ||
themeAgentSwitchTheme = "a"; | ||
} | ||
|
||
final Class<?> resourceRouterClass = XposedHelpers.findClassIfExists(resourceRouterClassString, context.getClassLoader()); | ||
final Class<?> themeAgentClass = XposedHelpers.findClassIfExists(themeAgentClassString, context.getClassLoader()); | ||
final Class<?> themeConfigClass = XposedHelpers.findClassIfExists(themeConfigClassString, context.getClassLoader()); | ||
final Class<?> themeInfoClass = XposedHelpers.findClassIfExists(themeInfoClassString, context.getClassLoader()); | ||
|
||
XposedHelpers.findAndHookMethod(superActivityClass, "onStart", new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
super.afterHookedMethod(param); | ||
Context c = (Context) param.thisObject; | ||
Object resourceRouter = XposedHelpers.callStaticMethod(resourceRouterClass, resourceRouterInstanceMethodString); | ||
boolean isNight = (boolean) XposedHelpers.callMethod(resourceRouter, resourceRouterIsNightThemeMethodString); | ||
int nightModeFlags = c.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; | ||
if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES && !isNight) { | ||
Object themeAgent = XposedHelpers.callStaticMethod(themeAgentClass, themeAgentInstanceMethodString); | ||
Object themeInfo = XposedHelpers.newInstance(themeInfoClass, -3); | ||
XposedHelpers.callMethod(themeAgent, themeAgentSwitchTheme, c, themeInfo, true); | ||
} else if (nightModeFlags == Configuration.UI_MODE_NIGHT_NO && isNight) { | ||
Object themeAgent = XposedHelpers.callStaticMethod(themeAgentClass, themeAgentInstanceMethodString); | ||
if (versionCode == 110) { | ||
int prevThemeInfo = (int) XposedHelpers.callStaticMethod(themeConfigClass, "m"); | ||
Object themeInfo = XposedHelpers.newInstance(themeInfoClass, prevThemeInfo); | ||
XposedHelpers.callMethod(themeAgent, themeAgentSwitchTheme, c, themeInfo, true); | ||
} else { | ||
Pair<Integer, Boolean> prevThemeInfo = (Pair<Integer, Boolean>) XposedHelpers.callStaticMethod(themeConfigClass, "getPrevThemeInfo"); | ||
Object themeInfo = XposedHelpers.newInstance(themeInfoClass, prevThemeInfo.first); | ||
XposedHelpers.callMethod(themeAgent, themeAgentSwitchTheme, c, themeInfo, true); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/raincat/dolby_beta/view/beauty/BeautyNightModeView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.raincat.dolby_beta.view.beauty; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
|
||
import com.raincat.dolby_beta.helper.SettingHelper; | ||
import com.raincat.dolby_beta.view.BaseDialogItem; | ||
|
||
/** | ||
* <pre> | ||
* author : RainCat | ||
* e-mail : [email protected] | ||
* time : 2021/12/03 | ||
* desc : 夜间模式 | ||
* version: 1.0 | ||
* </pre> | ||
*/ | ||
|
||
public class BeautyNightModeView extends BaseDialogItem { | ||
public BeautyNightModeView(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
public BeautyNightModeView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public BeautyNightModeView(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public void init(Context context, AttributeSet attrs) { | ||
super.init(context, attrs); | ||
title = SettingHelper.beauty_night_mode_title; | ||
sub = SettingHelper.beauty_night_mode_sub; | ||
key = SettingHelper.beauty_night_mode_key; | ||
setData(true, SettingHelper.getInstance().getSetting(key)); | ||
|
||
setOnClickListener(view -> { | ||
SettingHelper.getInstance().setSetting(key, !checkBox.isChecked()); | ||
sendBroadcast(SettingHelper.refresh_setting); | ||
}); | ||
} | ||
} |