[MA] mejora de opciones para bateria
This commit is contained in:
parent
93398afc8e
commit
a3cc0808e6
|
|
@ -404,36 +404,44 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openBatterySettings(String manufacturer) {
|
private void openBatterySettings(String manufacturer) {
|
||||||
if (manufacturer.contains("oppo") || manufacturer.contains("realme")) {
|
boolean success = false;
|
||||||
try {
|
|
||||||
Intent intent = new Intent();
|
if (manufacturer.contains("oppo") || manufacturer.contains("realme")) {
|
||||||
intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"));
|
try {
|
||||||
startActivity(intent);
|
Intent intent = new Intent();
|
||||||
return;
|
intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"));
|
||||||
} catch (Exception e) {
|
startActivity(intent);
|
||||||
try {
|
success = true;
|
||||||
Intent intent = new Intent();
|
} catch (Exception e) {
|
||||||
intent.setComponent(new ComponentName("com.coloros.oppoguardelf", "com.coloros.oppoguardelf.Permission.BackgroundAllowAppListActivity"));
|
try {
|
||||||
startActivity(intent);
|
Intent intent = new Intent();
|
||||||
return;
|
intent.setComponent(new ComponentName("com.coloros.oppoguardelf", "com.coloros.oppoguardelf.Permission.BackgroundAllowAppListActivity"));
|
||||||
} catch (Exception e2) {}
|
startActivity(intent);
|
||||||
}
|
success = true;
|
||||||
} else if (manufacturer.contains("xiaomi")) {
|
} catch (Exception e2) {}
|
||||||
try {
|
}
|
||||||
Intent intent = new Intent("miui.intent.action.APP_BATTERY_SAVER_SETTINGS");
|
}
|
||||||
intent.setComponent(new ComponentName("com.miui.powerkeeper", "com.miui.powerkeeper.ui.HiddenAppsConfigActivity"));
|
else if (manufacturer.contains("xiaomi")) {
|
||||||
intent.putExtra("package_name", getPackageName());
|
try {
|
||||||
intent.putExtra("package_label", getString(R.string.app_name));
|
Intent intent = new Intent("miui.intent.action.APP_BATTERY_SAVER_SETTINGS");
|
||||||
startActivity(intent);
|
intent.setComponent(new ComponentName("com.miui.powerkeeper", "com.miui.powerkeeper.ui.HiddenAppsConfigActivity"));
|
||||||
return;
|
intent.putExtra("package_name", getPackageName());
|
||||||
} catch (Exception e) {}
|
intent.putExtra("package_label", getString(R.string.app_name));
|
||||||
}
|
startActivity(intent);
|
||||||
|
success = true;
|
||||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
} catch (Exception e) {}
|
||||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
}
|
||||||
startActivity(intent);
|
|
||||||
}
|
if (!success) {
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleTheme() {
|
private void toggleTheme() {
|
||||||
SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue