mirror of https://github.com/M66B/FairEmail.git
Improved datasaver dialog
This commit is contained in:
parent
93cad5aa7d
commit
9635d5364b
|
@ -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);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -2220,6 +2220,7 @@
|
|||
<string name="title_hint_notifications_remark">Notification permissions are required for (account) alerts too. Notifications for new messages can be turned off in the settings.</string>
|
||||
<string name="title_hint_battery_optimizations">Battery optimizations still enabled</string>
|
||||
<string name="title_hint_data_saver">If the data saver is enabled, the app will not be able to sync in the background and connection errors may occur.</string>
|
||||
<string name="title_hint_dismiss">You can dismiss this dialog box to remove the notice.</string>
|
||||
<string name="title_hint_support">If you have a question or a problem, please use the support menu to get help</string>
|
||||
<string name="title_hint_message_actions">Swipe left to trash; Swipe right to archive (if available); The swipe actions can be configured in the account settings</string>
|
||||
<string name="title_hint_message_selection">Long press a message to start selecting multiple messages; Hold and swipe up or down to select more messages</string>
|
||||
|
|
Loading…
Reference in New Issue