diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-01 13:58:52 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-01 13:58:52 +0200 |
commit | 1b3f70073ae81a7aee5e6fca3f021bfcfe2065fe (patch) | |
tree | 661ae0aca590a3da3be375eb2863b3502aec0a56 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java | |
parent | 6225c940f9dbc639a90e4627f312329dd99dd2a3 (diff) | |
download | open-keychain-1b3f70073ae81a7aee5e6fca3f021bfcfe2065fe.tar.gz open-keychain-1b3f70073ae81a7aee5e6fca3f021bfcfe2065fe.tar.bz2 open-keychain-1b3f70073ae81a7aee5e6fca3f021bfcfe2065fe.zip |
linked: smooth over progress with tactical pauses
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java index de3493e0a..b59166721 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java @@ -31,6 +31,7 @@ import java.net.URL; import android.os.AsyncTask; import android.os.Bundle; +import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; @@ -172,28 +173,18 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe mButtonContainer.setDisplayedChild(1); - new AsyncTask<Void,Void,Void>() { + new Handler().postDelayed(new Runnable() { @Override - protected Void doInBackground(Void... params) { - try { - Thread.sleep(250); - } catch (InterruptedException e) { - // never mind - } - - return null; - } + public void run() { - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); LinkedIdWizard wizard = (LinkedIdWizard) getActivity(); if (wizard == null) { return; } wizard.oAuthRequest("github.com/login/oauth/authorize", "7a011b66275f244d3f21", "gist"); + } - }.execute(); + }, 250); } @@ -271,15 +262,22 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe } - private void step3EditKey(GithubResource resource) { + private void step3EditKey(final GithubResource resource) { mStatus3.setDisplayedChild(1); - WrappedUserAttribute ua = LinkedAttribute.fromResource(resource).toUserAttribute(); - mSaveKeyringParcel = new SaveKeyringParcel(mMasterKeyId, mFingerprint); - mSaveKeyringParcel.mAddUserAttribute.add(ua); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + + WrappedUserAttribute ua = LinkedAttribute.fromResource(resource).toUserAttribute(); + mSaveKeyringParcel = new SaveKeyringParcel(mMasterKeyId, mFingerprint); + mSaveKeyringParcel.mAddUserAttribute.add(ua); - cryptoOperation(); + cryptoOperation(); + + } + }, 250); } @@ -301,6 +299,12 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe mStatus3.setDisplayedChild(3); } + @Override + public void onCryptoOperationCancelled() { + super.onCryptoOperationCancelled(); + mStatus3.setDisplayedChild(3); + } + private static JSONObject jsonHttpRequest(String url, JSONObject params, String accessToken) throws IOException { |