From 582caaba97c288de88b7a957cdf1b6f5bc84ed31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 27 Feb 2015 23:56:53 +0100 Subject: [PATCH] Reorder advanced key view --- .../keychain/ui/ViewKeyAdvActivity.java | 12 ++--- ...nt.java => ViewKeyAdvUserIdsFragment.java} | 54 +------------------ .../layout/view_key_adv_certs_fragment.xml | 9 ---- .../res/layout/view_key_adv_main_fragment.xml | 43 --------------- 4 files changed, 7 insertions(+), 111 deletions(-) rename OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/{ViewKeyAdvMainFragment.java => ViewKeyAdvUserIdsFragment.java} (72%) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java index 894529cc5..9d79b377c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java @@ -124,16 +124,16 @@ public class ViewKeyAdvActivity extends BaseActivity implements mTabsAdapter = new PagerTabStripAdapter(this); mViewPager.setAdapter(mTabsAdapter); - Bundle mainBundle = new Bundle(); - mainBundle.putParcelable(ViewKeyAdvMainFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyAdvMainFragment.class, - mainBundle, getString(R.string.key_view_tab_main)); - Bundle shareBundle = new Bundle(); - shareBundle.putParcelable(ViewKeyAdvMainFragment.ARG_DATA_URI, dataUri); + shareBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri); mTabsAdapter.addTab(ViewKeyAdvShareFragment.class, shareBundle, getString(R.string.key_view_tab_share)); + Bundle userIdsBundle = new Bundle(); + userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri); + mTabsAdapter.addTab(ViewKeyAdvUserIdsFragment.class, + userIdsBundle, getString(R.string.section_user_ids)); + Bundle keysBundle = new Bundle(); keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri); mTabsAdapter.addTab(ViewKeyAdvSubkeysFragment.class, diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java similarity index 72% rename from OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvMainFragment.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java index fc107d794..c4e6639a8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvMainFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java @@ -18,9 +18,7 @@ package org.sufficientlysecure.keychain.ui; -import android.content.Intent; import android.database.Cursor; -import android.graphics.PorterDuff; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.LoaderManager; @@ -30,31 +28,22 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; -import android.widget.ImageView; import android.widget.ListView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround; -import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets; -import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter; import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment; import org.sufficientlysecure.keychain.util.Log; -import java.util.Date; - -public class ViewKeyAdvMainFragment extends LoaderFragment implements +public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements LoaderManager.LoaderCallbacks { public static final String ARG_DATA_URI = "uri"; - private View mActionCertify; - private View mActionCertifyText; - private ImageView mActionCertifyImage; - private ListView mUserIds; private static final int LOADER_ID_UNIFIED = 0; @@ -70,12 +59,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements View view = inflater.inflate(R.layout.view_key_adv_main_fragment, getContainer()); mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids); - mActionCertify = view.findViewById(R.id.view_key_action_certify); - mActionCertifyText = view.findViewById(R.id.view_key_action_certify_text); - mActionCertifyImage = (ImageView) view.findViewById(R.id.view_key_action_certify_image); - // make certify image gray, like action icons - mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light), - PorterDuff.Mode.SRC_IN); mUserIds.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -120,12 +103,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString()); - mActionCertify.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - certify(mDataUri); - } - }); - mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0); mUserIds.setAdapter(mUserIdsAdapter); @@ -178,21 +155,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements case LOADER_ID_UNIFIED: { if (data.moveToFirst()) { - // If this key is revoked, it cannot be used for anything! - if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) { - mActionCertify.setEnabled(false); - mActionCertifyText.setEnabled(false); - } else { - - Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000); - if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) { - mActionCertify.setEnabled(false); - mActionCertifyText.setEnabled(false); - } else { - mActionCertify.setEnabled(true); - mActionCertifyText.setEnabled(true); - } - } break; } @@ -219,18 +181,4 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements } } - private void certify(Uri dataUri) { - long keyId = 0; - try { - keyId = new ProviderHelper(getActivity()) - .getCachedPublicKeyRing(dataUri) - .extractOrGetMasterKeyId(); - } catch (PgpKeyNotFoundException e) { - Log.e(Constants.TAG, "key not found!", e); - } - Intent certifyIntent = new Intent(getActivity(), CertifyKeyActivity.class); - certifyIntent.putExtra(CertifyKeyActivity.EXTRA_KEY_IDS, new long[]{keyId}); - startActivityForResult(certifyIntent, 0); - } - } diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml index 2232ea9f2..d512477aa 100644 --- a/OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml +++ b/OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml @@ -7,15 +7,6 @@ android:descendantFocusability="beforeDescendants" android:orientation="vertical"> - - - - - - - - - - - - - -