mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 13:47:05 +02:00
Added importing provider profiles
This commit is contained in:
@@ -142,6 +142,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||
static final int REQUEST_OAUTH = 7;
|
||||
static final int REQUEST_STILL = 8;
|
||||
static final int REQUEST_DELETE_ACCOUNT = 9;
|
||||
static final int REQUEST_IMPORT_PROVIDERS = 10;
|
||||
|
||||
static final int PI_MISC = 1;
|
||||
|
||||
@@ -462,6 +463,10 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleImportCertificate(data);
|
||||
break;
|
||||
case REQUEST_IMPORT_PROVIDERS:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleImportProviders(data);
|
||||
break;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
@@ -1543,6 +1548,34 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||
}
|
||||
}
|
||||
|
||||
private void handleImportProviders(Intent data) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("uri", data.getData());
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
Uri uri = args.getParcelable("uri");
|
||||
|
||||
Log.i("Reading URI=" + uri);
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
EmailProvider.importProfiles(resolver.openInputStream(uri), context);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ToastEx.makeText(ActivitySetup.this, R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getSupportFragmentManager(), ex);
|
||||
}
|
||||
}.execute(this, args, "import:providers");
|
||||
}
|
||||
|
||||
private void onGmail(Intent intent) {
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, new FragmentGmail()).addToBackStack("quick");
|
||||
|
||||
Reference in New Issue
Block a user