diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogDataSaver.java b/app/src/main/java/eu/faircode/email/FragmentDialogDataSaver.java index f2c268cb47..46bdceada8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogDataSaver.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogDataSaver.java @@ -27,6 +27,8 @@ import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; +import android.text.SpannableStringBuilder; +import android.text.style.RelativeSizeSpan; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -39,16 +41,29 @@ public class FragmentDialogDataSaver extends FragmentDialogBase { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { final Context context = getContext(); + SpannableStringBuilder ssb = new SpannableStringBuilderEx(); + ssb.append(context.getString(R.string.title_hint_data_saver)); + ssb.append("\n\n"); + int start = ssb.length(); + ssb.append(context.getString(R.string.title_hint_dismiss)); + ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL), start, ssb.length(), 0); + + Intent saver = new Intent( + Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS, + Uri.parse("package:" + BuildConfig.APPLICATION_ID)); + + Intent settings = (saver.resolveActivity(context.getPackageManager()) == null + ? new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, + Uri.parse("package:" + BuildConfig.APPLICATION_ID)) + : saver); + return new AlertDialog.Builder(context) .setIcon(R.drawable.twotone_data_saver_off_24) .setTitle(R.string.title_setup_data) - .setMessage(R.string.title_hint_data_saver) + .setMessage(ssb) .setPositiveButton(R.string.title_fix, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - Intent settings = new Intent( - Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS, - Uri.parse("package:" + BuildConfig.APPLICATION_ID)); context.startActivity(settings); } }) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b70badec68..6053e1bc2c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2220,6 +2220,7 @@ Notification permissions are required for (account) alerts too. Notifications for new messages can be turned off in the settings. Battery optimizations still enabled If the data saver is enabled, the app will not be able to sync in the background and connection errors may occur. + You can dismiss this dialog box to remove the notice. If you have a question or a problem, please use the support menu to get help Swipe left to trash; Swipe right to archive (if available); The swipe actions can be configured in the account settings Long press a message to start selecting multiple messages; Hold and swipe up or down to select more messages