Search in sources :

Example 6 with LoadingDialog

use of com.owncloud.android.ui.dialog.LoadingDialog in project android by owncloud.

the class AuthenticatorActivity method onGetOAuthAccessTokenFinish.

/**
     * Processes the result of the request for and access token send 
     * to an OAuth authorization server.
     * 
     * @param result        Result of the operation.
     */
private void onGetOAuthAccessTokenFinish(RemoteOperationResult result) {
    mWaitingForOpId = Long.MAX_VALUE;
    dismissDialog(WAIT_DIALOG_TAG);
    if (result.isSuccess()) {
        /// be gentle with the user
        LoadingDialog dialog = LoadingDialog.newInstance(R.string.auth_trying_to_login, true);
        dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);
        /// time to test the retrieved access token on the ownCloud server
        @SuppressWarnings("unchecked") Map<String, String> tokens = (Map<String, String>) (result.getData().get(0));
        mAuthToken = tokens.get(OAuth2Constants.KEY_ACCESS_TOKEN);
        Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);
        /// validate token accessing to root folder / getting session
        OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);
        accessRootFolder(credentials);
    } else {
        updateAuthStatusIconAndText(result);
        showAuthStatus();
        Log_OC.d(TAG, "Access failed: " + result.getLogMessage());
    }
}
Also used : LoadingDialog(com.owncloud.android.ui.dialog.LoadingDialog) Map(java.util.Map) OwnCloudCredentials(com.owncloud.android.lib.common.OwnCloudCredentials)

Example 7 with LoadingDialog

use of com.owncloud.android.ui.dialog.LoadingDialog in project android by owncloud.

the class LogHistoryActivity method dismissLoadingDialog.

/**
     * Dismiss loading dialog
     */
public void dismissLoadingDialog() {
    Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG);
    if (frag != null) {
        LoadingDialog loading = (LoadingDialog) frag;
        loading.dismiss();
    }
}
Also used : LoadingDialog(com.owncloud.android.ui.dialog.LoadingDialog) Fragment(android.support.v4.app.Fragment)

Aggregations

LoadingDialog (com.owncloud.android.ui.dialog.LoadingDialog)7 Fragment (android.support.v4.app.Fragment)3 FragmentManager (android.support.v4.app.FragmentManager)2 FragmentTransaction (android.support.v4.app.FragmentTransaction)2 OwnCloudCredentials (com.owncloud.android.lib.common.OwnCloudCredentials)2 ConfirmationDialogFragment (com.owncloud.android.ui.dialog.ConfirmationDialogFragment)2 Intent (android.content.Intent)1 Map (java.util.Map)1