Skip to content

Commit

Permalink
音声ボタンを無効化する機能の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
areteruhiro committed Jan 20, 2025
1 parent dcd9985 commit 194549f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public Option(String name, int id, boolean checked) {
public Option outputCommunication = new Option("output_communication", R.string.switch_output_communication, false);
public Option archived = new Option("archived_message", R.string.switch_archived, false);
public Option callTone = new Option("call_tone", R.string.call_tone, false);
public Option RemoveVoiceRecord = new Option("RemoveVoiceRecord", R.string.RemoveVoiceRecord, false);


public Option[] options = {
removeVoom,
Expand Down
5 changes: 4 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 @@ -32,6 +32,7 @@
import io.github.chipppppppppp.lime.hooks.RemoveIconLabels;
import io.github.chipppppppppp.lime.hooks.RemoveIcons;
import io.github.chipppppppppp.lime.hooks.RemoveReplyMute;
import io.github.chipppppppppp.lime.hooks.RemoveVoiceRecord;
import io.github.chipppppppppp.lime.hooks.Ringtone;
import io.github.chipppppppppp.lime.hooks.SendMuteMessage;
import io.github.chipppppppppp.lime.hooks.SpoofAndroidId;
Expand Down Expand Up @@ -71,7 +72,9 @@ public class Main implements IXposedHookLoadPackage, IXposedHookInitPackageResou
new Ringtone(),
new UnsentCap(),
new KeepUnreadLSpatch(),
new NaviColor()
new NaviColor(),
new RemoveVoiceRecord()

};

public void handleLoadPackage(@NonNull XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

if (limeOptions.extendClickableArea.checked) {
int mainTabContainerResId = activity.getResources().getIdentifier("main_tab_container", "id", activity.getPackageName());
ViewGroup mainTabContainer = (ViewGroup) activity.findViewById(mainTabContainerResId);
ViewGroup mainTabContainer = activity.findViewById(mainTabContainerResId);
for (int i = 2; i < mainTabContainer.getChildCount(); i += 2) {
ViewGroup icon = (ViewGroup) mainTabContainer.getChildAt(i);
ViewGroup.LayoutParams layoutParams = icon.getLayoutParams();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package io.github.chipppppppppp.lime.hooks;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import io.github.chipppppppppp.lime.LimeOptions;

//もっといい方法があるかもしれません

public class RemoveVoiceRecord implements IHook {
private boolean isXg1EaRunCalled = true;
@Override
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (!limeOptions.RemoveVoiceRecord.checked) return;

XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass("xg1.e$a"),
"run",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
isXg1EaRunCalled = true;
}

}
);
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass("TS.f"),
"run",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
isXg1EaRunCalled = false;
}

}
);
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass("af0.e"),
"run",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (isXg1EaRunCalled) {
return;
}
param.setResult(null);
}
}
);
}
}
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 @@ -72,4 +72,5 @@
<string name="confirm_delete">本当に削除しますか?</string>
<string name="no_backup_found">何もバックアップされていません</string>
<string name="no_get_restart_app">正しく取得できませんでした。\nアプリを再起動してください</string>
<string name="RemoveVoiceRecord">音声ボタンを無効化</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
<string name="button_paste">貼上</string>
<!-- Menu -->
<string name="switch_keep_unread">保持未讀</string>
<string name="RemoveVoiceRecord">禁用音訊按鈕</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
<string name="confirm_delete">Really want to delete it?</string>
<string name="no_backup_found">Nothing backed up</string>
<string name="no_get_restart_app">Could not get properly.\nPlease restart the app</string>
<string name="RemoveVoiceRecord">Disable microphone button</string>
</resources>

0 comments on commit 194549f

Please sign in to comment.