Skip to content

Commit

Permalink
Add a switch to delete the news or call icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Chipppppppppp committed Feb 11, 2024
1 parent fc861fc commit d4ff32b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
42 changes: 26 additions & 16 deletions app/src/main/java/io/github/chipppppppppp/lime/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.chipppppppppp.lime;

import java.lang.reflect.Method;

import android.app.Activity;
import android.app.Application;
import android.app.Notification;
Expand All @@ -9,9 +11,6 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.support.customtabs.CustomTabsIntent;
import android.view.Gravity;
Expand All @@ -21,17 +20,13 @@
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Switch;
import android.widget.Toast;

import android.app.AndroidAppHelper;
import android.content.res.XModuleResources;

import java.lang.reflect.Method;

import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
Expand Down Expand Up @@ -62,6 +57,7 @@ private LimeOption(String name, int id, boolean checked) {

public LimeOption deleteVoom = new LimeOption("delete_voom", R.string.switch_delete_voom, true);
public LimeOption deleteWallet = new LimeOption("delete_wallet", R.string.switch_delete_wallet, true);
public LimeOption deleteNewsOrCall = new LimeOption("delete_news_or_call", R.string.switch_delete_news_or_call, true);
public LimeOption distributeEvenly = new LimeOption("distribute_evenly", R.string.switch_distribute_evenly, true);
public LimeOption deleteIconLabels = new LimeOption("delete_icon_labels", R.string.switch_delete_icon_labels, true);
public LimeOption deleteAds = new LimeOption("delete_ads", R.string.switch_delete_ads, true);
Expand All @@ -71,7 +67,7 @@ private LimeOption(String name, int id, boolean checked) {
public LimeOption openInBrowser = new LimeOption("open_in_browser", R.string.switch_open_in_browser, false);
public LimeOption preventMarkAsRead = new LimeOption("prevent_mark_as_read", R.string.switch_prevent_mark_as_read, false);
public LimeOption preventUnsendMessage = new LimeOption("prevent_unsend_message", R.string.switch_prevent_unsend_message, false);
public static final int size = 11;
public static final int size = 12;

LimeOption getByIndex(int idx) {
switch (idx) {
Expand All @@ -80,22 +76,24 @@ LimeOption getByIndex(int idx) {
case 1:
return deleteWallet;
case 2:
return distributeEvenly;
return deleteNewsOrCall;
case 3:
return deleteIconLabels;
return distributeEvenly;
case 4:
return deleteAds;
return deleteIconLabels;
case 5:
return deleteRecommendation;
return deleteAds;
case 6:
return deleteReplyMute;
return deleteRecommendation;
case 7:
return redirectWebView;
return deleteReplyMute;
case 8:
return openInBrowser;
return redirectWebView;
case 9:
return preventMarkAsRead;
return openInBrowser;
case 10:
return preventMarkAsRead;
case 11:
return preventUnsendMessage;
default:
throw new IllegalArgumentException("Invalid index: " + idx);
Expand Down Expand Up @@ -242,6 +240,18 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
activity.findViewById(walletSpacerResId).setVisibility(View.GONE);
}
}
if (limeOptions.deleteNewsOrCall.checked) {
int newsResId = activity.getResources().getIdentifier("bnb_news", "id", activity.getPackageName());
activity.findViewById(newsResId).setVisibility(View.GONE);
int callResId = activity.getResources().getIdentifier("bnb_call", "id", activity.getPackageName());
activity.findViewById(callResId).setVisibility(View.GONE);
if (limeOptions.distributeEvenly.checked) {
int newsSpacerResId = activity.getResources().getIdentifier("bnb_news_spacer", "id", activity.getPackageName());
activity.findViewById(newsSpacerResId).setVisibility(View.GONE);
int callSpacerResId = activity.getResources().getIdentifier("bnb_call_spacer", "id", activity.getPackageName());
activity.findViewById(callSpacerResId).setVisibility(View.GONE);
}
}
}
});

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<string name="need_restart">アプリの再起動が必要です</string>
<string name="switch_delete_voom">VOOM アイコンを削除</string>
<string name="switch_delete_wallet">ウォレットアイコンを削除</string>
<string name="switch_delete_news_or_call">ニュースまたは通話アイコンを削除</string>
<string name="switch_distribute_evenly">ボトムバーのアイコンを均等に配置</string>
<string name="switch_delete_icon_labels">ボトムバーのアイコンのラベルを削除</string>
<string name="switch_delete_ads">広告を削除</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<string name="ok">OK</string>
<string name="need_restart">You need to restart the app</string>
<string name="switch_delete_voom">Delete the VOOM icon</string>
<string name="switch_delete_wallet">Delete the Wallet icon</string>
<string name="switch_delete_wallet">Delete the wallet icon</string>
<string name="switch_delete_news_or_call">Delete the news or call icon</string>
<string name="switch_distribute_evenly">Distribute the icons on the bottom bar evenly</string>
<string name="switch_delete_icon_labels">Delete the icon labels on the bottom bar</string>
<string name="switch_delete_ads">Delete ads</string>
Expand Down

0 comments on commit d4ff32b

Please sign in to comment.