mirror of
https://github.com/areteruhiro/LIME-beta-hiro.git
synced 2025-02-10 23:41:38 +09:00
Merge branch 'master' into patch-30
This commit is contained in:
commit
a8f16fc78e
@ -9,8 +9,8 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk 28
|
minSdk 28
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 15
|
versionCode 16
|
||||||
versionName "1.10.1"
|
versionName "1.11.0-rc1"
|
||||||
multiDexEnabled false
|
multiDexEnabled false
|
||||||
proguardFiles += 'proguard-rules.pro'
|
proguardFiles += 'proguard-rules.pro'
|
||||||
buildConfigField 'String', 'HOOK_TARGET_VERSION', '"141600311"'
|
buildConfigField 'String', 'HOOK_TARGET_VERSION', '"141600311"'
|
||||||
|
@ -23,6 +23,7 @@ public class LimeOptions {
|
|||||||
public Option removeRecommendation = new Option("remove_recommendation", R.string.switch_remove_recommendation, true);
|
public Option removeRecommendation = new Option("remove_recommendation", R.string.switch_remove_recommendation, true);
|
||||||
public Option removePremiumRecommendation = new Option("remove_premium_recommendation", R.string.switch_remove_premium_recommendation, true);
|
public Option removePremiumRecommendation = new Option("remove_premium_recommendation", R.string.switch_remove_premium_recommendation, true);
|
||||||
public Option removeServiceLabels = new Option("remove_service_labels", R.string.switch_remove_service_labels, false);
|
public Option removeServiceLabels = new Option("remove_service_labels", R.string.switch_remove_service_labels, false);
|
||||||
|
public Option removeAllServices = new Option("remove_services", R.string.switch_remove_service, false);
|
||||||
public Option removeReplyMute = new Option("remove_reply_mute", R.string.switch_remove_reply_mute, true);
|
public Option removeReplyMute = new Option("remove_reply_mute", R.string.switch_remove_reply_mute, true);
|
||||||
public Option redirectWebView = new Option("redirect_webview", R.string.switch_redirect_webview, true);
|
public Option redirectWebView = new Option("redirect_webview", R.string.switch_redirect_webview, true);
|
||||||
public Option openInBrowser = new Option("open_in_browser", R.string.switch_open_in_browser, false);
|
public Option openInBrowser = new Option("open_in_browser", R.string.switch_open_in_browser, false);
|
||||||
@ -37,27 +38,28 @@ public class LimeOptions {
|
|||||||
public Option callTone = new Option("call_tone", R.string.call_tone, false);
|
public Option callTone = new Option("call_tone", R.string.call_tone, false);
|
||||||
|
|
||||||
public Option[] options = {
|
public Option[] options = {
|
||||||
removeVoom,
|
removeVoom,
|
||||||
removeWallet,
|
removeWallet,
|
||||||
removeNewsOrCall,
|
removeNewsOrCall,
|
||||||
distributeEvenly,
|
distributeEvenly,
|
||||||
extendClickableArea,
|
extendClickableArea,
|
||||||
removeIconLabels,
|
removeIconLabels,
|
||||||
removeAds,
|
removeAds,
|
||||||
removeRecommendation,
|
removeRecommendation,
|
||||||
removePremiumRecommendation,
|
removePremiumRecommendation,
|
||||||
removeServiceLabels,
|
removeServiceLabels,
|
||||||
removeReplyMute,
|
removeAllServices,
|
||||||
redirectWebView,
|
removeReplyMute,
|
||||||
openInBrowser,
|
redirectWebView,
|
||||||
preventMarkAsRead,
|
openInBrowser,
|
||||||
preventUnsendMessage,
|
preventMarkAsRead,
|
||||||
archived,
|
preventUnsendMessage,
|
||||||
sendMuteMessage,
|
archived,
|
||||||
removeKeepUnread,
|
sendMuteMessage,
|
||||||
blockTracking,
|
removeKeepUnread,
|
||||||
stopVersionCheck,
|
blockTracking,
|
||||||
outputCommunication,
|
stopVersionCheck,
|
||||||
callTone
|
outputCommunication,
|
||||||
|
callTone
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -23,98 +23,52 @@ import io.github.chipppppppppp.lime.LimeOptions;
|
|||||||
import io.github.chipppppppppp.lime.R;
|
import io.github.chipppppppppp.lime.R;
|
||||||
|
|
||||||
public class KeepUnread implements IHook {
|
public class KeepUnread implements IHook {
|
||||||
static boolean keepUnread = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
|
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
|
||||||
if (limeOptions.removeKeepUnread.checked) return;
|
if (limeOptions.removeKeepUnread.checked) return;
|
||||||
|
|
||||||
XposedBridge.hookAllConstructors(
|
Class<?> hookTarget;
|
||||||
loadPackageParam.classLoader.loadClass("jp.naver.line.android.common.view.listview.PopupListView"),
|
hookTarget = loadPackageParam.classLoader.loadClass("jp.naver.line.android.common.view.listview.PopupListView");
|
||||||
new XC_MethodHook() {
|
XposedBridge.hookAllConstructors(hookTarget, new XC_MethodHook() {
|
||||||
@Override
|
@Override
|
||||||
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
ViewGroup viewGroup = (ViewGroup) param.thisObject;
|
|
||||||
Context context = viewGroup.getContext();
|
|
||||||
context.getApplicationContext().createPackageContext(Constants.MODULE_NAME, Context.CONTEXT_IGNORE_SECURITY);
|
|
||||||
|
|
||||||
Context moduleContext = context.getApplicationContext().createPackageContext(Constants.MODULE_NAME, Context.CONTEXT_IGNORE_SECURITY);
|
ViewGroup viewGroup = (ViewGroup) param.thisObject;
|
||||||
String textKeepUnread = moduleContext.getResources().getString(R.string.switch_keep_unread);
|
Context context = viewGroup.getContext();
|
||||||
|
Context moduleContext = context.getApplicationContext().createPackageContext(Constants.MODULE_NAME, Context.CONTEXT_IGNORE_SECURITY);
|
||||||
|
String textKeepUnread = moduleContext.getResources().getString(R.string.switch_keep_unread);
|
||||||
|
RelativeLayout layout = new RelativeLayout(context);
|
||||||
|
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
|
||||||
|
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
layout.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
keepUnread = readStateFromFile(context);
|
Switch switchView = new Switch(context);
|
||||||
|
switchView.setText(textKeepUnread);
|
||||||
|
RelativeLayout.LayoutParams switchParams = new RelativeLayout.LayoutParams(
|
||||||
|
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
switchParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
|
||||||
|
|
||||||
RelativeLayout container = new RelativeLayout(context);
|
switchView.setChecked(false);
|
||||||
RelativeLayout.LayoutParams containerParams = new RelativeLayout.LayoutParams(
|
switchView.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
});
|
||||||
container.setLayoutParams(containerParams);
|
|
||||||
|
|
||||||
GradientDrawable background = new GradientDrawable();
|
layout.addView(switchView, switchParams);
|
||||||
background.setShape(GradientDrawable.RECTANGLE);
|
|
||||||
background.setColor(Color.parseColor("#06C755"));
|
|
||||||
background.setCornerRadii(new float[]{100, 100, 80, 30, 100, 100, 80, 30});
|
|
||||||
container.setBackground(background);
|
|
||||||
|
|
||||||
TextView label = new TextView(context);
|
((ListView) viewGroup.getChildAt(0)).addFooterView(layout);
|
||||||
label.setText(textKeepUnread);
|
}
|
||||||
label.setTextSize(18);
|
});
|
||||||
label.setTextColor(Color.WHITE);
|
|
||||||
label.setId(View.generateViewId());
|
|
||||||
RelativeLayout.LayoutParams labelParams = new RelativeLayout.LayoutParams(
|
|
||||||
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
labelParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
|
||||||
labelParams.setMargins(40, 0, 0, 0);
|
|
||||||
container.addView(label, labelParams);
|
|
||||||
|
|
||||||
Switch switchView = new Switch(context);
|
|
||||||
RelativeLayout.LayoutParams switchParams = new RelativeLayout.LayoutParams(
|
|
||||||
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
switchParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
|
||||||
switchParams.setMargins(0, 0, 40, 0);
|
|
||||||
switchView.setChecked(keepUnread);
|
|
||||||
switchView.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
|
||||||
keepUnread = isChecked;
|
|
||||||
saveStateToFile(context, isChecked);
|
|
||||||
});
|
|
||||||
|
|
||||||
container.addView(switchView, switchParams);
|
|
||||||
|
|
||||||
((ListView) viewGroup.getChildAt(0)).addFooterView(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
loadPackageParam.classLoader.loadClass(Constants.MARK_AS_READ_HOOK.className),
|
loadPackageParam.classLoader.loadClass(Constants.MARK_AS_READ_HOOK.className),
|
||||||
Constants.MARK_AS_READ_HOOK.methodName,
|
Constants.MARK_AS_READ_HOOK.methodName,
|
||||||
new XC_MethodHook() {
|
new XC_MethodHook() {
|
||||||
@Override
|
@Override
|
||||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
if (keepUnread) {
|
|
||||||
param.setResult(null);
|
param.setResult(null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
private void saveStateToFile(Context context, boolean state) {
|
|
||||||
String filename = "keep_unread_state.txt";
|
|
||||||
try (FileOutputStream fos = context.openFileOutput(filename, Context.MODE_PRIVATE)) {
|
|
||||||
fos.write((state ? "1" : "0").getBytes());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private boolean readStateFromFile(Context context) {
|
|
||||||
String filename = "keep_unread_state.txt";
|
|
||||||
try (FileInputStream fis = context.openFileInput(filename)) {
|
|
||||||
int c;
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
while ((c = fis.read()) != -1) {
|
|
||||||
sb.append((char) c);
|
|
||||||
}
|
|
||||||
return "1".equals(sb.toString());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,16 +24,17 @@ public class RemoveFlexibleContents implements IHook {
|
|||||||
@Override
|
@Override
|
||||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
Context context = (Context) param.thisObject;
|
Context context = (Context) param.thisObject;
|
||||||
recommendationResId = context.getResources().getIdentifier("home_tab_contents_recommendation_placement", "id", context.getPackageName());
|
|
||||||
serviceNameResId = context.getResources().getIdentifier("home_tab_service_name", "id", context.getPackageName());
|
recommendationResId = getIdByName(context, "home_tab_contents_recommendation_placement");
|
||||||
notificationResId = context.getResources().getIdentifier("notification_hub_row_rolling_view_group", "id", context.getPackageName());
|
serviceNameResId = getIdByName(context, "home_tab_service_name");
|
||||||
serviceRowContainerResId = context.getResources().getIdentifier("service_row_container", "id", context.getPackageName());
|
notificationResId = getIdByName(context, "notification_hub_row_rolling_view_group");
|
||||||
serviceIconResId = context.getResources().getIdentifier("home_tab_service_icon", "id", context.getPackageName());
|
serviceRowContainerResId = getIdByName(context, "service_row_container");
|
||||||
serviceCarouselResId = context.getResources().getIdentifier("home_tab_service_carousel", "id", context.getPackageName());
|
serviceIconResId = getIdByName(context, "home_tab_service_icon");
|
||||||
serviceTitleBackgroundResId = context.getResources().getIdentifier("home_tab_service_title_background", "id", context.getPackageName());
|
serviceCarouselResId = getIdByName(context, "home_tab_service_carousel");
|
||||||
serviceTitleResId = context.getResources().getIdentifier("home_tab_service_title", "id", context.getPackageName());
|
serviceTitleBackgroundResId = getIdByName(context, "home_tab_service_title_background");
|
||||||
serviceSeeMoreResId = context.getResources().getIdentifier("home_tab_service_see_more", "id", context.getPackageName());
|
serviceTitleResId = getIdByName(context, "home_tab_service_title");
|
||||||
serviceSeeMoreBadgeResId = context.getResources().getIdentifier("home_tab_service_see_more_badge", "id", context.getPackageName());
|
serviceSeeMoreResId = getIdByName(context, "home_tab_service_see_more");
|
||||||
|
serviceSeeMoreBadgeResId = getIdByName(context, "home_tab_service_see_more_badge");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -42,22 +43,23 @@ public class RemoveFlexibleContents implements IHook {
|
|||||||
View.class,
|
View.class,
|
||||||
"onAttachedToWindow",
|
"onAttachedToWindow",
|
||||||
new XC_MethodHook() {
|
new XC_MethodHook() {
|
||||||
|
View view;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
View view = (View) param.thisObject;
|
view = (View) param.thisObject;
|
||||||
int viewId = view.getId();
|
|
||||||
//String resourceName = getResourceName(view.getContext(), viewId);
|
|
||||||
//XposedBridge.log("View ID: " + viewId + ", Resource Name: " + resourceName);
|
|
||||||
|
|
||||||
|
int viewId = view.getId();
|
||||||
if (limeOptions.removeRecommendation.checked && viewId == recommendationResId
|
if (limeOptions.removeRecommendation.checked && viewId == recommendationResId
|
||||||
|| limeOptions.removeServiceLabels.checked && viewId == serviceNameResId
|
|| limeOptions.removeServiceLabels.checked && viewId == serviceNameResId
|
||||||
|| viewId == serviceRowContainerResId
|
|| limeOptions.removeAllServices.checked && (viewId == serviceRowContainerResId
|
||||||
|| viewId == serviceIconResId
|
|| viewId == serviceIconResId
|
||||||
|| viewId == serviceCarouselResId
|
|| viewId == serviceCarouselResId
|
||||||
|| viewId == serviceTitleBackgroundResId
|
|| viewId == serviceTitleBackgroundResId
|
||||||
|| viewId == serviceTitleResId
|
|| viewId == serviceTitleResId
|
||||||
|| viewId == serviceSeeMoreResId
|
|| viewId == serviceSeeMoreResId
|
||||||
|| viewId == serviceSeeMoreBadgeResId) {
|
|| viewId == serviceSeeMoreBadgeResId))
|
||||||
|
{
|
||||||
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
||||||
layoutParams.height = 0;
|
layoutParams.height = 0;
|
||||||
view.setLayoutParams(layoutParams);
|
view.setLayoutParams(layoutParams);
|
||||||
@ -70,9 +72,8 @@ public class RemoveFlexibleContents implements IHook {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private int getIdByName(Context context, String resourceName) {
|
||||||
private String getResourceName(Context context, int resourceId) {
|
return context.getResources().getIdentifier(resourceName, "id", context.getPackageName());
|
||||||
return context.getResources().getResourceEntryName(resourceId);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<string name="switch_remove_recommendation">おすすめを削除</string>
|
<string name="switch_remove_recommendation">おすすめを削除</string>
|
||||||
<string name="switch_remove_premium_recommendation">LYP プレミアムのおすすめを削除</string>
|
<string name="switch_remove_premium_recommendation">LYP プレミアムのおすすめを削除</string>
|
||||||
<string name="switch_remove_service_labels">サービスのラベルを削除</string>
|
<string name="switch_remove_service_labels">サービスのラベルを削除</string>
|
||||||
|
<string name="switch_remove_service">サービスの項目を削除</string>
|
||||||
<string name="switch_remove_reply_mute">通知から \"通知をオフ\" アクションを削除</string>
|
<string name="switch_remove_reply_mute">通知から \"通知をオフ\" アクションを削除</string>
|
||||||
<string name="switch_redirect_webview">WebView を既定のブラウザにリダイレクト</string>
|
<string name="switch_redirect_webview">WebView を既定のブラウザにリダイレクト</string>
|
||||||
<string name="switch_open_in_browser">ブラウザアプリで開く</string>
|
<string name="switch_open_in_browser">ブラウザアプリで開く</string>
|
||||||
@ -52,6 +53,7 @@
|
|||||||
<string name="button_copy">コピー</string>
|
<string name="button_copy">コピー</string>
|
||||||
<string name="button_paste">ペースト</string>
|
<string name="button_paste">ペースト</string>
|
||||||
<string name="call_tone">着信音を鳴らす(LSPatch用)</string>
|
<string name="call_tone">着信音を鳴らす(LSPatch用)</string>
|
||||||
|
|
||||||
<!-- Menu -->
|
<!-- Menu -->
|
||||||
<string name="switch_keep_unread">未読のまま閲覧</string>
|
<string name="switch_keep_unread">未読のまま閲覧</string>
|
||||||
|
|
||||||
@ -74,5 +76,5 @@
|
|||||||
<string name="confirm_delete">本当に削除しますか?</string>
|
<string name="confirm_delete">本当に削除しますか?</string>
|
||||||
<string name="no_backup_found">何もバックアップされていません</string>
|
<string name="no_backup_found">何もバックアップされていません</string>
|
||||||
<string name="no_get_restart_app">正しく取得できませんでした。\nアプリを再起動してください</string>
|
<string name="no_get_restart_app">正しく取得できませんでした。\nアプリを再起動してください</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -38,6 +38,7 @@
|
|||||||
<string name="switch_remove_recommendation">Remove recommendations</string>
|
<string name="switch_remove_recommendation">Remove recommendations</string>
|
||||||
<string name="switch_remove_premium_recommendation">Remove LYP Premium recommendations</string>
|
<string name="switch_remove_premium_recommendation">Remove LYP Premium recommendations</string>
|
||||||
<string name="switch_remove_service_labels">Remove tbe service labels</string>
|
<string name="switch_remove_service_labels">Remove tbe service labels</string>
|
||||||
|
<string name="switch_remove_service">Remove services item</string>
|
||||||
<string name="switch_remove_reply_mute">Remove the \"Mute chat\" action from notifications</string>
|
<string name="switch_remove_reply_mute">Remove the \"Mute chat\" action from notifications</string>
|
||||||
<string name="switch_redirect_webview">Redirect WebView to the default browser</string>
|
<string name="switch_redirect_webview">Redirect WebView to the default browser</string>
|
||||||
<string name="switch_open_in_browser">Open in the browser app</string>
|
<string name="switch_open_in_browser">Open in the browser app</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user