diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-08 15:53:24 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-08 15:55:17 +0200 |
commit | c07e029345b7ae3ac9447df3ee12c796e6d131df (patch) | |
tree | 01cd16b6cb9c28c97a8b6d435d42f9a53adb3908 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubFragment.java | |
parent | 0ef929fb7ff58e5fdb75cd0892c12cf57a43b321 (diff) | |
download | open-keychain-c07e029345b7ae3ac9447df3ee12c796e6d131df.tar.gz open-keychain-c07e029345b7ae3ac9447df3ee12c796e6d131df.tar.bz2 open-keychain-c07e029345b7ae3ac9447df3ee12c796e6d131df.zip |
linked: add "retry"
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 | 20 |
1 files changed, 17 insertions, 3 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 e42623c6e..6df31a596 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 @@ -53,6 +53,7 @@ import android.view.ViewGroup; import android.webkit.CookieManager; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.ViewAnimator; @@ -79,6 +80,8 @@ import org.sufficientlysecure.keychain.util.Log; public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKeyringParcel,EditKeyResult> { + private Button mRetryButton; + enum State { IDLE, AUTH_PROCESS, AUTH_ERROR, POST_PROCESS, POST_ERROR, LID_PROCESS, LID_ERROR, DONE } @@ -114,6 +117,8 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe mStatus2 = (StatusIndicator) view.findViewById(R.id.linked_status_step2); mStatus3 = (StatusIndicator) view.findViewById(R.id.linked_status_step3); + mRetryButton = (Button) view.findViewById(R.id.button_retry); + ((ImageView) view.findViewById(R.id.linked_id_type_icon)).setImageResource(R.drawable.linked_github); ((ImageView) view.findViewById(R.id.linked_id_certified_icon)).setImageResource(R.drawable.octo_link_24dp); mLinkedIdTitle = (TextView) view.findViewById(R.id.linked_id_title); @@ -403,13 +408,22 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe @Override public void onCryptoOperationError(EditKeyResult result) { result.createNotify(getActivity()).show(this); - mStatus3.setDisplayedChild(3); + setState(State.LID_ERROR); } @Override public void onCryptoOperationCancelled() { - super.onCryptoOperationCancelled(); - mStatus3.setDisplayedChild(3); + mRetryButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + v.setOnClickListener(null); + mButtonContainer.setDisplayedChild(1); + setState(State.LID_PROCESS); + cryptoOperation(); + } + }); + mButtonContainer.setDisplayedChild(3); + setState(State.LID_ERROR); } private String mOAuthCode, mOAuthState; |