Browse Source

Added export/import warnings

main
M66B 6 years ago
parent
commit
5d68a1654c
2 changed files with 45 additions and 9 deletions
  1. +42
    -8
      app/src/main/java/eu/faircode/email/FragmentSetup.java
  2. +3
    -1
      app/src/main/res/values/strings.xml

+ 42
- 8
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -369,17 +369,11 @@ public class FragmentSetup extends FragmentEx {
return true; return true;
case R.id.menu_export: case R.id.menu_export:
if (Helper.isPro(getContext()))
startActivityForResult(getIntentExport(), ActivitySetup.REQUEST_EXPORT);
else {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
}
onMenuExport();
return true; return true;
case R.id.menu_import: case R.id.menu_import:
startActivityForResult(getIntentImport(), ActivitySetup.REQUEST_IMPORT);
onMenuImport();
return true; return true;
case R.id.menu_privacy: case R.id.menu_privacy:
@ -433,6 +427,46 @@ public class FragmentSetup extends FragmentEx {
fragmentTransaction.commit(); fragmentTransaction.commit();
} }
private void onMenuExport() {
if (Helper.isPro(getContext()))
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(R.string.title_setup_export_do)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
startActivityForResult(getIntentExport(), ActivitySetup.REQUEST_EXPORT);
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
}
})
.create()
.show();
else {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
}
}
private void onMenuImport() {
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(R.string.title_setup_import_do)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
startActivityForResult(getIntentImport(), ActivitySetup.REQUEST_IMPORT);
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
}
})
.create()
.show();
}
private void onMenuAbout() { private void onMenuAbout() {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentAbout()).addToBackStack("about"); fragmentTransaction.replace(R.id.content_frame, new FragmentAbout()).addToBackStack("about");


+ 3
- 1
app/src/main/res/values/strings.xml View File

@ -56,8 +56,10 @@
<string name="title_edit_folder">Edit folder</string> <string name="title_edit_folder">Edit folder</string>
<string name="title_setup">Setup</string> <string name="title_setup">Setup</string>
<string name="title_setup_export">Export settings (no passwords)</string>
<string name="title_setup_export">Export settings</string>
<string name="title_setup_import">Import settings</string> <string name="title_setup_import">Import settings</string>
<string name="title_setup_export_do">Accounts and identities will be exported without passwords</string>
<string name="title_setup_import_do">Imported accounts will be added, not overwritten</string>
<string name="title_setup_exported">Settings exported</string> <string name="title_setup_exported">Settings exported</string>
<string name="title_setup_imported">Settings imported</string> <string name="title_setup_imported">Settings imported</string>
<string name="title_setup_account">Manage accounts</string> <string name="title_setup_account">Manage accounts</string>


Loading…
Cancel
Save