-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.优化判断歌曲音质逻辑,减少匹配错误概率
- Loading branch information
Showing
17 changed files
with
217 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/raincat/dolby_beta/hook/CommentHotClickHook.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,65 @@ | ||
package com.raincat.dolby_beta.hook; | ||
|
||
import android.content.Context; | ||
|
||
import com.raincat.dolby_beta.helper.ClassHelper; | ||
import com.raincat.dolby_beta.helper.SettingHelper; | ||
|
||
import org.json.JSONArray; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
/** | ||
* <pre> | ||
* author : RainCat | ||
* e-mail : nining377@gmail.com | ||
* time : 2020/05/30 | ||
* desc : 评论区优先显示“最热”内容 | ||
* version: 1.0 | ||
* </pre> | ||
*/ | ||
public class CommentHotClickHook { | ||
public CommentHotClickHook(Context context) { | ||
if (!SettingHelper.getInstance().isEnable(SettingHelper.beauty_comment_hot_key)) | ||
return; | ||
Class<?> commentDataClass = ClassHelper.CommentDataClass.getClazz(context); | ||
if (commentDataClass != null) { | ||
XposedBridge.hookAllConstructors(commentDataClass, new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
super.afterHookedMethod(param); | ||
Object object = param.thisObject; | ||
Field[] fields = object.getClass().getDeclaredFields(); | ||
for (Field field : fields) { | ||
if (Modifier.isPrivate(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) && field.getType() == int.class) { | ||
field.setAccessible(true); | ||
Object o = field.get(object); | ||
if ((int) o == 0) | ||
field.set(object, 2); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
Class<?> sortTypeListClass = XposedHelpers.findClassIfExists("com.netease.cloudmusic.module.comment2.meta.SortTypeList", context.getClassLoader()); | ||
if (sortTypeListClass != null) | ||
XposedHelpers.findAndHookMethod(sortTypeListClass, "parseList", JSONArray.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
super.beforeHookedMethod(param); | ||
JSONArray array = (JSONArray) param.args[0]; | ||
JSONArray array2 = new JSONArray(); | ||
array2.put(array.getJSONObject(1)); | ||
array2.put(array.getJSONObject(2)); | ||
array2.put(array.getJSONObject(0)); | ||
param.args[0] = array2; | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.