From f3ef530b9641008f4d7c0b75f411dd9843632f0e Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 19 Jun 2018 14:22:08 +0200 Subject: [PATCH] ditch ViewCertActivity and cert fragment in AdvKeyView --- OpenKeychain/src/main/AndroidManifest.xml | 9 - .../keychain/provider/KeychainContract.java | 11 - .../keychain/provider/KeychainProvider.java | 11 - .../keychain/ui/ViewCertActivity.java | 221 --------------- .../keychain/ui/ViewKeyAdvActivity.java | 8 +- .../keychain/ui/ViewKeyAdvCertsFragment.java | 129 --------- .../ui/adapter/CertSectionedListAdapter.java | 259 ------------------ .../ui/keyview/LinkedIdViewFragment.java | 3 +- .../presenter/IdentitiesPresenter.java | 10 +- .../main/res/layout/view_cert_activity.xml | 226 --------------- .../layout/view_key_adv_certs_fragment.xml | 71 ----- .../res/layout/view_key_adv_certs_header.xml | 17 -- .../res/layout/view_key_adv_certs_item.xml | 52 ---- 13 files changed, 4 insertions(+), 1023 deletions(-) delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvCertsFragment.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/CertSectionedListAdapter.java delete mode 100644 OpenKeychain/src/main/res/layout/view_cert_activity.xml delete mode 100644 OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml delete mode 100644 OpenKeychain/src/main/res/layout/view_key_adv_certs_header.xml delete mode 100644 OpenKeychain/src/main/res/layout/view_key_adv_certs_item.xml diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 6bea7ff0a..4bde8a2aa 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -168,15 +168,6 @@ - - - projectionMap = new HashMap<>(); projectionMap.put(Certs._ID, Tables.CERTS + ".oid AS " + Certs._ID); @@ -599,12 +594,6 @@ public class KeychainProvider extends ContentProvider implements SimpleContentRe qb.appendWhere(Tables.CERTS + "." + Certs.MASTER_KEY_ID + " = "); qb.appendWhereEscapeString(uri.getPathSegments().get(1)); - if(match == KEY_RING_CERTS_SPECIFIC) { - qb.appendWhere(" AND " + Tables.CERTS + "." + Certs.RANK + " = "); - qb.appendWhereEscapeString(uri.getPathSegments().get(3)); - qb.appendWhere(" AND " + Tables.CERTS + "." + Certs.KEY_ID_CERTIFIER+ " = "); - qb.appendWhereEscapeString(uri.getPathSegments().get(4)); - } if (match == KEY_RING_LINKED_ID_CERTS) { qb.appendWhere(" AND " + Tables.USER_PACKETS + "." diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java deleted file mode 100644 index d52a8f277..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.ui; - - -import java.util.Date; - -import android.content.Intent; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; -import android.support.v4.app.LoaderManager; -import android.support.v4.app.NavUtils; -import android.support.v4.content.CursorLoader; -import android.support.v4.content.Loader; -import android.support.v7.app.ActionBar; -import android.text.format.DateFormat; -import android.view.MenuItem; -import android.view.View; -import android.widget.TextView; - -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.pgp.WrappedSignature; -import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; -import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException; -import org.sufficientlysecure.keychain.provider.KeychainContract.Certs; -import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; -import org.sufficientlysecure.keychain.provider.KeyRepository; -import org.sufficientlysecure.keychain.ui.base.BaseActivity; -import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import timber.log.Timber; - - -public class ViewCertActivity extends BaseActivity - implements LoaderManager.LoaderCallbacks { - - // These are the rows that we will retrieve. - static final String[] PROJECTION = new String[]{ - Certs.MASTER_KEY_ID, - Certs.USER_ID, - Certs.TYPE, - Certs.CREATION, - Certs.KEY_ID_CERTIFIER, - Certs.SIGNER_UID, - Certs.DATA, - }; - private static final int INDEX_MASTER_KEY_ID = 0; - private static final int INDEX_USER_ID = 1; - private static final int INDEX_TYPE = 2; - private static final int INDEX_CREATION = 3; - private static final int INDEX_KEY_ID_CERTIFIER = 4; - private static final int INDEX_SIGNER_UID = 5; - private static final int INDEX_DATA = 6; - - private Uri mDataUri; - - private long mCertifierKeyId; - - private TextView mSigneeKey, mSigneeUid, mAlgorithm, mType, mReason, mCreation; - private TextView mCertifierKey, mCertifierUid, mStatus; - private View mRowReason; - private View mViewCertifierButton; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - ActionBar actionBar = getSupportActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); - - mSigneeKey = findViewById(R.id.signee_key); - mSigneeUid = findViewById(R.id.signee_uid); - mAlgorithm = findViewById(R.id.algorithm); - mType = findViewById(R.id.signature_type); - mReason = findViewById(R.id.reason); - mCreation = findViewById(R.id.creation); - - mCertifierKey = findViewById(R.id.signer_key_id); - mCertifierUid = findViewById(R.id.signer_uid); - - mRowReason = findViewById(R.id.row_reason); - - mViewCertifierButton = findViewById(R.id.view_cert_view_cert_key); - - mDataUri = getIntent().getData(); - if (mDataUri == null) { - Timber.e("Intent data missing. Should be Uri of key!"); - finish(); - return; - } - - getSupportLoaderManager().initLoader(0, null, this); - } - - @Override - protected void initLayout() { - setContentView(R.layout.view_cert_activity); - } - - @Override - public Loader onCreateLoader(int id, Bundle args) { - // Now create and return a CursorLoader that will take care of - // creating a Cursor for the data being displayed. - return new CursorLoader(this, mDataUri, PROJECTION, null, null, null); - } - - @Override - public void onLoadFinished(Loader loader, Cursor data) { - if (data.moveToFirst()) { - mSigneeKey.setText(KeyFormattingUtils.beautifyKeyId(data.getLong(INDEX_MASTER_KEY_ID))); - - String signeeUid = data.getString(INDEX_USER_ID); - mSigneeUid.setText(signeeUid); - - Date creationDate = new Date(data.getLong(INDEX_CREATION) * 1000); - mCreation.setText(DateFormat.getDateFormat(getApplicationContext()).format(creationDate)); - - mCertifierKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER); - mCertifierKey.setText(KeyFormattingUtils.beautifyKeyId(mCertifierKeyId)); - - String certifierUid = data.getString(INDEX_SIGNER_UID); - if (certifierUid != null) { - mCertifierUid.setText(certifierUid); - } else { - mCertifierUid.setText(R.string.unknown_uid); - } - - WrappedSignature sig = WrappedSignature.fromBytes(data.getBlob(INDEX_DATA)); - - String algorithmStr = KeyFormattingUtils.getAlgorithmInfo(this, sig.getKeyAlgorithm(), null, null); - mAlgorithm.setText(algorithmStr); - - mRowReason.setVisibility(View.GONE); - switch (data.getInt(INDEX_TYPE)) { - case WrappedSignature.DEFAULT_CERTIFICATION: - mType.setText(R.string.cert_default); - break; - case WrappedSignature.NO_CERTIFICATION: - mType.setText(R.string.cert_none); - break; - case WrappedSignature.CASUAL_CERTIFICATION: - mType.setText(R.string.cert_casual); - break; - case WrappedSignature.POSITIVE_CERTIFICATION: - mType.setText(R.string.cert_positive); - break; - case WrappedSignature.CERTIFICATION_REVOCATION: { - mType.setText(R.string.cert_revoke); - if (sig.isRevocation()) { - try { - String reason = sig.getRevocationReason(); - if (reason != null) { - mReason.setText(reason); - } else { - mReason.setText(R.string.none); - } - } catch(PgpGeneralException e) { - mReason.setText(R.string.none); - } - } - mRowReason.setVisibility(View.VISIBLE); - break; - } - } - } - - // can't do this before the data is initialized - mViewCertifierButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent viewIntent = new Intent(ViewCertActivity.this, ViewKeyActivity.class); - - try { - KeyRepository keyRepository = - KeyRepository.create(ViewCertActivity.this); - long signerMasterKeyId = keyRepository.getCachedPublicKeyRing( - KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mCertifierKeyId)).getMasterKeyId(); - viewIntent.setData(KeyRings.buildGenericKeyRingUri(signerMasterKeyId)); - startActivity(viewIntent); - } catch (PgpKeyNotFoundException e) { - // TODO notify user of this, maybe offer download? - Timber.e(e, "key not found!"); - } - } - }); - } - - @Override - public void onLoaderReset(Loader loader) { - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: { - Intent viewIntent = NavUtils.getParentActivityIntent(this); - viewIntent.setData(KeyRings.buildGenericKeyRingUri(mDataUri)); - NavUtils.navigateUpTo(this, viewIntent); - return true; - } - } - return super.onOptionsItemSelected(item); - } - -} 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 bc5233711..55fc4da39 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java @@ -126,7 +126,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements mViewPager.setAdapter(mTabAdapter); // keep track which of these are action mode enabled! - mTabsWithActionMode = new boolean[5]; + mTabsWithActionMode = new boolean[4]; mTabAdapter.addTab(ViewKeyAdvStartFragment.class, null, getString(R.string.key_view_tab_start)); @@ -150,12 +150,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements keysBundle, getString(R.string.key_view_tab_keys)); mTabsWithActionMode[3] = true; - Bundle certsBundle = new Bundle(); - certsBundle.putParcelable(ViewKeyAdvCertsFragment.ARG_DATA_URI, dataUri); - mTabAdapter.addTab(ViewKeyAdvCertsFragment.class, - certsBundle, getString(R.string.key_view_tab_certs)); - mTabsWithActionMode[4] = false; - // update layout after operations mSlidingTabLayout.setViewPager(mViewPager); mSlidingTabLayout.setOnPageChangeListener(this); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvCertsFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvCertsFragment.java deleted file mode 100644 index 1a11c1bce..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvCertsFragment.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.ui; - -import android.content.Intent; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; -import android.support.v4.content.Loader; -import android.view.View; -import android.view.ViewGroup; -import android.view.LayoutInflater; - -import com.tonicartos.superslim.LayoutManager; - -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.provider.KeychainContract; -import org.sufficientlysecure.keychain.ui.adapter.CertSectionedListAdapter; -import org.sufficientlysecure.keychain.ui.base.RecyclerFragment; -import timber.log.Timber; - - -public class ViewKeyAdvCertsFragment extends RecyclerFragment - implements LoaderManager.LoaderCallbacks, CertSectionedListAdapter.CertListListener { - - public static final String ARG_DATA_URI = "data_uri"; - private Uri mDataUriCerts; - - /** - * Creates new instance of this fragment - */ - public static ViewKeyAdvCertsFragment newInstance(Uri dataUri) { - ViewKeyAdvCertsFragment frag = new ViewKeyAdvCertsFragment(); - - Bundle args = new Bundle(); - args.putParcelable(ARG_DATA_URI, dataUri); - - frag.setArguments(args); - return frag; - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(R.layout.view_key_adv_certs_fragment, container, false); - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - hideList(false); - - Uri dataUri = getArguments().getParcelable(ARG_DATA_URI); - if (dataUri == null) { - Timber.e("Data missing. Should be Uri of key!"); - getActivity().finish(); - return; - } else { - mDataUriCerts = KeychainContract.Certs.buildCertsUri(dataUri); - } - - CertSectionedListAdapter adapter = new CertSectionedListAdapter(getActivity(), null); - adapter.setCertListListener(this); - - setAdapter(adapter); - setLayoutManager(new LayoutManager(getActivity())); - - getLoaderManager().initLoader(0, null, this); - } - - public Loader onCreateLoader(int id, Bundle args) { - // Now create and return a CursorLoader that will take care of - // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), mDataUriCerts, - CertSectionedListAdapter.CertCursor.CERTS_PROJECTION, null, null, - CertSectionedListAdapter.CertCursor.CERTS_SORT_ORDER); - } - - public void onLoadFinished(Loader loader, Cursor data) { - // Avoid NullPointerExceptions, if we get an empty result set. - if (data.getCount() == 0) { - return; - } - - // Swap the new cursor in. (The framework will take care of closing the - // old cursor once we return.) - getAdapter().swapCursor(CertSectionedListAdapter.CertCursor.wrap(data)); - - if (isResumed()) { - showList(true); - } else { - showList(false); - } - } - - /** - * This is called when the last Cursor provided to onLoadFinished() above is about to be closed. - * We need to make sure we are no longer using it. - */ - public void onLoaderReset(Loader loader) { - getAdapter().swapCursor(null); - } - - @Override - public void onClick(long masterKeyId, long signerKeyId, long rank) { - if(masterKeyId != 0L) { - Intent viewIntent = new Intent(getActivity(), ViewCertActivity.class); - viewIntent.setData(KeychainContract.Certs.buildCertsSpecificUri( - masterKeyId, rank, signerKeyId)); - startActivity(viewIntent); - } - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/CertSectionedListAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/CertSectionedListAdapter.java deleted file mode 100644 index aa4551e74..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/CertSectionedListAdapter.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.ui.adapter; - -import android.content.Context; -import android.database.Cursor; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - - -import org.openintents.openpgp.util.OpenPgpUtils; -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.pgp.KeyRing; -import org.sufficientlysecure.keychain.pgp.WrappedSignature; -import org.sufficientlysecure.keychain.provider.KeychainContract; -import org.sufficientlysecure.keychain.provider.KeychainDatabase; -import org.sufficientlysecure.keychain.ui.adapter.CertSectionedListAdapter.CertCursor; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import org.sufficientlysecure.keychain.ui.util.adapter.CursorAdapter; -import org.sufficientlysecure.keychain.ui.util.adapter.SectionCursorAdapter; - -import java.util.ArrayList; -import java.util.Arrays; - -public class CertSectionedListAdapter extends SectionCursorAdapter { - - private CertListListener mListener; - - public CertSectionedListAdapter(Context context, CertCursor cursor) { - super(context, CertCursor.wrap(cursor), 0); - } - - public void setCertListListener(CertListListener listener) { - mListener = listener; - } - - @Override - public long getIdFromCursor(CertCursor cursor) { - return cursor.getKeyId(); - } - - @Override - protected String getSectionFromCursor(CertCursor cursor) throws IllegalStateException { - return cursor.getRawSignerUserId(); - } - - @Override - protected CertSectionViewHolder onCreateSectionViewHolder(ViewGroup parent, int viewType) { - return new CertSectionViewHolder(LayoutInflater.from(parent.getContext()) - .inflate(R.layout.view_key_adv_certs_header, parent, false)); - } - - @Override - protected CertItemViewHolder onCreateItemViewHolder(ViewGroup parent, int viewType) { - return new CertItemViewHolder(LayoutInflater.from(parent.getContext()) - .inflate(R.layout.view_key_adv_certs_item, parent, false)); - } - - @Override - protected void onBindSectionViewHolder(CertSectionViewHolder holder, String section) { - holder.bind(section); - } - - @Override - protected void onBindItemViewHolder(CertItemViewHolder holder, CertCursor cursor) { - holder.bind(cursor); - } - - class CertItemViewHolder extends SectionCursorAdapter.ViewHolder - implements View.OnClickListener { - - private TextView mSignerKeyId; - private TextView mSignerName; - private TextView mSignStatus; - - public CertItemViewHolder(View itemView) { - super(itemView); - - itemView.setClickable(true); - itemView.setOnClickListener(this); - - mSignerName = itemView.findViewById(R.id.signerName); - mSignStatus = itemView.findViewById(R.id.signStatus); - mSignerKeyId = itemView.findViewById(R.id.signerKeyId); - } - - public void bind(CertCursor cursor) { - String signerKeyId = KeyFormattingUtils.beautifyKeyIdWithPrefix( - cursor.getCertifierKeyId()); - - OpenPgpUtils.UserId userId = cursor.getSignerUserId(); - if (userId.name != null) { - mSignerName.setText(userId.name); - } else { - mSignerName.setText(R.string.user_id_no_name); - } - - mSignerKeyId.setText(signerKeyId); - switch (cursor.getType()) { - case WrappedSignature.DEFAULT_CERTIFICATION: // 0x10 - mSignStatus.setText(R.string.cert_default); - break; - case WrappedSignature.NO_CERTIFICATION: // 0x11 - mSignStatus.setText(R.string.cert_none); - break; - case WrappedSignature.CASUAL_CERTIFICATION: // 0x12 - mSignStatus.setText(R.string.cert_casual); - break; - case WrappedSignature.POSITIVE_CERTIFICATION: // 0x13 - mSignStatus.setText(R.string.cert_positive); - break; - case WrappedSignature.CERTIFICATION_REVOCATION: // 0x30 - mSignStatus.setText(R.string.cert_revoke); - break; - } - } - - @Override - public void onClick(View v) { - if(mListener != null) { - int index = getCursorPositionWithoutSections(getAdapterPosition()); - if (moveCursor(index)) { - CertCursor cursor = getCursor(); - mListener.onClick( - cursor.getKeyId(), - cursor.getCertifierKeyId(), - cursor.getRank() - ); - } - } - } - } - - static class CertSectionViewHolder extends SectionCursorAdapter.ViewHolder { - private TextView mHeaderText; - - public CertSectionViewHolder(View itemView) { - super(itemView); - mHeaderText = itemView.findViewById(R.id.stickylist_header_text); - } - - public void bind(String text) { - mHeaderText.setText(text); - } - } - - public static class CertCursor extends CursorAdapter.SimpleCursor { - public static final String[] CERTS_PROJECTION; - static { - ArrayList projection = new ArrayList<>(); - projection.addAll(Arrays.asList(SimpleCursor.PROJECTION)); - projection.addAll(Arrays.asList( - KeychainContract.Certs.MASTER_KEY_ID, - KeychainContract.Certs.VERIFIED, - KeychainContract.Certs.TYPE, - KeychainContract.Certs.RANK, - KeychainContract.Certs.KEY_ID_CERTIFIER, - KeychainContract.Certs.USER_ID, - KeychainContract.Certs.SIGNER_UID - )); - - CERTS_PROJECTION = projection.toArray(new String[projection.size()]); - } - - public static final String CERTS_SORT_ORDER = - KeychainDatabase.Tables.CERTS + "." + KeychainContract.Certs.RANK + " ASC, " - + KeychainContract.Certs.VERIFIED + " DESC, " - + KeychainDatabase.Tables.CERTS + "." + KeychainContract.Certs.TYPE + " DESC, " - + KeychainContract.Certs.SIGNER_UID + " ASC"; - - public static CertCursor wrap(Cursor cursor) { - if(cursor != null) { - return new CertCursor(cursor); - } else { - return null; - } - } - - private CertCursor(Cursor cursor) { - super(cursor); - } - - public long getKeyId() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.MASTER_KEY_ID); - return getLong(index); - } - - public boolean isVerified() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.VERIFIED); - return getInt(index) > 0; - } - - public int getType() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.TYPE); - return getInt(index); - } - - public long getRank() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.RANK); - return getLong(index); - } - - public long getCertifierKeyId() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.KEY_ID_CERTIFIER); - return getLong(index); - } - - public String getRawUserId() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.USER_ID); - return getString(index); - } - - public String getRawSignerUserId() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.SIGNER_UID); - return getString(index); - } - - public String getName() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.NAME); - return getString(index); - } - - public String getEmail() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.EMAIL); - return getString(index); - } - - public String getComment() { - int index = getColumnIndexOrThrow(KeychainContract.Certs.COMMENT); - return getString(index); - } - - public OpenPgpUtils.UserId getSignerUserId() { - return KeyRing.splitUserId(getRawSignerUserId()); - } - } - - public interface CertListListener { - void onClick(long masterKeyId, long signerKeyId, long rank); - } -} \ No newline at end of file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/LinkedIdViewFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/LinkedIdViewFragment.java index cfa9b283f..c841a4ee7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/LinkedIdViewFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/LinkedIdViewFragment.java @@ -99,8 +99,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements private int lidRank; private long certifyKeyId; - public static LinkedIdViewFragment newInstance(Uri dataUri, int rank, - boolean isSecret, long masterKeyId) throws IOException { + public static LinkedIdViewFragment newInstance(Uri dataUri, int rank, boolean isSecret, long masterKeyId) { LinkedIdViewFragment frag = new LinkedIdViewFragment(); Bundle args = new Bundle(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/IdentitiesPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/IdentitiesPresenter.java index 478d0be5f..566868d34 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/IdentitiesPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/IdentitiesPresenter.java @@ -114,14 +114,8 @@ public class IdentitiesPresenter implements Observer> { } private void showLinkedId(final LinkedIdInfo info) { - final LinkedIdViewFragment frag; - try { - Uri dataUri = UserPackets.buildLinkedIdsUri(KeyRings.buildGenericKeyRingUri(masterKeyId)); - frag = LinkedIdViewFragment.newInstance(dataUri, info.getRank(), isSecret, masterKeyId); - } catch (IOException e) { - Timber.e(e, "IOException"); - return; - } + Uri dataUri = UserPackets.buildLinkedIdsUri(KeyRings.buildGenericKeyRingUri(masterKeyId)); + LinkedIdViewFragment frag = LinkedIdViewFragment.newInstance(dataUri, info.getRank(), isSecret, masterKeyId); viewKeyMvpView.switchToFragment(frag, "linked_id"); } diff --git a/OpenKeychain/src/main/res/layout/view_cert_activity.xml b/OpenKeychain/src/main/res/layout/view_cert_activity.xml deleted file mode 100644 index f412dbe92..000000000 --- a/OpenKeychain/src/main/res/layout/view_cert_activity.xml +++ /dev/null @@ -1,226 +0,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 deleted file mode 100644 index 80bb21e16..000000000 --- a/OpenKeychain/src/main/res/layout/view_key_adv_certs_fragment.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_certs_header.xml b/OpenKeychain/src/main/res/layout/view_key_adv_certs_header.xml deleted file mode 100644 index 3ebb0f855..000000000 --- a/OpenKeychain/src/main/res/layout/view_key_adv_certs_header.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_certs_item.xml b/OpenKeychain/src/main/res/layout/view_key_adv_certs_item.xml deleted file mode 100644 index f1a59a4f9..000000000 --- a/OpenKeychain/src/main/res/layout/view_key_adv_certs_item.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - -