diff --git a/OpenPGP-Keychain/res/layout/create_key.xml b/OpenPGP-Keychain/res/layout/create_key_dialog.xml similarity index 64% rename from OpenPGP-Keychain/res/layout/create_key.xml rename to OpenPGP-Keychain/res/layout/create_key_dialog.xml index 888f9f898..a2e908433 100644 --- a/OpenPGP-Keychain/res/layout/create_key.xml +++ b/OpenPGP-Keychain/res/layout/create_key_dialog.xml @@ -1,26 +1,10 @@ - - + android:layout_width="match_parent" + android:layout_height="match_parent" > @@ -60,7 +44,7 @@ diff --git a/OpenPGP-Keychain/res/layout/decrypt.xml b/OpenPGP-Keychain/res/layout/decrypt_activity.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/decrypt.xml rename to OpenPGP-Keychain/res/layout/decrypt_activity.xml diff --git a/OpenPGP-Keychain/res/layout/drawer_list_item.xml b/OpenPGP-Keychain/res/layout/drawer_list_item.xml index 0d4b9537e..14760e79d 100644 --- a/OpenPGP-Keychain/res/layout/drawer_list_item.xml +++ b/OpenPGP-Keychain/res/layout/drawer_list_item.xml @@ -25,16 +25,4 @@ android:textAppearance="@android:style/TextAppearance.Medium" android:textColor="#111" /> - + diff --git a/OpenPGP-Keychain/res/layout/edit_key.xml b/OpenPGP-Keychain/res/layout/edit_key_activity.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/edit_key.xml rename to OpenPGP-Keychain/res/layout/edit_key_activity.xml diff --git a/OpenPGP-Keychain/res/layout/edit_key_key_item.xml b/OpenPGP-Keychain/res/layout/edit_key_key_item.xml index 06bff2f9e..11bce64ee 100644 --- a/OpenPGP-Keychain/res/layout/edit_key_key_item.xml +++ b/OpenPGP-Keychain/res/layout/edit_key_key_item.xml @@ -1,20 +1,4 @@ - - @@ -12,7 +12,7 @@ android:text="@string/label_main_user_id" /> @@ -33,7 +33,7 @@ @@ -51,7 +51,7 @@ @@ -69,7 +69,7 @@ @@ -91,7 +91,7 @@ diff --git a/OpenPGP-Keychain/res/layout/encrypt.xml b/OpenPGP-Keychain/res/layout/encrypt_activity.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/encrypt.xml rename to OpenPGP-Keychain/res/layout/encrypt_activity.xml diff --git a/OpenPGP-Keychain/res/layout/fragment_planet.xml b/OpenPGP-Keychain/res/layout/fragment_planet.xml deleted file mode 100644 index 4fe5bbe61..000000000 --- a/OpenPGP-Keychain/res/layout/fragment_planet.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/OpenPGP-Keychain/res/layout/help_fragment_about.xml b/OpenPGP-Keychain/res/layout/help_about_fragment.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/help_fragment_about.xml rename to OpenPGP-Keychain/res/layout/help_about_fragment.xml diff --git a/OpenPGP-Keychain/res/layout/import_keys.xml b/OpenPGP-Keychain/res/layout/import_keys_activity.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/import_keys.xml rename to OpenPGP-Keychain/res/layout/import_keys_activity.xml diff --git a/OpenPGP-Keychain/res/layout/key_list_child_item.xml b/OpenPGP-Keychain/res/layout/key_list_child_item.xml deleted file mode 100644 index 81d843529..000000000 --- a/OpenPGP-Keychain/res/layout/key_list_child_item.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenPGP-Keychain/res/layout/stickylist_header.xml b/OpenPGP-Keychain/res/layout/key_list_public_header.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/stickylist_header.xml rename to OpenPGP-Keychain/res/layout/key_list_public_header.xml diff --git a/OpenPGP-Keychain/res/layout/key_server_export.xml b/OpenPGP-Keychain/res/layout/key_server_export.xml new file mode 100644 index 000000000..30e4e0644 --- /dev/null +++ b/OpenPGP-Keychain/res/layout/key_server_export.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/res/layout/sign_key_layout.xml b/OpenPGP-Keychain/res/layout/sign_key_layout.xml deleted file mode 100644 index 4530831ee..000000000 --- a/OpenPGP-Keychain/res/layout/sign_key_layout.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenPGP-Keychain/res/layout/key_view_activity.xml b/OpenPGP-Keychain/res/layout/view_key_activity.xml similarity index 100% rename from OpenPGP-Keychain/res/layout/key_view_activity.xml rename to OpenPGP-Keychain/res/layout/view_key_activity.xml diff --git a/OpenPGP-Keychain/res/layout/view_key_keys_item.xml b/OpenPGP-Keychain/res/layout/view_key_keys_item.xml new file mode 100644 index 000000000..b50253980 --- /dev/null +++ b/OpenPGP-Keychain/res/layout/view_key_keys_item.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/res/layout/view_key_userids_item.xml b/OpenPGP-Keychain/res/layout/view_key_userids_item.xml new file mode 100644 index 000000000..cbc85189f --- /dev/null +++ b/OpenPGP-Keychain/res/layout/view_key_userids_item.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 87229f6c3..6cc0b3b5a 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -230,7 +230,7 @@ public class DecryptActivity extends DrawerActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.decrypt); + setContentView(R.layout.decrypt_activity); // set actionbar without home button if called from another app ActionBarHelper.setBackButton(this); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index b79200ba1..be2e4115b 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -429,7 +429,7 @@ public class EditKeyActivity extends SherlockFragmentActivity { * id and key. */ private void buildLayout() { - setContentView(R.layout.edit_key); + setContentView(R.layout.edit_key_activity); // find views mChangePassPhrase = (BootstrapButton) findViewById(R.id.edit_key_btn_change_pass_phrase); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 24caebb3a..c974dfd46 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -172,7 +172,7 @@ public class EncryptActivity extends DrawerActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.encrypt); + setContentView(R.layout.encrypt_activity); // set actionbar without home button if called from another app ActionBarHelper.setBackButton(this); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java index e7a977707..840ebb650 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java @@ -48,7 +48,7 @@ public class HelpFragmentAbout extends SherlockFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.help_fragment_about, container, false); + View view = inflater.inflate(R.layout.help_about_fragment, container, false); TextView versionText = (TextView) view.findViewById(R.id.help_about_version); versionText.setText(getString(R.string.help_about_version) + " " + getVersion()); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 1842364e7..7d8f4154f 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -83,7 +83,7 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.import_keys); + setContentView(R.layout.import_keys_activity); mImportButton = (BootstrapButton) findViewById(R.id.import_import); mImportButton.setOnClickListener(new OnClickListener() { diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 88503a5c4..ea088efca 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -259,7 +259,7 @@ public class KeyListPublicFragment extends Fragment implements AdapterView.OnIte */ @Override public void onItemClick(AdapterView adapterView, View view, int position, long id) { - Intent detailsIntent = new Intent(getActivity(), KeyViewActivity.class); + Intent detailsIntent = new Intent(getActivity(), ViewKeyActivity.class); detailsIntent.setData(KeychainContract.KeyRings.buildPublicKeyRingsUri(Long.toString(id))); startActivity(detailsIntent); } diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerQueryActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerQueryActivity.java index b4679f9d5..6073e6b80 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerQueryActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerQueryActivity.java @@ -111,7 +111,7 @@ public class KeyServerQueryActivity extends SherlockFragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.key_server_query_layout); + setContentView(R.layout.key_server_query); mQuery = (EditText)findViewById(R.id.query); mSearch = (Button)findViewById(R.id.btn_search); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerUploadActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerUploadActivity.java index 996637c7a..8a32ea513 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerUploadActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyServerUploadActivity.java @@ -76,7 +76,7 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.key_server_export_layout); + setContentView(R.layout.key_server_export); export = (Button) findViewById(R.id.btn_export_to_server); keyServer = (Spinner) findViewById(R.id.keyServer); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SignKeyActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SignKeyActivity.java index c2fe1315b..6abdddee6 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SignKeyActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SignKeyActivity.java @@ -68,7 +68,7 @@ public class SignKeyActivity extends SherlockFragmentActivity { super.onCreate(savedInstanceState); // check we havent already signed it - setContentView(R.layout.sign_key_layout); + setContentView(R.layout.sign_key_activity); final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(true); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyViewActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java similarity index 95% rename from OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyViewActivity.java rename to OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 0e1e20cce..5bc30ccc5 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/KeyViewActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -53,6 +53,7 @@ import android.os.Message; import android.text.format.DateFormat; import android.view.View; import android.view.View.OnClickListener; +import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; @@ -62,7 +63,7 @@ import com.actionbarsherlock.view.MenuItem; import com.beardedhen.androidbootstrap.BootstrapButton; @SuppressLint("NewApi") -public class KeyViewActivity extends SherlockFragmentActivity implements CreateNdefMessageCallback, +public class ViewKeyActivity extends SherlockFragmentActivity implements CreateNdefMessageCallback, OnNdefPushCompleteCallback { ExportHelper mExportHelper; @@ -77,6 +78,9 @@ public class KeyViewActivity extends SherlockFragmentActivity implements CreateN private TextView mCreation; private BootstrapButton mActionEncrypt; + private ListView mUserIds; + private ListView mKeys; + // NFC private NfcAdapter mNfcAdapter; private byte[] mSharedKeyringBytes; @@ -91,13 +95,15 @@ public class KeyViewActivity extends SherlockFragmentActivity implements CreateN getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); - setContentView(R.layout.key_view_activity); + setContentView(R.layout.view_key_activity); - mFingerint = (TextView) this.findViewById(R.id.fingerprint); - mExpiry = (TextView) this.findViewById(R.id.expiry); - mCreation = (TextView) this.findViewById(R.id.creation); - mAlgorithm = (TextView) this.findViewById(R.id.algorithm); - mActionEncrypt = (BootstrapButton) this.findViewById(R.id.action_encrypt); + mFingerint = (TextView) findViewById(R.id.fingerprint); + mExpiry = (TextView) findViewById(R.id.expiry); + mCreation = (TextView) findViewById(R.id.creation); + mAlgorithm = (TextView) findViewById(R.id.algorithm); + mActionEncrypt = (BootstrapButton) findViewById(R.id.action_encrypt); + mUserIds = (ListView) findViewById(R.id.user_ids); + mKeys = (ListView) findViewById(R.id.keys); Intent intent = getIntent(); mDataUri = intent.getData(); @@ -190,7 +196,7 @@ public class KeyViewActivity extends SherlockFragmentActivity implements CreateN @Override public void onClick(View v) { long[] encryptionKeyIds = new long[] { mPublicKey.getKeyID() }; - Intent intent = new Intent(KeyViewActivity.this, EncryptActivity.class); + Intent intent = new Intent(ViewKeyActivity.this, EncryptActivity.class); intent.setAction(EncryptActivity.ACTION_ENCRYPT); intent.putExtra(EncryptActivity.EXTRA_ENCRYPTION_KEY_IDS, encryptionKeyIds); // used instead of startActivity set actionbar based on callingPackage diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 5f71c9805..140781b4f 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -105,7 +105,7 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea HeaderViewHolder holder; if (convertView == null) { holder = new HeaderViewHolder(); - convertView = mInflater.inflate(R.layout.stickylist_header, parent, false); + convertView = mInflater.inflate(R.layout.key_list_public_header, parent, false); holder.text = (TextView) convertView.findViewById(R.id.stickylist_header_text); convertView.setTag(holder); } else { diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java new file mode 100644 index 000000000..55821b11e --- /dev/null +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2013 Dominik Schürmann + * + * 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 java.util.HashMap; +import java.util.Set; + +import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.OtherHelper; +import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.database.Cursor; +import android.graphics.Color; +import android.support.v4.widget.CursorAdapter; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class ViewKeyUserIdsAdapter extends CursorAdapter { + private LayoutInflater mInflater; + + public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags) { + super(context, c, flags); + + mInflater = LayoutInflater.from(context); + } + + @Override + public void bindView(View view, Context context, Cursor cursor) { + int userIdIndex = cursor.getColumnIndex(UserIds.USER_ID); + + TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); + mainUserId.setText(R.string.unknown_user_id); + TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); + mainUserIdRest.setText(""); + + String userId = cursor.getString(userIdIndex); + if (userId != null) { + String[] userIdSplit = OtherHelper.splitUserId(userId); + + if (userIdSplit[1] != null) { + mainUserIdRest.setText(userIdSplit[1]); + } + mainUserId.setText(userIdSplit[0]); + } + + if (mainUserId.getText().length() == 0) { + mainUserId.setText(R.string.unknown_user_id); + } + + if (mainUserIdRest.getText().length() == 0) { + mainUserIdRest.setVisibility(View.GONE); + } else { + mainUserIdRest.setVisibility(View.VISIBLE); + } + } + + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + return mInflater.inflate(R.layout.key_list_item, null); + } + +} diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java index aba7e974e..e88271240 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java @@ -141,7 +141,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor } LayoutInflater inflater = activity.getLayoutInflater(); - View view = inflater.inflate(R.layout.passphrase, null); + View view = inflater.inflate(R.layout.passphrase_dialog, null); alert.setView(view); mPassphraseEditText = (EditText) view.findViewById(R.id.passphrase_passphrase); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java index 797b28829..79d577c58 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java @@ -90,7 +90,7 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi alert.setMessage(R.string.enter_passphrase_twice); LayoutInflater inflater = activity.getLayoutInflater(); - View view = inflater.inflate(R.layout.passphrase_repeat, null); + View view = inflater.inflate(R.layout.passphrase_repeat_dialogf, null); alert.setView(view); mPassphraseEditText = (EditText) view.findViewById(R.id.passphrase_passphrase); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 91e3831b7..b33dbe4c5 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -153,7 +153,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor case Id.type.key: { AlertDialog.Builder dialog = new AlertDialog.Builder(getContext()); - View view = mInflater.inflate(R.layout.create_key, null); + View view = mInflater.inflate(R.layout.create_key_dialog, null); dialog.setView(view); dialog.setTitle(R.string.title_create_key);