Android 15 preparations

pull/215/head
M66B 1 year ago
parent 3994216cc5
commit 3b1a31621f

@ -856,6 +856,9 @@ public class ApplicationEx extends Application
if (Build.PRODUCT == null || !Build.PRODUCT.endsWith("_beta") || if (Build.PRODUCT == null || !Build.PRODUCT.endsWith("_beta") ||
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
editor.putBoolean("mod", false); editor.putBoolean("mod", false);
} else if (version < 2180) {
if (Helper.isAndroid15())
editor.putInt("last_sdk", 0);
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
@ -865,6 +868,11 @@ public class ApplicationEx extends Application
editor.putInt("previous_version", version); editor.putInt("previous_version", version);
editor.putInt("version", BuildConfig.VERSION_CODE); editor.putInt("version", BuildConfig.VERSION_CODE);
int last_sdk = prefs.getInt("last_sdk", Build.VERSION.SDK_INT);
if (Helper.isAndroid15() && last_sdk <= Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
editor.remove("setup_reminder");
editor.putInt("last_sdk", Build.VERSION.SDK_INT);
editor.apply(); editor.apply();
} }

@ -50,6 +50,7 @@ public class FragmentDialogPermissions extends FragmentDialogBase {
TextView tvContactPermissions = dview.findViewById(R.id.tvContactPermissions); TextView tvContactPermissions = dview.findViewById(R.id.tvContactPermissions);
TextView tvNotificationPermissions = dview.findViewById(R.id.tvNotificationPermissions); TextView tvNotificationPermissions = dview.findViewById(R.id.tvNotificationPermissions);
TextView tvDozeDevice = dview.findViewById(R.id.tvDozeDevice); TextView tvDozeDevice = dview.findViewById(R.id.tvDozeDevice);
TextView tvDozeAndroid15 = dview.findViewById(R.id.tvDozeAndroid15);
TextView tvDozeAndroid12 = dview.findViewById(R.id.tvDozeAndroid12); TextView tvDozeAndroid12 = dview.findViewById(R.id.tvDozeAndroid12);
CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain); CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
Group grp2 = dview.findViewById(R.id.grp2); Group grp2 = dview.findViewById(R.id.grp2);
@ -82,6 +83,7 @@ public class FragmentDialogPermissions extends FragmentDialogBase {
tvContactPermissions.setVisibility(hasContactPermissions ? View.GONE : View.VISIBLE); tvContactPermissions.setVisibility(hasContactPermissions ? View.GONE : View.VISIBLE);
tvNotificationPermissions.setVisibility(hasNotificationPermissions ? View.GONE : View.VISIBLE); tvNotificationPermissions.setVisibility(hasNotificationPermissions ? View.GONE : View.VISIBLE);
tvDozeDevice.setVisibility(Helper.isKilling() && !isIgnoring ? View.VISIBLE : View.GONE); tvDozeDevice.setVisibility(Helper.isKilling() && !isIgnoring ? View.VISIBLE : View.GONE);
tvDozeAndroid15.setVisibility(Helper.isAndroid15() && !isIgnoring ? View.VISIBLE : View.GONE);
tvDozeAndroid12.setVisibility(!canScheduleExact && !isIgnoring ? View.VISIBLE : View.GONE); tvDozeAndroid12.setVisibility(!canScheduleExact && !isIgnoring ? View.VISIBLE : View.GONE);
grp2.setVisibility( grp2.setVisibility(

@ -132,6 +132,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
private TextView tvDozeDone; private TextView tvDozeDone;
private Button btnDoze; private Button btnDoze;
private TextView tvDoze15;
private TextView tvDoze12; private TextView tvDoze12;
private TextView tvDozeWhy; private TextView tvDozeWhy;
private TextView tvKilling; private TextView tvKilling;
@ -227,6 +228,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
tvDozeDone = view.findViewById(R.id.tvDozeDone); tvDozeDone = view.findViewById(R.id.tvDozeDone);
btnDoze = view.findViewById(R.id.btnDoze); btnDoze = view.findViewById(R.id.btnDoze);
tvDoze15 = view.findViewById(R.id.tvDoze15);
tvDoze12 = view.findViewById(R.id.tvDoze12); tvDoze12 = view.findViewById(R.id.tvDoze12);
tvDozeWhy = view.findViewById(R.id.tvDozeWhy); tvDozeWhy = view.findViewById(R.id.tvDozeWhy);
tvKilling = view.findViewById(R.id.tvKilling); tvKilling = view.findViewById(R.id.tvKilling);
@ -883,6 +885,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
tvDozeDone.setCompoundDrawables(null, null, null, null); tvDozeDone.setCompoundDrawables(null, null, null, null);
btnDoze.setText(null); btnDoze.setText(null);
btnDoze.setCompoundDrawables(null, null, null, null); btnDoze.setCompoundDrawables(null, null, null, null);
tvDoze15.setVisibility(View.GONE);
tvDoze12.setVisibility(View.GONE); tvDoze12.setVisibility(View.GONE);
btnInbox.setEnabled(false); btnInbox.setEnabled(false);
@ -1034,6 +1037,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
0, 0, isIgnoring ? R.drawable.twotone_settings_24 : R.drawable.twotone_check_24, 0); 0, 0, isIgnoring ? R.drawable.twotone_settings_24 : R.drawable.twotone_check_24, 0);
btnDoze.setText(isIgnoring ? R.string.title_setup_manage : R.string.title_setup_grant); btnDoze.setText(isIgnoring ? R.string.title_setup_manage : R.string.title_setup_grant);
tvDoze15.setVisibility(Helper.isAndroid15() && !isIgnoring ? View.VISIBLE : View.GONE);
tvDoze12.setVisibility(!canScheduleExact && !isIgnoring ? View.VISIBLE : View.GONE); tvDoze12.setVisibility(!canScheduleExact && !isIgnoring ? View.VISIBLE : View.GONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {

@ -1687,6 +1687,10 @@ public class Helper {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S); return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
} }
static boolean isAndroid15() {
return (Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE);
}
static String getMIUIVersion() { static String getMIUIVersion() {
try { try {
Class<?> c = Class.forName("android.os.SystemProperties"); Class<?> c = Class.forName("android.os.SystemProperties");

@ -118,6 +118,22 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDoze" /> app:layout_constraintTop_toBottomOf="@id/tvDoze" />
<TextView
android:id="@+id/tvDozeAndroid15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp"
android:drawableTint="?attr/colorWarning"
android:text="@string/title_setup_fg_15"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDozeDevice" />
<TextView <TextView
android:id="@+id/tvDozeAndroid12" android:id="@+id/tvDozeAndroid12"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -132,7 +148,7 @@
android:textStyle="bold" android:textStyle="bold"
app:drawableTint="?attr/colorWarning" app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDozeDevice" /> app:layout_constraintTop_toBottomOf="@id/tvDozeAndroid15" />
<CheckBox <CheckBox
android:id="@+id/cbNotAgain" android:id="@+id/cbNotAgain"

@ -853,6 +853,21 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDoze" /> app:layout_constraintTop_toBottomOf="@id/tvDoze" />
<TextView
android:id="@+id/tvDoze15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_fg_15"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDoze" />
<TextView <TextView
android:id="@+id/tvDoze12" android:id="@+id/tvDoze12"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -866,7 +881,7 @@
android:textStyle="bold" android:textStyle="bold"
app:drawableTint="?attr/colorWarning" app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDoze" /> app:layout_constraintTop_toBottomOf="@id/tvDoze15" />
<TextView <TextView
android:id="@+id/tvDozeHint" android:id="@+id/tvDozeHint"

@ -293,6 +293,7 @@
<string name="title_setup_doze_stopped">Sync stopped?</string> <string name="title_setup_doze_stopped">Sync stopped?</string>
<string name="title_setup_doze_device">This is probably required for this device</string> <string name="title_setup_doze_device">This is probably required for this device</string>
<string name="title_setup_alarm_12">The app won\'t work properly</string> <string name="title_setup_alarm_12">The app won\'t work properly</string>
<string name="title_setup_fg_15">The app cannot be started automatically</string>
<string name="title_setup_inexact">Alarms &amp; reminders are disabled</string> <string name="title_setup_inexact">Alarms &amp; reminders are disabled</string>
<string name="title_setup_background">Background restrictions are enabled</string> <string name="title_setup_background">Background restrictions are enabled</string>
<string name="title_setup_data">Data saver is enabled</string> <string name="title_setup_data">Data saver is enabled</string>

Loading…
Cancel
Save