linked: add "retry"

This commit is contained in:
Vincent Breitmoser
2015-09-08 15:53:24 +02:00
parent 0ef929fb7f
commit c07e029345
8 changed files with 31 additions and 5 deletions

View File

@@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

View File

@@ -129,13 +129,13 @@
android:layout_marginLeft="4dp"
android:inAnimation="@anim/fade_in"
android:outAnimation="@anim/fade_out"
custom:initialView="2">
android:clipChildren="false"
custom:initialView="3">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
style="?android:buttonBarButtonStyle"
android:drawableLeft="@drawable/link_24dp"
android:drawableStart="@drawable/link_24dp"
android:drawablePadding="12dp"
@@ -149,6 +149,17 @@
<include layout="@layout/linked_id_item" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:drawableLeft="@drawable/ic_repeat_black_24dp"
android:drawableStart="@drawable/ic_repeat_black_24dp"
android:drawablePadding="12dp"
android:text="Retry Last Step"
android:id="@+id/button_retry"
/>
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>
</LinearLayout>