Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
opt: auto safe mode textview desc
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Apr 7, 2024
1 parent 74099ce commit f38b18d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.hook.demo.ColorTest;
import com.sevtinge.hyperceiler.module.hook.demo.CrashDemo;
import com.sevtinge.hyperceiler.module.hook.demo.ToastTest;

public class Demo extends BaseModule {
@Override
public void handleLoadPackage() {
initHook(new ToastTest(), true);
// initHook(new CrashDemo(), true);
initHook(new CrashDemo(), true);
initHook(new ColorTest(), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void onCreate(@Nullable Bundle bundle) {
String pkg = getReportCrashPkg(code);
View view = LayoutInflater.from(this).inflate(R.layout.crash_report_dialog, null);
mMessageTv = view.findViewById(R.id.tv_message);
mMessageTv.setText("作用域: " + "\n\"" + pkg + "\"\n已进入安全模式,点击确定解除,点击取消稍后处理。");
mMessageTv.setText(pkg + " " + getString(R.string.safe_mode_desc));
mCrashRecordTv = view.findViewById(R.id.tv_record);
mCrashRecordTv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);// 下划线并加清晰
mCrashRecordTv.getPaint().setAntiAlias(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ public void onCreate(Bundle savedInstanceState) {
(ProjectApi.isRelease() ? def : ProjectApi.isCanary() ? (def == 0 ? 3 : 4) : def));
if (haveCrashReport()) {
new AlertDialog.Builder(this)
.setTitle("提示")
.setMessage("存在处于安全模式的作用域: \n" + appCrash.toString() + " \n请选择是否解除?")
.setTitle(R.string.safe_mode_later_title)
.setMessage(appCrash.toString() + " " + getString(R.string.safe_mode_later_desc))
.setHapticFeedbackEnabled(true)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
.setPositiveButton(R.string.safe_mode_cancel, (dialog, which) -> {
ShellInit.getShell().run("setprop persist.hyperceiler.crash.report \"\"").sync();
ShellInit.getShell().run("settings put system hyperceiler_crash_report \"[]\"").sync();
dialog.dismiss();
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss())
.setNegativeButton(R.string.safe_mode_ok, (dialog, which) -> dialog.dismiss())
.show();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ public static void showRestartDialog(Context context) {
public static void showCrashReportDialog(Activity activity, View view) {
new AlertDialog.Builder(activity)
.setCancelable(false)
.setTitle("警告")
.setTitle(R.string.safe_mode_title)
.setView(view)
.setHapticFeedbackEnabled(true)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
.setPositiveButton(R.string.safe_mode_cancel, (dialog, which) -> {
ShellExec shellExec = ShellInit.getShell();
shellExec.run("setprop persist.hyperceiler.crash.report \"\"").sync();
shellExec.run("settings put system hyperceiler_crash_report \"[]\"").sync();
activity.finish();
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> activity.finish())
.setNegativeButton(R.string.safe_mode_ok, (dialog, which) -> activity.finish())
.show();
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/crash_report_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

<TextView
android:id="@+id/tv_message"
android:textColor="@color/textview_black"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />


<TextView
android:id="@+id/tv_record"
android:text="查看异常记录"
android:text="@string/safe_mode_history"
android:textColor="#ff0d84ff"
android:textSize="16sp"
android:layout_width="match_parent"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,14 @@
<string name="disable_suggest">禁用推荐</string>
<string name="enable_suggest">启用推荐</string>

<string name="safe_mode_title">警告</string>
<string name="safe_mode_desc">由于多次崩溃,已进入安全模式,HyperCeiler 功能已暂时停用。\n点击确定解除,点击取消稍后处理。</string>
<string name="safe_mode_history">查看异常记录</string>
<string name="safe_mode_cancel">解除</string>
<string name="safe_mode_ok">稍后处理</string>
<string name="safe_mode_later_title">提示</string>
<string name="safe_mode_later_desc">仍处于安全模式中,HyperCeiler对其的功能已停用。\n是否解除安全模式?</string>

<string name="tip_default">Tip: 这里是默认 tip ~ 如果你能看见我,就说明 HyperCeiler 出现了问题,请及时且有效的反馈给开发者。</string>

<string name="headtip_warn_not_offical_rom">您正在使用的 ROM 来源可能并不是 Xiaomi 官方,部分功能可能会失效,详情请咨询您正在使用 ROM 的提供者。</string>
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,13 @@
<string name="help_cant_see_apps_switch_desc">You can still find this page in \"Settings - Set up the homepage entry\". Reboot app to apply.</string>
<string name="headtip_warn_not_offical_rom">The source of the ROM you are using may not be official from Xiaomi, and some functions may not work, please contact the provider you are using for details.</string>
<string name="headtip_warn_sign_verification_failed">The signature verification failed, and the current version you are using may not be from the official version of Re.chronoRain, and may contain malicious code.</string>
<string name="safe_mode_title">Warning</string>
<string name="safe_mode_desc">has entered safe mode due to multiple crashes and HyperCeiler functionality has been temporarily disabled. \nClick OK to cancel, click Cancel to process later.</string>
<string name="safe_mode_history">View exception records</string>
<string name="safe_mode_cancel">Disable safe mode</string>
<string name="safe_mode_ok">Deal with it later</string>
<string name="safe_mode_later_title">Tip</string>
<string name="safe_mode_later_desc">is still in safe mode and HyperCeiler functionality has been disabled. Disable safe mode?</string>
<string name="tip_default">Tip: Here is the default tip. If you can see me, it means that there is a problem with HyperCeiler, please report it to the developer in a timely and effective manner.</string>

<string name="preference_recommend_tip">Looking for something else?</string>
Expand Down

0 comments on commit f38b18d

Please sign in to comment.