Skip to content

Commit

Permalink
Fix bugs about ad blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Chipppppppppp committed Jan 19, 2024
1 parent 921c026 commit 1777fbf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion app/src/main/java/io/github/chipppppppppp/lime/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

public class Main implements IXposedHookLoadPackage {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lparam) throws Throwable {
if (!lparam.packageName.equals("jp.naver.line.android")) return;
XSharedPreferences prefs = new XSharedPreferences("io.github.chipppppppppp.lime", "settings");
prefs.reload();
boolean deleteVoom = prefs.getBoolean("delete_voom", true);
Expand All @@ -42,7 +43,21 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.findAndHookMethod(hookTarget, "onAttachedToWindow", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
((ViewGroup) ((View) param.thisObject).getParent().getParent().getParent()).removeAllViews();
ViewGroup viewGroup = ((ViewGroup) ((View) param.thisObject).getParent().getParent().getParent());
viewGroup.setVisibility(View.GONE);
ViewGroup.LayoutParams layoutParams = viewGroup.getLayoutParams();
layoutParams.height = 0;
viewGroup.setLayoutParams(layoutParams);
}
});
XposedHelpers.findAndHookMethod(hookTarget, "onDrawForeground", Canvas.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
ViewGroup viewGroup = ((ViewGroup) ((View) param.thisObject).getParent().getParent().getParent());
viewGroup.setVisibility(View.GONE);
ViewGroup.LayoutParams layoutParams = viewGroup.getLayoutParams();
layoutParams.height = 0;
viewGroup.setLayoutParams(layoutParams);
}
});
hookTarget = lparam.classLoader.loadClass("com.linecorp.line.admolin.smartch.v2.view.SmartChannelViewLayout");
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<string-array name="xposed_scope">
<item>jp.naver.line.android</item>
</string-array>

<string-array name="reply_entries">
<item>Reply</item>
<item>Reply to all</item>
Expand Down

0 comments on commit 1777fbf

Please sign in to comment.