Search in sources :

Example 1 with BackupAccountsDialogFragment

use of com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment in project Aegis by Decad3nce.

the class BackupGoogleAccountsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.backup_layout);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBar.setVisibility(View.VISIBLE);
    context = this;
    Intent intent;
    cr = getContentResolver();
    credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
    try {
        intent = getIntent();
        if (intent.hasExtra("fromReceiver")) {
            address = intent.getStringExtra("fromReceiver");
            Log.i(TAG, "Backup intent from receiver");
            recoverData();
        } else {
            Log.i(TAG, "Backup intent from elsewhere");
            DialogFragment dialog = new BackupAccountsDialogFragment();
            dialog.show(getFragmentManager(), "BackupAccountsDialogFragment");
        }
    } catch (Exception e) {
        recoverData();
    }
}
Also used : BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) DialogFragment(android.app.DialogFragment) BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) GoogleAuthException(com.google.android.gms.auth.GoogleAuthException) UserRecoverableAuthIOException(com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException) IOException(java.io.IOException)

Example 2 with BackupAccountsDialogFragment

use of com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment in project Aegis by Decad3nce.

the class BackupDropboxAccountsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.backup_layout);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBar.setVisibility(View.VISIBLE);
    cr = getContentResolver();
    context = this;
    Intent intent;
    AndroidAuthSession session = buildSession();
    mDBApi = new DropboxAPI<AndroidAuthSession>(session);
    try {
        intent = getIntent();
        if (intent.hasExtra("fromReceiver")) {
            address = intent.getStringExtra("fromReceiver");
            Log.i(TAG, "Backup intent from receiver");
            recoverData();
        } else {
            Log.i(TAG, "Backup intent from elsewhere");
            DialogFragment dialog = new BackupAccountsDialogFragment();
            dialog.show(getFragmentManager(), "BackupAccountsDialogFragment");
        }
    } catch (Exception e) {
        Log.e(TAG, e.toString());
    }
}
Also used : AndroidAuthSession(com.dropbox.client2.android.AndroidAuthSession) BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) DialogFragment(android.app.DialogFragment) BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) Intent(android.content.Intent) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) DropboxUnlinkedException(com.dropbox.client2.exception.DropboxUnlinkedException) DropboxException(com.dropbox.client2.exception.DropboxException)

Aggregations

DialogFragment (android.app.DialogFragment)2 BackupAccountsDialogFragment (com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment)2 IOException (java.io.IOException)2 Intent (android.content.Intent)1 AndroidAuthSession (com.dropbox.client2.android.AndroidAuthSession)1 DropboxException (com.dropbox.client2.exception.DropboxException)1 DropboxUnlinkedException (com.dropbox.client2.exception.DropboxUnlinkedException)1 GoogleAuthException (com.google.android.gms.auth.GoogleAuthException)1 UserRecoverableAuthIOException (com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException)1 FileNotFoundException (java.io.FileNotFoundException)1