pull/212/head
M66B 3 years ago
parent 2902053f37
commit 1ec3ef4979

@ -59,7 +59,7 @@ public class FragmentDialogPermissions extends FragmentDialogBase {
tvDozeDevice.setOnClickListener(new View.OnClickListener() { tvDozeDevice.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Helper.view(context, Uri.parse(Helper.DONTKILL_URI), true); Helper.view(v.getContext(), Uri.parse(Helper.DONTKILL_URI), true);
} }
}); });

@ -113,6 +113,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
private Button btnDoze; private Button btnDoze;
private TextView tvDoze12; private TextView tvDoze12;
private TextView tvDozeWhy; private TextView tvDozeWhy;
private TextView tvKilling;
private Button btnBackgroundRestricted; private Button btnBackgroundRestricted;
private Button btnDataSaver; private Button btnDataSaver;
@ -200,6 +201,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
btnDoze = view.findViewById(R.id.btnDoze); btnDoze = view.findViewById(R.id.btnDoze);
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);
btnBackgroundRestricted = view.findViewById(R.id.btnBackgroundRestricted); btnBackgroundRestricted = view.findViewById(R.id.btnBackgroundRestricted);
btnDataSaver = view.findViewById(R.id.btnDataSaver); btnDataSaver = view.findViewById(R.id.btnDataSaver);
@ -588,6 +590,15 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
} }
}); });
tvKilling.setPaintFlags(tvKilling.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
tvKilling.setVisibility(Helper.isAggressivelyKilling() ? View.VISIBLE : View.GONE);
tvKilling.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.view(v.getContext(), Uri.parse(Helper.DONTKILL_URI), true);
}
});
tvStamina.setPaintFlags(tvStamina.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); tvStamina.setPaintFlags(tvStamina.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
tvStamina.setOnClickListener(new View.OnClickListener() { tvStamina.setOnClickListener(new View.OnClickListener() {
@Override @Override

@ -1514,6 +1514,14 @@ public class Helper {
isSony()); isSony());
} }
static boolean isAggressivelyKilling() {
return (BuildConfig.DEBUG ||
isSamsung() ||
isOnePlus() ||
isHuawei() ||
isXiaomi());
}
static boolean isAndroid12() { static boolean isAndroid12() {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S); return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
} }

@ -796,6 +796,21 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDozeHint" /> app:layout_constraintTop_toBottomOf="@id/tvDozeHint" />
<TextView
android:id="@+id/tvKilling"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
android:text="@string/title_setup_doze_aggressively"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDozeWhy" />
<TextView <TextView
android:id="@+id/tvBackgroundRestricted" android:id="@+id/tvBackgroundRestricted"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -809,7 +824,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/tvDozeWhy" /> app:layout_constraintTop_toBottomOf="@id/tvKilling" />
<Button <Button
android:id="@+id/btnBackgroundRestricted" android:id="@+id/btnBackgroundRestricted"

@ -262,6 +262,7 @@
<string name="title_setup_doze_remark">To send and receive email reliably in the background</string> <string name="title_setup_doze_remark">To send and receive email reliably in the background</string>
<string name="title_setup_doze_explanation">Battery optimizations should be disabled for the app to ensure reliable sending and receiving of messages in the background</string> <string name="title_setup_doze_explanation">Battery optimizations should be disabled for the app to ensure reliable sending and receiving of messages in the background</string>
<string name="title_setup_doze_hint">Although this may sound contradictory, turning off battery optimizations for this app will result in less battery usage</string> <string name="title_setup_doze_hint">Although this may sound contradictory, turning off battery optimizations for this app will result in less battery usage</string>
<string name="title_setup_doze_aggressively">This device could aggressively stop apps</string>
<string name="title_setup_doze_why">Why should battery optimizations be disabled?</string> <string name="title_setup_doze_why">Why should battery optimizations be disabled?</string>
<string name="title_setup_doze_instructions">In the next Android dialog change "Not optimized" to "All apps", select this app and select "Don\'t optimize"</string> <string name="title_setup_doze_instructions">In the next Android dialog change "Not optimized" to "All apps", select this app and select "Don\'t optimize"</string>
<string name="title_setup_doze_battery">High battery usage?</string> <string name="title_setup_doze_battery">High battery usage?</string>

Loading…
Cancel
Save