feat: add some tips for develop
Some checks failed
Build Check / build (push) Has been cancelled
CodeQL / Analyze (java) (push) Has been cancelled

This commit is contained in:
ZCShou 2025-08-10 22:00:01 +08:00
parent d38d022742
commit 1f4763300a
3 changed files with 17 additions and 5 deletions

View File

@ -420,11 +420,15 @@ public class MainActivity extends BaseActivity implements SensorEventListener {
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(intent);
} else if (id == R.id.nav_dev) {
try {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
startActivity(intent);
} catch (Exception e) {
if (!GoUtils.isDeveloperOptionsEnabled(this)) {
GoUtils.DisplayToast(this, getResources().getString(R.string.app_error_dev));
} else {
try {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
startActivity(intent);
} catch (Exception e) {
GoUtils.DisplayToast(this, getResources().getString(R.string.app_error_dev));
}
}
} else if (id == R.id.nav_update) {
checkUpdateVersion(true);

View File

@ -28,6 +28,14 @@ import java.util.List;
import java.util.Locale;
public class GoUtils {
public static boolean isDeveloperOptionsEnabled(Context context) {
return Settings.Global.getInt(
context.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
0
) == 1;
}
// WIFI是否可用
public static boolean isWifiConnected(Context context) {
// API 29 开始NetworkInfo 被标记为过时这里更换新方法

View File

@ -34,7 +34,7 @@
<string name="app_error_input_null">输入不能为空,请重新输入内容</string>
<string name="app_error_search">查找失败,请检查网络或定位</string>
<string name="app_error_location">请先选择位置</string>
<string name="app_error_dev">无法跳转到开发者选项,请先确保已开启开发者模式</string>
<string name="app_error_dev">开发者模式未开启,无法跳转!请自行搜索开启方法</string>
<string name="app_error_param">非法参数</string>
<string name="app_error_protocol">请先阅读并接收用户协议</string>
<string name="app_error_username">用户名不合法</string>