Skip to content

Commit

Permalink
Fix red dot (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
shatyuka committed Mar 25, 2021
1 parent 9f2ab4b commit ea137b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/main/java/com/shatyuka/zhiliao/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

Expand Down Expand Up @@ -321,7 +322,13 @@ protected void beforeHookedMethod(MethodHookParam param) {

if (Helper.prefs.getBoolean("switch_mainswitch", false) && Helper.prefs.getBoolean("switch_reddot", false)) {
XposedBridge.hookAllMethods(Helper.FeedsTabsFragment, "onUnReadCountLoaded", XC_MethodReplacement.returnConstant(null));
XposedBridge.hookAllMethods(Helper.FeedFollowAvatarCommonViewHolder, "b", XC_MethodReplacement.returnConstant(null));
XposedBridge.hookAllMethods(Helper.FeedFollowAvatarCommonViewHolder, "c", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
ImageView dot = (ImageView)Helper.FeedFollowAvatarCommonViewHolder_dot.get(param.thisObject);
dot.setVisibility(View.GONE);
}
});
XposedHelpers.findAndHookMethod(Helper.ZHMainTabLayout, "d", XC_MethodReplacement.returnConstant(null));
XposedHelpers.findAndHookMethod(Helper.BottomNavMenuItemView, "a", int.class, XC_MethodReplacement.returnConstant(null));
XposedHelpers.findAndHookMethod(Helper.BottomNavMenuItemViewForIconOnly, "a", int.class, XC_MethodReplacement.returnConstant(null));
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/shatyuka/zhiliao/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public class Helper {
static Field ContentMixAdapter_fragment;
static Field ContentMixPagerFragment_type;
static Field FeedList_data;
static Field FeedFollowAvatarCommonViewHolder_dot;

static Pattern regex_title;
static Pattern regex_author;
Expand Down Expand Up @@ -370,6 +371,8 @@ static boolean init(ClassLoader classLoader) {
SearchTopTabsItemList_commercialData = SearchTopTabsItemList.getField("commercialData");
PresetWords_preset = PresetWords.getField("preset");
FeedList_data = classLoader.loadClass("com.zhihu.android.api.model.FeedList").getField("data");
FeedFollowAvatarCommonViewHolder_dot = FeedFollowAvatarCommonViewHolder.getDeclaredField("f");
FeedFollowAvatarCommonViewHolder_dot.setAccessible(true);

regex_title = compileRegex(prefs.getString("edit_title", ""));
regex_author = compileRegex(prefs.getString("edit_author", ""));
Expand Down

0 comments on commit ea137b2

Please sign in to comment.