diff options
Diffstat (limited to 'OpenKeychain/src/main')
8 files changed, 38 insertions, 34 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java index e94ea5189..480421499 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java @@ -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); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java index 5c1389573..3a83939e7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java @@ -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; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java index c8f80f4a5..0f33a3b8a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertListWidget.java @@ -133,8 +133,6 @@ public class CertListWidget extends ViewAnimator vCollapsed.setText("This identity is not yet verified or confirmed."); } - setVisibility(View.VISIBLE); - } @Override diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java index 460163a47..714933b58 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java @@ -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; + } + + } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java index 70f4e7792..5a6c61f7d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java @@ -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; + } + } diff --git a/OpenKeychain/src/main/res/layout/cert_list_widget.xml b/OpenKeychain/src/main/res/layout/cert_list_widget.xml index 7052a1901..7e3dbcdf4 100644 --- a/OpenKeychain/src/main/res/layout/cert_list_widget.xml +++ b/OpenKeychain/src/main/res/layout/cert_list_widget.xml @@ -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 diff --git a/OpenKeychain/src/main/res/layout/linked_id_item.xml b/OpenKeychain/src/main/res/layout/linked_id_item.xml index 6b39144a8..c70701962 100644 --- a/OpenKeychain/src/main/res/layout/linked_id_item.xml +++ b/OpenKeychain/src/main/res/layout/linked_id_item.xml @@ -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" diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 53b49cac3..d76c68909 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -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> |