even more linked id ui work

This commit is contained in:
Vincent Breitmoser 2015-03-29 23:38:01 +02:00
parent ab5a7d4094
commit 01c444d637
8 changed files with 38 additions and 34 deletions

View file

@ -113,7 +113,6 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
ViewHolder holder = (ViewHolder) view.getTag();
if (!mIsSecret) {
holder.vVerified.setVisibility(View.VISIBLE);
int isVerified = cursor.getInt(INDEX_VERIFIED);
switch (isVerified) {
case Certs.VERIFIED_SECRET:
@ -129,8 +128,6 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
null, State.INVALID, KeyFormattingUtils.DEFAULT_COLOR);
break;
}
} else {
holder.vVerified.setVisibility(View.GONE);
}
RawLinkedIdentity id = getItemAtPosition(cursor);

View file

@ -3,15 +3,12 @@ package org.sufficientlysecure.keychain.ui.linked;
import java.io.IOException;
import java.util.Arrays;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
@ -139,10 +136,14 @@ public class LinkedIdViewFragment extends Fragment implements
switch (loader.getId()) {
case LOADER_ID_LINKED_ID:
// Nothing to load means break if we are *expected* to load
if (!cursor.moveToFirst()) {
Notify.create(getActivity(), "Error loading identity!",
Notify.LENGTH_LONG, Style.ERROR).show();
finishFragment();
if (mIdLoadedListener != null) {
Notify.create(getActivity(), "Error loading identity!",
Notify.LENGTH_LONG, Style.ERROR).show();
finishFragment();
}
// Or just ignore, this is probably some intermediate state during certify
break;
}
@ -171,9 +172,14 @@ public class LinkedIdViewFragment extends Fragment implements
}
public void finishFragment() {
FragmentManager manager = getFragmentManager();
manager.removeOnBackStackChangedListener(this);
manager.popBackStack("linked_id", FragmentManager.POP_BACK_STACK_INCLUSIVE);
new Handler().post(new Runnable() {
@Override
public void run() {
FragmentManager manager = getFragmentManager();
manager.removeOnBackStackChangedListener(LinkedIdViewFragment.this);
manager.popBackStack("linked_id", FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
});
}
public interface OnIdentityLoadedListener {
@ -256,7 +262,6 @@ public class LinkedIdViewFragment extends Fragment implements
private final View vButtonVerify;
private final View vButtonRetry;
private final View vButtonConfirm;
private final View vButtonBack;
private final ViewAnimator vProgress;
private final TextSwitcher vText;
@ -269,7 +274,6 @@ public class LinkedIdViewFragment extends Fragment implements
mLinkedIdHolder = new LinkedIdsAdapter.ViewHolder(root);
vButtonBack = root.findViewById(R.id.back_button);
vButtonVerify = root.findViewById(R.id.button_verify);
vButtonRetry = root.findViewById(R.id.button_retry);
vButtonConfirm = root.findViewById(R.id.button_confirm);
@ -409,16 +413,6 @@ public class LinkedIdViewFragment extends Fragment implements
.setColorFilter(mContext.getResources().getColor(R.color.android_red_light),
PorterDuff.Mode.SRC_IN);
mViewHolder.vButtonBack.setClickable(true);
mViewHolder.vButtonBack.findViewById(R.id.back_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getFragmentManager().popBackStack();
}
});
mViewHolder.vButtonVerify.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -510,8 +504,9 @@ public class LinkedIdViewFragment extends Fragment implements
if (certifyKeyId == key.none || certifyKeyId == key.symmetric) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SubtleAttentionSeeker.tint(mViewHolder.vKeySpinnerContainer, 600).start();
} else {
Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show();
}
Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show();
return;
}

View file

@ -133,8 +133,6 @@ public class CertListWidget extends ViewAnimator
vCollapsed.setText("This identity is not yet verified or confirmed.");
}
setVisibility(View.VISIBLE);
}
@Override

View file

@ -21,6 +21,7 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.util.AttributeSet;
@ -138,4 +139,9 @@ public class CertifyKeySpinner extends KeySpinner {
return true;
}
public @StringRes int getNoneString() {
return R.string.choice_select_cert;
}
}

View file

@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui.widget;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.support.annotation.StringRes;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
@ -277,7 +278,7 @@ public abstract class KeySpinner extends TintSpinner implements LoaderManager.Lo
TextView vKeyEmail = (TextView) view.findViewById(R.id.keyspinner_key_email);
TextView vKeyDuplicate = (TextView) view.findViewById(R.id.keyspinner_duplicate);
vKeyName.setText(R.string.choice_none);
vKeyName.setText(getNoneString());
vKeyEmail.setVisibility(View.GONE);
vKeyDuplicate.setVisibility(View.GONE);
vKeyStatus.setVisibility(View.GONE);
@ -296,4 +297,8 @@ public abstract class KeySpinner extends TintSpinner implements LoaderManager.Lo
return true;
}
public @StringRes int getNoneString() {
return R.string.choice_none;
}
}

View file

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<org.sufficientlysecure.keychain.ui.widget.CertListWidget
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:id="@+id/linked_id_certs">
android:id="@+id/linked_id_certs"
tools:showIn="@layout/linked_id_view_fragment">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/cert_collapsed_list"
@ -21,6 +21,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:layout_weight="1"
tools:text="The identity is not yet verified or confirmed."
/>
<ImageView

View file

@ -62,8 +62,9 @@
android:id="@+id/linked_id_certified_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/status_signature_unknown_cutout_24dp"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
tools:src="@drawable/status_signature_unknown_cutout_24dp"
/>
<Space
android:layout_height="wrap_content"

View file

@ -201,6 +201,7 @@
<string name="choice_4hours">"4 hours"</string>
<string name="choice_8hours">"8 hours"</string>
<string name="choice_forever">"forever"</string>
<string name="choice_select_cert">"Select a Key"</string>
<string name="dsa">"DSA"</string>
<string name="elgamal">"ElGamal"</string>
<string name="rsa">"RSA"</string>