1
0
mirror of https://github.com/areteruhiro/LIME-beta-hiro.git synced 2025-02-05 21:11:39 +09:00

コードの変更

This commit is contained in:
areteruhiro 2025-02-01 23:44:00 +09:00
parent 2d91178756
commit 87836c1607
4 changed files with 410 additions and 450 deletions

View File

@ -9,8 +9,8 @@ android {
defaultConfig {
minSdk 28
targetSdk 35
versionCode 11613
versionName "1.16.13beta"
versionCode 11614
versionName "1.16.14"
multiDexEnabled false
proguardFiles += 'proguard-rules.pro'
buildConfigField 'String', 'HOOK_TARGET_VERSION', '"141910383"'

View File

@ -27,9 +27,9 @@ public class Constants {
//無効にする
static HookTarget RemoveVoiceRecord_Hook_a = new HookTarget("af0.e", "run");
//有効から無効
static HookTarget RemoveVoiceRecord_Hook_b = new HookTarget("xg1.e$a", "run");
//無効から有効
static HookTarget RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
// static HookTarget RemoveVoiceRecord_Hook_b = new HookTarget("xg1.e$a", "run");
////無効から有効
//static HookTarget RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
public static void initializeHooks(LoadPackageParam loadPackageParam) {
Context context = (Context) XposedHelpers.callMethod(XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
@ -54,9 +54,9 @@ static HookTarget RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
NOTIFICATION_READ_HOOK = new HookTarget("qd1.b", "invokeSuspend");
REQUEST_HOOK = new HookTarget("org.apache.thrift.l", "b");
RESPONSE_HOOK = new HookTarget("org.apache.thrift.l", "a");
RemoveVoiceRecord_Hook_a = new HookTarget("q.j", "run");
RemoveVoiceRecord_Hook_b = new HookTarget("xg1.e$a", "run");
RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
RemoveVoiceRecord_Hook_a = new HookTarget("af0.e", "run");
// RemoveVoiceRecord_Hook_b = new HookTarget("xg1.e$a", "run");
// RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
} else if (versionName.equals("14.21.1")) {
USER_AGENT_HOOK = new HookTarget("vf1.c", "j");
WEBVIEW_CLIENT_HOOK = new HookTarget("pN0.l", "onPageFinished");
@ -67,8 +67,8 @@ static HookTarget RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
REQUEST_HOOK = new HookTarget("org.apache.thrift.l", "b");
RESPONSE_HOOK = new HookTarget("org.apache.thrift.l", "a");
RemoveVoiceRecord_Hook_a = new HookTarget("q.j", "run");
RemoveVoiceRecord_Hook_b = new HookTarget("Fi1.j", "run");
RemoveVoiceRecord_Hook_c = new HookTarget("Fi1.j", "run");
// RemoveVoiceRecord_Hook_b = new HookTarget("Fi1.j", "run");
// RemoveVoiceRecord_Hook_c = new HookTarget("Fi1.j", "run");
} else if (versionName.equals("15.0.0")) {
USER_AGENT_HOOK = new HookTarget("Sg1.c", "j");
WEBVIEW_CLIENT_HOOK = new HookTarget("FO0.l", "onPageFinished");
@ -79,8 +79,8 @@ static HookTarget RemoveVoiceRecord_Hook_c = new HookTarget("TS.f", "run");
REQUEST_HOOK = new HookTarget("org.apache.thrift.l", "b");
RESPONSE_HOOK = new HookTarget("org.apache.thrift.l", "a");
RemoveVoiceRecord_Hook_a = new HookTarget("q.j", "run");
RemoveVoiceRecord_Hook_b = new HookTarget("uk1.e$a", "run");
RemoveVoiceRecord_Hook_c = new HookTarget("C30.f", "run");
// RemoveVoiceRecord_Hook_b = new HookTarget("uk1.e$a", "run");
// RemoveVoiceRecord_Hook_c = new HookTarget("C30.f", "run");
}
}

View File

@ -60,399 +60,241 @@ public class EmbedOptions implements IHook {
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (Main.xModulePrefs.getBoolean("unembed_options", false)) return;
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass("com.linecorp.line.settings.main.LineUserMainSettingsFragment"),
"onViewCreated",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass("com.linecorp.line.settings.main.LineUserMainSettingsFragment"),
"onViewCreated",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Context contextV = (Context) XposedHelpers.callMethod(XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
"currentActivityThread"
), "getSystemContext");
Context contextV = (Context) XposedHelpers.callMethod(XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
"currentActivityThread"
), "getSystemContext");
PackageManager pm = contextV.getPackageManager();
String versionName = ""; // 初期化
try {
versionName = pm.getPackageInfo(loadPackageParam.packageName, 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
PackageManager pm = contextV.getPackageManager();
String versionName = ""; // 初期化
try {
versionName = pm.getPackageInfo(loadPackageParam.packageName, 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
CustomPreferences customPreferences = new CustomPreferences();
for (LimeOptions.Option option : limeOptions.options) {
option.checked = Boolean.parseBoolean(customPreferences.getSetting(option.name, String.valueOf(option.checked)));
}
Context moduleContext = AndroidAppHelper.currentApplication().createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
ViewGroup viewGroup = ((ViewGroup) param.args[0]);
Context context = viewGroup.getContext();
Utils.addModuleAssetPath(context);
LinearLayout layout = new LinearLayout(context);
layout.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
Switch switchRedirectWebView = null;
for (LimeOptions.Option option : limeOptions.options) {
final String name = option.name;
Switch switchView = new Switch(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
switchView.setLayoutParams(params);
switchView.setText(option.id);
switchView.setChecked(option.checked);
if (name.equals("redirect_webview"))
switchRedirectWebView = switchView;
else if (name.equals("open_in_browser")) {
switchRedirectWebView.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) switchView.setEnabled(true);
else {
switchView.setChecked(false);
switchView.setEnabled(false);
}
});
switchView.setEnabled(limeOptions.redirectWebView.checked);
}
CustomPreferences customPreferences = new CustomPreferences();
layout.addView(switchView);
for (LimeOptions.Option option : limeOptions.options) {
option.checked = Boolean.parseBoolean(customPreferences.getSetting(option.name, String.valueOf(option.checked)));
}
Context moduleContext = AndroidAppHelper.currentApplication().createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
ViewGroup viewGroup = ((ViewGroup) param.args[0]);
Context context = viewGroup.getContext();
Utils.addModuleAssetPath(context);
LinearLayout layout = new LinearLayout(context);
layout.setLayoutParams(new LinearLayout.LayoutParams(
}
{
final String script = new String(Base64.decode(customPreferences.getSetting("encoded_js_modify_request", ""), Base64.NO_WRAP));
LinearLayout layoutModifyRequest = new LinearLayout(context);
layoutModifyRequest.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
layoutModifyRequest.setOrientation(LinearLayout.VERTICAL);
layoutModifyRequest.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
Switch switchRedirectWebView = null;
for (LimeOptions.Option option : limeOptions.options) {
final String name = option.name;
EditText editText = new EditText(context);
editText.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
editText.setTypeface(Typeface.MONOSPACE);
editText.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_MULTI_LINE |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
editText.setMovementMethod(new ScrollingMovementMethod());
editText.setTextIsSelectable(true);
editText.setHorizontallyScrolling(true);
editText.setVerticalScrollBarEnabled(true);
editText.setHorizontalScrollBarEnabled(true);
editText.setText(script);
Switch switchView = new Switch(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
switchView.setLayoutParams(params);
switchView.setText(option.id);
switchView.setChecked(option.checked);
layoutModifyRequest.addView(editText);
if (name.equals("redirect_webview"))
switchRedirectWebView = switchView;
else if (name.equals("open_in_browser")) {
switchRedirectWebView.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) switchView.setEnabled(true);
else {
switchView.setChecked(false);
switchView.setEnabled(false);
}
});
switchView.setEnabled(limeOptions.redirectWebView.checked);
LinearLayout buttonLayout = new LinearLayout(context);
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
buttonParams.topMargin = Utils.dpToPx(10, context);
buttonLayout.setLayoutParams(buttonParams);
buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
Button copyButton = new Button(context);
copyButton.setText(R.string.button_copy);
copyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", editText.getText().toString());
clipboard.setPrimaryClip(clip);
}
});
layout.addView(switchView);
buttonLayout.addView(copyButton);
}
{
final String script = new String(Base64.decode(customPreferences.getSetting("encoded_js_modify_request", ""), Base64.NO_WRAP));
LinearLayout layoutModifyRequest = new LinearLayout(context);
layoutModifyRequest.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
layoutModifyRequest.setOrientation(LinearLayout.VERTICAL);
layoutModifyRequest.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
EditText editText = new EditText(context);
editText.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
editText.setTypeface(Typeface.MONOSPACE);
editText.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_MULTI_LINE |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
editText.setMovementMethod(new ScrollingMovementMethod());
editText.setTextIsSelectable(true);
editText.setHorizontallyScrolling(true);
editText.setVerticalScrollBarEnabled(true);
editText.setHorizontalScrollBarEnabled(true);
editText.setText(script);
layoutModifyRequest.addView(editText);
LinearLayout buttonLayout = new LinearLayout(context);
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
buttonParams.topMargin = Utils.dpToPx(10, context);
buttonLayout.setLayoutParams(buttonParams);
buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
Button copyButton = new Button(context);
copyButton.setText(R.string.button_copy);
copyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", editText.getText().toString());
clipboard.setPrimaryClip(clip);
}
});
buttonLayout.addView(copyButton);
Button pasteButton = new Button(context);
pasteButton.setText(R.string.button_paste);
pasteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null && clipboard.hasPrimaryClip()) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
CharSequence pasteData = clip.getItemAt(0).getText();
editText.setText(pasteData);
}
Button pasteButton = new Button(context);
pasteButton.setText(R.string.button_paste);
pasteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null && clipboard.hasPrimaryClip()) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
CharSequence pasteData = clip.getItemAt(0).getText();
editText.setText(pasteData);
}
}
});
buttonLayout.addView(pasteButton);
layoutModifyRequest.addView(buttonLayout);
ScrollView scrollView = new ScrollView(context);
scrollView.addView(layoutModifyRequest);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.modify_request);
builder.setView(scrollView);
Button backupButton = new Button(context);
buttonParams.topMargin = Utils.dpToPx(20, context);
backupButton.setLayoutParams(buttonParams);
backupButton.setText(moduleContext.getResources().getString(R.string.Back_Up));
backupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
backupChatHistory(context, moduleContext);
}
});
layout.addView(backupButton);
Button restoreButton = new Button(context);
restoreButton.setLayoutParams(buttonParams);
restoreButton.setText(moduleContext.getResources().getString(R.string.Restore));
restoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
restoreChatHistory(context, moduleContext);
}
});
layout.addView(restoreButton);
Button backupfolderButton = new Button(context);
backupfolderButton.setLayoutParams(buttonParams);
backupfolderButton.setText(moduleContext.getResources().getString(R.string.Talk_Picture_Back_up));
backupfolderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
backupChatsFolder(context, moduleContext);
}
});
layout.addView(backupfolderButton);
Button restorefolderButton = new Button(context);
restorefolderButton.setLayoutParams(buttonParams);
restorefolderButton.setText(moduleContext.getResources().getString(R.string.Picure_Restore));
restorefolderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
restoreChatsFolder(context, moduleContext);
}
});
layout.addView(restorefolderButton);
if (limeOptions.MuteGroup.checked) {
Button MuteGroups_Button = new Button(context);
MuteGroups_Button.setLayoutParams(buttonParams);
MuteGroups_Button.setText(moduleContext.getResources().getString(R.string.Mute_Group));
MuteGroups_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MuteGroups_Button(context, moduleContext);
}
});
layout.addView(MuteGroups_Button);
}
});
Button KeepUnread_Button = new Button(context);
KeepUnread_Button.setLayoutParams(buttonParams);
KeepUnread_Button.setText(moduleContext.getResources().getString(R.string.edit_margin_settings));
KeepUnread_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
KeepUnread_Button(context, moduleContext);
}
});
layout.addView(KeepUnread_Button);
if (limeOptions.preventUnsendMessage.checked) {
Button canceled_message_Button = new Button(context);
canceled_message_Button.setLayoutParams(buttonParams);
canceled_message_Button.setText(moduleContext.getResources().getString(R.string.canceled_message));
canceled_message_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cancel_Message_Button(context, moduleContext);
}
});
layout.addView(canceled_message_Button);
}
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String code = editText.getText().toString();
if (!code.equals(script)) {
// CustomPreferencesのインスタンスを作成
CustomPreferences customPreferences = null;
try {
customPreferences = new CustomPreferences();
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
// Base64エンコードして設定を保存
String encodedCode = Base64.encodeToString(code.getBytes(), Base64.NO_WRAP);
customPreferences.saveSetting("encoded_js_modify_request", encodedCode);
Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show();
Process.killProcess(Process.myPid());
context.startActivity(new Intent().setClassName(Constants.PACKAGE_NAME, "jp.naver.line.android.activity.SplashActivity"));
}
}
});
builder.setNegativeButton(R.string.negative_button, null);
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
editText.setText(script);
}
});
AlertDialog dialog = builder.create();
Button button = new Button(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
button.setLayoutParams(params);
button.setText(R.string.modify_request);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.show();
}
});
layout.addView(button);
}
{
final String script = new String(Base64.decode(customPreferences.getSetting("encoded_js_modify_response", ""), Base64.NO_WRAP));
LinearLayout layoutModifyResponse = new LinearLayout(context);
layoutModifyResponse.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
layoutModifyResponse.setOrientation(LinearLayout.VERTICAL);
layoutModifyResponse.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
EditText editText = new EditText(context);
editText.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
editText.setTypeface(Typeface.MONOSPACE);
editText.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_MULTI_LINE |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
editText.setMovementMethod(new ScrollingMovementMethod());
editText.setTextIsSelectable(true);
editText.setHorizontallyScrolling(true);
editText.setVerticalScrollBarEnabled(true);
editText.setHorizontalScrollBarEnabled(true);
editText.setText(script);
layoutModifyResponse.addView(editText);
LinearLayout buttonLayout = new LinearLayout(context);
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
buttonParams.topMargin = Utils.dpToPx(10, context);
buttonLayout.setLayoutParams(buttonParams);
buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
Button copyButton = new Button(context);
copyButton.setText(R.string.button_copy);
copyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", editText.getText().toString());
clipboard.setPrimaryClip(clip);
}
});
buttonLayout.addView(copyButton);
Button pasteButton = new Button(context);
pasteButton.setText(R.string.button_paste);
pasteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null && clipboard.hasPrimaryClip()) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
CharSequence pasteData = clip.getItemAt(0).getText();
editText.setText(pasteData);
}
}
}
});
buttonLayout.addView(pasteButton);
layoutModifyResponse.addView(buttonLayout);
ScrollView scrollView = new ScrollView(context);
scrollView.addView(layoutModifyResponse);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.modify_response);
builder.setView(scrollView);
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String code = editText.getText().toString();
if (!code.equals(script)) {
customPreferences.saveSetting("encoded_js_modify_response", Base64.encodeToString(code.getBytes(), Base64.NO_WRAP)); Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show();
Process.killProcess(Process.myPid());
context.startActivity(new Intent().setClassName(Constants.PACKAGE_NAME, "jp.naver.line.android.activity.SplashActivity"));
}
}
});
builder.setNegativeButton(R.string.negative_button, null);
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
editText.setText(script);
}
});
AlertDialog dialog = builder.create();
Button button = new Button(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
button.setLayoutParams(params);
button.setText(R.string.modify_response);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.show();
}
});
layout.addView(button);
}
buttonLayout.addView(pasteButton);
layoutModifyRequest.addView(buttonLayout);
ScrollView scrollView = new ScrollView(context);
scrollView.addView(layout);
scrollView.addView(layoutModifyRequest);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.options_title);
.setTitle(R.string.modify_request);
builder.setView(scrollView);
Button backupButton = new Button(context);
buttonParams.topMargin = Utils.dpToPx(20, context);
backupButton.setLayoutParams(buttonParams);
backupButton.setText(moduleContext.getResources().getString(R.string.Back_Up));
backupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
backupChatHistory(context, moduleContext);
}
});
layout.addView(backupButton);
Button restoreButton = new Button(context);
restoreButton.setLayoutParams(buttonParams);
restoreButton.setText(moduleContext.getResources().getString(R.string.Restore));
restoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
restoreChatHistory(context, moduleContext);
}
});
layout.addView(restoreButton);
Button backupfolderButton = new Button(context);
backupfolderButton.setLayoutParams(buttonParams);
backupfolderButton.setText(moduleContext.getResources().getString(R.string.Talk_Picture_Back_up));
backupfolderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
backupChatsFolder(context, moduleContext);
}
});
layout.addView(backupfolderButton);
Button restorefolderButton = new Button(context);
restorefolderButton.setLayoutParams(buttonParams);
restorefolderButton.setText(moduleContext.getResources().getString(R.string.Picure_Restore));
restorefolderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
restoreChatsFolder(context, moduleContext);
}
});
layout.addView(restorefolderButton);
if (limeOptions.MuteGroup.checked) {
Button MuteGroups_Button = new Button(context);
MuteGroups_Button.setLayoutParams(buttonParams);
MuteGroups_Button.setText(moduleContext.getResources().getString(R.string.Mute_Group));
MuteGroups_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MuteGroups_Button(context, moduleContext);
}
});
layout.addView(MuteGroups_Button);
}
Button KeepUnread_Button = new Button(context);
KeepUnread_Button.setLayoutParams(buttonParams);
KeepUnread_Button.setText(moduleContext.getResources().getString(R.string.edit_margin_settings));
KeepUnread_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
KeepUnread_Button(context, moduleContext);
}
});
layout.addView(KeepUnread_Button);
if (limeOptions.preventUnsendMessage.checked) {
Button canceled_message_Button = new Button(context);
canceled_message_Button.setLayoutParams(buttonParams);
canceled_message_Button.setText(moduleContext.getResources().getString(R.string.canceled_message));
canceled_message_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cancel_Message_Button(context, moduleContext);
}
});
layout.addView(canceled_message_Button);
}
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
boolean optionChanged = false;
for (int i = 0; i < limeOptions.options.length; ++i) {
Switch switchView = (Switch) layout.getChildAt(i);
if (limeOptions.options[i].checked != switchView.isChecked()) {
optionChanged = true;
String code = editText.getText().toString();
if (!code.equals(script)) {
// CustomPreferencesのインスタンスを作成
CustomPreferences customPreferences = null;
try {
customPreferences = new CustomPreferences();
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
customPreferences.saveSetting(limeOptions.options[i].name, String.valueOf(switchView.isChecked()));
}
// Base64エンコードして設定を保存
String encodedCode = Base64.encodeToString(code.getBytes(), Base64.NO_WRAP);
customPreferences.saveSetting("encoded_js_modify_request", encodedCode);
if (optionChanged) {
Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show();
Process.killProcess(Process.myPid());
context.startActivity(new Intent().setClassName(Constants.PACKAGE_NAME, "jp.naver.line.android.activity.SplashActivity"));
@ -465,39 +307,124 @@ public class EmbedOptions implements IHook {
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
for (int i = 0; i < limeOptions.options.length; ++i) {
Switch switchView = (Switch) layout.getChildAt(i);
switchView.setChecked(limeOptions.options[i].checked);
}
editText.setText(script);
}
});
AlertDialog dialog = builder.create();
Button button = new Button(context);
button.setText(R.string.app_name);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
button.setLayoutParams(params);
button.setText(R.string.modify_request);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.show();
}
});
layout.addView(button);
}
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.TOP | Gravity.END;
layoutParams.rightMargin = Utils.dpToPx(10, context);
{
final String script = new String(Base64.decode(customPreferences.getSetting("encoded_js_modify_response", ""), Base64.NO_WRAP));
LinearLayout layoutModifyResponse = new LinearLayout(context);
layoutModifyResponse.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
layoutModifyResponse.setOrientation(LinearLayout.VERTICAL);
layoutModifyResponse.setPadding(Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context), Utils.dpToPx(20, context));
EditText editText = new EditText(context);
editText.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
editText.setTypeface(Typeface.MONOSPACE);
editText.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_MULTI_LINE |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
editText.setMovementMethod(new ScrollingMovementMethod());
editText.setTextIsSelectable(true);
editText.setHorizontallyScrolling(true);
editText.setVerticalScrollBarEnabled(true);
editText.setHorizontalScrollBarEnabled(true);
editText.setText(script);
layoutModifyResponse.addView(editText);
LinearLayout buttonLayout = new LinearLayout(context);
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
buttonParams.topMargin = Utils.dpToPx(10, context);
buttonLayout.setLayoutParams(buttonParams);
buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
// ステータスバーの高さを取得
int statusBarHeight = getStatusBarHeight(context);
Button copyButton = new Button(context);
copyButton.setText(R.string.button_copy);
copyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", editText.getText().toString());
clipboard.setPrimaryClip(clip);
}
});
// ステータスバーの高さに係数0.1を掛けて調整
buttonLayout.addView(copyButton);
Button pasteButton = new Button(context);
pasteButton.setText(R.string.button_paste);
pasteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null && clipboard.hasPrimaryClip()) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
CharSequence pasteData = clip.getItemAt(0).getText();
editText.setText(pasteData);
}
}
}
});
String versionNameStr = String.valueOf(versionName);
String majorVersionStr = versionNameStr.split("\\.")[0]; // Extract the major version number
int versionNameInt = Integer.parseInt(majorVersionStr); // Convert the major version to an integer
buttonLayout.addView(pasteButton);
layoutModifyResponse.addView(buttonLayout);
ScrollView scrollView = new ScrollView(context);
scrollView.addView(layoutModifyResponse);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.modify_response);
builder.setView(scrollView);
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String code = editText.getText().toString();
if (!code.equals(script)) {
customPreferences.saveSetting("encoded_js_modify_response", Base64.encodeToString(code.getBytes(), Base64.NO_WRAP)); Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show();
Process.killProcess(Process.myPid());
context.startActivity(new Intent().setClassName(Constants.PACKAGE_NAME, "jp.naver.line.android.activity.SplashActivity"));
}
}
});
if (versionNameInt >= 15) {
layoutParams.topMargin = (int) (statusBarHeight); // Set margin to status bar height
} else {
layoutParams.topMargin = Utils.dpToPx(5, context); // Set margin to 5dp
}
button.setLayoutParams(layoutParams);
builder.setNegativeButton(R.string.negative_button, null);
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
editText.setText(script);
}
});
AlertDialog dialog = builder.create();
Button button = new Button(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = Utils.dpToPx(20, context);
button.setLayoutParams(params);
button.setText(R.string.modify_response);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -505,15 +432,88 @@ public class EmbedOptions implements IHook {
}
});
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
frameLayout.addView(button);
viewGroup.addView(frameLayout);
layout.addView(button);
}
}
);
}
ScrollView scrollView = new ScrollView(context);
scrollView.addView(layout);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(R.string.options_title);
builder.setView(scrollView);
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
boolean optionChanged = false;
for (int i = 0; i < limeOptions.options.length; ++i) {
Switch switchView = (Switch) layout.getChildAt(i);
if (limeOptions.options[i].checked != switchView.isChecked()) {
optionChanged = true;
}
customPreferences.saveSetting(limeOptions.options[i].name, String.valueOf(switchView.isChecked()));
}
if (optionChanged) {
Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show();
Process.killProcess(Process.myPid());
context.startActivity(new Intent().setClassName(Constants.PACKAGE_NAME, "jp.naver.line.android.activity.SplashActivity"));
}
}
});
builder.setNegativeButton(R.string.negative_button, null);
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
for (int i = 0; i < limeOptions.options.length; ++i) {
Switch switchView = (Switch) layout.getChildAt(i);
switchView.setChecked(limeOptions.options[i].checked);
}
}
});
AlertDialog dialog = builder.create();
Button button = new Button(context);
button.setText(R.string.app_name);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.TOP | Gravity.END;
layoutParams.rightMargin = Utils.dpToPx(10, context);
// ステータスバーの高さを取得
int statusBarHeight = getStatusBarHeight(context);
// ステータスバーの高さに係数0.1を掛けて調整
String versionNameStr = String.valueOf(versionName);
String majorVersionStr = versionNameStr.split("\\.")[0]; // Extract the major version number
int versionNameInt = Integer.parseInt(majorVersionStr); // Convert the major version to an integer
if (versionNameInt >= 15) {
layoutParams.topMargin = (int) (statusBarHeight); // Set margin to status bar height
} else {
layoutParams.topMargin = Utils.dpToPx(5, context); // Set margin to 5dp
}
button.setLayoutParams(layoutParams);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.show();
}
});
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
frameLayout.addView(button);
viewGroup.addView(frameLayout);
}
}
);
}
@ -978,7 +978,7 @@ public class EmbedOptions implements IHook {
File backupDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "LimeBackup");
if (!backupDir.exists()) {
if (!backupDir.mkdirs()) {
return;}}
return;}}
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
String backupFileNameWithTimestamp = "naver_line_backup_" + timeStamp + ".db";
@ -1269,4 +1269,4 @@ public class EmbedOptions implements IHook {
}
}
}
}

View File

@ -9,8 +9,6 @@ import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import io.github.hiro.lime.LimeOptions;
public class RemoveVoiceRecord implements IHook {
private boolean isXg1EaRunCalled = false;
private String versionCodeStr; // フィールドとして定義
@Override
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
@ -22,49 +20,11 @@ public class RemoveVoiceRecord implements IHook {
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (isXg1EaRunCalled) {
return;
}
param.setResult(null);
}
}
);
Context context = (Context) XposedHelpers.callMethod(XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
"currentActivityThread"
), "getSystemContext");
PackageManager pm = context.getPackageManager();
String versionName = ""; // 初期化
versionName = pm.getPackageInfo(loadPackageParam.packageName, 0).versionName;
versionName = String.valueOf(versionName);
if (versionName.equals("14.19.1")) {
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass(Constants.RemoveVoiceRecord_Hook_b.className),
"run",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
isXg1EaRunCalled = false;
}
}
);
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass(Constants.RemoveVoiceRecord_Hook_c.className),
"run",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
isXg1EaRunCalled = true;
}
}
);
}
}
}