Edit key: adding user ids

This commit is contained in:
Dominik Schürmann 2014-07-02 15:10:50 +02:00
parent 7408a35e19
commit 4f83a4f163
14 changed files with 330 additions and 236 deletions

View File

@ -49,7 +49,6 @@ import java.util.Date;
* convenience.
*/
public class PassphraseCacheService extends Service {
public static final String TAG = Constants.TAG + ": PassphraseCacheService";
public static final String ACTION_PASSPHRASE_CACHE_ADD = Constants.INTENT_PREFIX
+ "PASSPHRASE_CACHE_ADD";
@ -83,7 +82,7 @@ public class PassphraseCacheService extends Service {
* @param passphrase
*/
public static void addCachedPassphrase(Context context, long keyId, String passphrase) {
Log.d(TAG, "cacheNewPassphrase() for " + keyId);
Log.d(Constants.TAG, "PassphraseCacheService.cacheNewPassphrase() for " + keyId);
Intent intent = new Intent(context, PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
@ -103,7 +102,7 @@ public class PassphraseCacheService extends Service {
* @return passphrase or null (if no passphrase is cached for this keyId)
*/
public static String getCachedPassphrase(Context context, long keyId) {
Log.d(TAG, "getCachedPassphrase() get masterKeyId for " + keyId);
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphrase() get masterKeyId for " + keyId);
Intent intent = new Intent(context, PassphraseCacheService.class);
intent.setAction(ACTION_PASSPHRASE_CACHE_GET);
@ -159,7 +158,7 @@ public class PassphraseCacheService extends Service {
private String getCachedPassphraseImpl(long keyId) {
// passphrase for symmetric encryption?
if (keyId == Constants.key.symmetric) {
Log.d(TAG, "getCachedPassphraseImpl() for symmetric encryption");
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphraseImpl() for symmetric encryption");
String cachedPassphrase = mPassphraseCache.get(Constants.key.symmetric);
if (cachedPassphrase == null) {
return null;
@ -170,7 +169,7 @@ public class PassphraseCacheService extends Service {
// try to get master key id which is used as an identifier for cached passphrases
try {
Log.d(TAG, "getCachedPassphraseImpl() for masterKeyId " + keyId);
Log.d(Constants.TAG, "PassphraseCacheService.getCachedPassphraseImpl() for masterKeyId " + keyId);
WrappedSecretKeyRing key = new ProviderHelper(this).getWrappedSecretKeyRing(
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId));
// no passphrase needed? just add empty string and return it, then
@ -184,18 +183,18 @@ public class PassphraseCacheService extends Service {
// get cached passphrase
String cachedPassphrase = mPassphraseCache.get(keyId);
if (cachedPassphrase == null) {
Log.d(TAG, "Passphrase not (yet) cached, returning null");
Log.d(Constants.TAG, "PassphraseCacheService Passphrase not (yet) cached, returning null");
// not really an error, just means the passphrase is not cached but not empty either
return null;
}
// set it again to reset the cache life cycle
Log.d(TAG, "Cache passphrase again when getting it!");
Log.d(Constants.TAG, "PassphraseCacheService Cache passphrase again when getting it!");
addCachedPassphrase(this, keyId, cachedPassphrase);
return cachedPassphrase;
} catch (ProviderHelper.NotFoundException e) {
Log.e(TAG, "Passphrase for unknown key was requested!");
Log.e(Constants.TAG, "PassphraseCacheService Passphrase for unknown key was requested!");
return null;
}
}
@ -212,7 +211,7 @@ public class PassphraseCacheService extends Service {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "Received broadcast...");
Log.d(Constants.TAG, "PassphraseCacheService Received broadcast...");
if (action.equals(BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE)) {
long keyId = intent.getLongExtra(EXTRA_KEY_ID, -1);
@ -248,7 +247,7 @@ public class PassphraseCacheService extends Service {
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand()");
Log.d(Constants.TAG, "PassphraseCacheService.onStartCommand()");
// register broadcastreceiver
registerReceiver();
@ -259,8 +258,8 @@ public class PassphraseCacheService extends Service {
long keyId = intent.getLongExtra(EXTRA_KEY_ID, -1);
String passphrase = intent.getStringExtra(EXTRA_PASSPHRASE);
Log.d(TAG,
"Received ACTION_PASSPHRASE_CACHE_ADD intent in onStartCommand() with keyId: "
Log.d(Constants.TAG,
"PassphraseCacheService Received ACTION_PASSPHRASE_CACHE_ADD intent in onStartCommand() with keyId: "
+ keyId + ", ttl: " + ttl);
// add keyId and passphrase to memory
@ -285,10 +284,10 @@ public class PassphraseCacheService extends Service {
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.e(Constants.TAG, "Sending message failed", e);
Log.e(Constants.TAG, "PassphraseCacheService Sending message failed", e);
}
} else {
Log.e(Constants.TAG, "Intent or Intent Action not supported!");
Log.e(Constants.TAG, "PassphraseCacheService Intent or Intent Action not supported!");
}
}
@ -305,11 +304,11 @@ public class PassphraseCacheService extends Service {
// remove passphrase corresponding to keyId from memory
mPassphraseCache.remove(keyId);
Log.d(TAG, "Timeout of keyId " + keyId + ", removed from memory!");
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
// stop whole service if no cached passphrases remaining
if (mPassphraseCache.size() == 0) {
Log.d(TAG, "No passphrases remaining in memory, stopping service!");
Log.d(Constants.TAG, "PassphraseCacheServic No passphrases remaining in memory, stopping service!");
stopSelf();
}
}

View File

@ -231,7 +231,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
// get new key from data bundle returned from service
Bundle data = message.getData();
Bundle data = message.getDataAsStringList();
ArrayList<UncachedSecretKey> newKeys =
PgpConversionHelper.BytesToPGPSecretKeyList(data

View File

@ -51,13 +51,14 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsNewAdapter;
import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter;
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log;
import java.util.ArrayList;
public class EditKeyFragment extends LoaderFragment implements
LoaderManager.LoaderCallbacks<Cursor> {
@ -76,7 +77,8 @@ public class EditKeyFragment extends LoaderFragment implements
private UserIdsAdapter mUserIdsAdapter;
private SubkeysAdapter mKeysAdapter;
private UserIdsNewAdapter mUserIdsAddedAdapter;
private UserIdsAddedAdapter mUserIdsAddedAdapter;
private ArrayList<UserIdsAddedAdapter.UserIdModel> mUserIdsAddedData;
private Uri mDataUri;
@ -189,9 +191,10 @@ public class EditKeyFragment extends LoaderFragment implements
}
});
mUserIdsAddedAdapter = new UserIdsNewAdapter(getActivity());
// TODO: from savedInstance?!
mUserIdsAddedData = new ArrayList<UserIdsAddedAdapter.UserIdModel>();
mUserIdsAddedAdapter = new UserIdsAddedAdapter(getActivity(), mUserIdsAddedData);
mUserIdsAddedList.setAdapter(mUserIdsAddedAdapter);
mUserIdsAddedAdapter.setData(mSaveKeyringParcel.addUserIds);
mKeysAdapter = new SubkeysAdapter(getActivity(), null, 0);
mKeysList.setAdapter(mKeysAdapter);
@ -321,40 +324,12 @@ public class EditKeyFragment extends LoaderFragment implements
}
private void addUserId() {
// mSaveKeyringParcel.addUserIds.add(userId);
// mUserIdsAddedAdapter.setData(mSaveKeyringParcel.addUserIds);
// Handler returnHandler = new Handler() {
// @Override
// public void handleMessage(Message message) {
// switch (message.what) {
// case AddUserIdDialogFragment.MESSAGE_OKAY:
// Bundle data = message.getData();
// String userId = data.getString(AddUserIdDialogFragment.MESSAGE_DATA_USER_ID);
//
// if (userId != null) {
// }
// }
// getLoaderManager().getLoader(LOADER_ID_USER_IDS).forceLoad();
// }
// };
//
// // Create a new Messenger for the communication back
// final Messenger messenger = new Messenger(returnHandler);
//
// DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() {
// public void run() {
// AddUserIdDialogFragment dialogFragment =
// AddUserIdDialogFragment.newInstance(messenger);
//
// dialogFragment.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
// }
// });
mUserIdsAddedAdapter.add(new UserIdsAddedAdapter.UserIdModel());
}
private void save() {
Log.d(Constants.TAG, "data: " + mUserIdsAddedAdapter.getDataAsStringList());
String passphrase = PassphraseCacheService.getCachedPassphrase(getActivity(),
mSaveKeyringParcel.mMasterKeyId);
if (passphrase == null) {

View File

@ -441,7 +441,6 @@ public class KeyListFragment extends LoaderFragment
TextView mMainUserIdRest;
View mStatusDivider;
FrameLayout mStatusLayout;
ImageButton mButton;
TextView mRevoked;
ImageView mVerified;
}
@ -454,7 +453,6 @@ public class KeyListFragment extends LoaderFragment
holder.mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
holder.mStatusDivider = (View) view.findViewById(R.id.status_divider);
holder.mStatusLayout = (FrameLayout) view.findViewById(R.id.status_layout);
holder.mButton = (ImageButton) view.findViewById(R.id.edit);
holder.mRevoked = (TextView) view.findViewById(R.id.revoked);
holder.mVerified = (ImageView) view.findViewById(R.id.verified);
view.setTag(holder);
@ -496,21 +494,9 @@ public class KeyListFragment extends LoaderFragment
h.mStatusLayout.setVisibility(View.VISIBLE);
h.mRevoked.setVisibility(View.GONE);
h.mVerified.setVisibility(View.GONE);
h.mButton.setVisibility(View.VISIBLE);
final long id = cursor.getLong(INDEX_MASTER_KEY_ID);
h.mButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
Intent editIntent = new Intent(getActivity(), EditKeyActivity.class);
editIntent.setData(KeyRingData.buildSecretKeyRingUri(Long.toString(id)));
editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY);
startActivityForResult(editIntent, 0);
}
});
} else {
// this is a public key - hide the edit mButton, show if it's revoked
h.mStatusDivider.setVisibility(View.GONE);
h.mButton.setVisibility(View.GONE);
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui;
import android.os.Bundle;
@ -9,14 +26,14 @@ import android.view.animation.AnimationUtils;
import org.sufficientlysecure.keychain.R;
/** This is a fragment helper class, which implements a generic
/**
* This is a fragment helper class, which implements a generic
* progressbar/container view.
*
* <p/>
* To use it in a fragment, simply subclass, use onCreateView to create the
* layout's root view, and ues getContainer() as root view of your subclass.
* The layout shows a progress bar by default, and can be switched to the
* actual contents by calling setContentShown().
*
*/
public class LoaderFragment extends Fragment {
private boolean mContentShown;
@ -35,7 +52,6 @@ public class LoaderFragment extends Fragment {
mContentShown = false;
return root;
}
protected ViewGroup getContainer() {

View File

@ -123,6 +123,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
TextView vComment = (TextView) view.findViewById(R.id.comment);
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
ImageView vHasChanges = (ImageView) view.findViewById(R.id.has_changes);
ImageView vEditImage = (ImageView) view.findViewById(R.id.edit_image);
String userId = cursor.getString(mIndexUserId);
String[] splitUserId = KeyRing.splitUserId(userId);
@ -167,8 +168,10 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
} else {
vHasChanges.setVisibility(View.GONE);
}
vEditImage.setVisibility(View.VISIBLE);
} else {
vHasChanges.setVisibility(View.GONE);
vEditImage.setVisibility(View.GONE);
}
if (isRevoked) {

View File

@ -0,0 +1,206 @@
/*
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.adapter;
import android.app.Activity;
import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.ImageButton;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ContactHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
public class UserIdsAddedAdapter extends ArrayAdapter<UserIdsAddedAdapter.UserIdModel> {
private LayoutInflater mInflater;
private Activity mActivity;
private ArrayAdapter<String> mAutoCompleteNameAdapter;
private ArrayAdapter<String> mAutoCompleteEmailAdapter;
// hold a private reference to the underlying data List
private List<UserIdModel> mData;
public static class UserIdModel {
String name = "";
String address = "";
String comment = "";
@Override
public String toString() {
String userId = null;
if (!TextUtils.isEmpty(name)) {
userId = name;
if (!TextUtils.isEmpty(comment)) {
userId += " (" + comment + ")";
}
if (!TextUtils.isEmpty(address)) {
userId += " <" + address + ">";
}
}
return userId;
}
}
public UserIdsAddedAdapter(Activity activity, List<UserIdModel> data) {
super(activity, -1, data);
mActivity = activity;
mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mData = data;
mAutoCompleteNameAdapter = new ArrayAdapter<String>
(mActivity, android.R.layout.simple_dropdown_item_1line,
ContactHelper.getPossibleUserNames(mActivity)
);
mAutoCompleteEmailAdapter = new ArrayAdapter<String>
(mActivity, android.R.layout.simple_dropdown_item_1line,
ContactHelper.getPossibleUserEmails(mActivity)
);
}
public List<String> getDataAsStringList() {
ArrayList<String> out = new ArrayList<String>();
for (UserIdModel id : mData) {
out.add(id.toString());
}
return out;
}
static class ViewHolder {
public AutoCompleteTextView vAddress;
public AutoCompleteTextView vName;
public EditText vComment;
public ImageButton vDelete;
// also hold a reference to the model item
public UserIdModel mModel;
}
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
// Not recycled, inflate a new view
convertView = mInflater.inflate(R.layout.edit_key_user_id_added_item, null);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.vAddress = (AutoCompleteTextView) convertView.findViewById(R.id.user_id_added_item_address);
viewHolder.vName = (AutoCompleteTextView) convertView.findViewById(R.id.user_id_added_item_name);
viewHolder.vComment = (EditText) convertView.findViewById(R.id.user_id_added_item_comment);
viewHolder.vDelete = (ImageButton) convertView.findViewById(R.id.user_id_added_item_delete);
convertView.setTag(viewHolder);
viewHolder.vAddress.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// update referenced item in view holder
viewHolder.mModel.address = s.toString();
// show icon on valid email addresses
if (viewHolder.mModel.address.length() > 0) {
Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(viewHolder.mModel.address);
if (emailMatcher.matches()) {
viewHolder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0,
R.drawable.uid_mail_ok, 0);
} else {
viewHolder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0,
R.drawable.uid_mail_bad, 0);
}
} else {
// remove drawable if email is empty
viewHolder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
}
}
});
viewHolder.vName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// update referenced item in view holder
viewHolder.mModel.name = s.toString();
}
});
viewHolder.vComment.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// update referenced item in view holder
viewHolder.mModel.comment = s.toString();
}
});
viewHolder.vDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// remove reference model item from adapter (data and notify about change)
UserIdsAddedAdapter.this.remove(viewHolder.mModel);
}
});
}
final ViewHolder holder = (ViewHolder) convertView.getTag();
// save reference to model item
holder.mModel = getItem(position);
holder.vAddress.setText(holder.mModel.address);
holder.vAddress.setThreshold(1); // Start working from first character
holder.vAddress.setAdapter(mAutoCompleteEmailAdapter);
holder.vName.setText(holder.mModel.name);
holder.vName.setThreshold(1); // Start working from first character
holder.vName.setAdapter(mAutoCompleteNameAdapter);
holder.vComment.setText(holder.mModel.comment);
return convertView;
}
}

View File

@ -1,146 +0,0 @@
/*
* Copyright (C) 2013-2014 Dominik Schürmann <dominik@dominikschuermann.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.adapter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import java.util.List;
public class UserIdsNewAdapter extends ArrayAdapter<String> {
protected LayoutInflater mInflater;
protected Activity mActivity;
protected List<String> mData;
// static class ViewHolder {
// public TextView vName;
// public TextView vAddress;
// public TextView vComment;
// public ImageView vVerified;
// public ImageView vHasChanges;
// public CheckBox vCheckBox;
// }
public UserIdsNewAdapter(Activity activity) {
super(activity, -1);
mActivity = activity;
mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setData(List<String> data) {
clear();
if (data != null) {
this.mData = data;
// add data to extended ArrayAdapter
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
addAll(data);
} else {
for (String entry : data) {
add(entry);
}
}
}
}
public List<String> getData() {
// String name = mName.getText().toString();
// - String email = mAddress.getText().toString();
// - String comment = mComment.getText().toString();
// -
// - String userId = null;
// - if (!TextUtils.isEmpty(name)) {
// - userId = name;
// - if (!TextUtils.isEmpty(comment)) {
// - userId += " (" + comment + ")";
// - }
// - if (!TextUtils.isEmpty(email)) {
// - userId += " <" + email + ">";
// - }
// - }
return mData;
}
@Override
public boolean hasStableIds() {
return true;
}
public View getView(int position, View convertView, ViewGroup parent) {
String entry = mData.get(position);
// ViewHolder holder;
// if (convertView == null) {
// holder = new ViewHolder();
convertView = mInflater.inflate(R.layout.edit_key_new_userids_item, null);
EditText vName = (EditText) convertView.findViewById(R.id.userId);
EditText vAddress = (EditText) convertView.findViewById(R.id.address);
EditText vComment = (EditText) convertView.findViewById(R.id.comment);
// holder.vVerified = (ImageView) convertView.findViewById(R.id.certified);
ImageView vHasChanges = (ImageView) convertView.findViewById(R.id.has_changes);
// holder.vCheckBox = (CheckBox) convertView.findViewById(R.id.checkBox);
// convertView.setTag(holder);
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
// // user id
// String[] splitUserId = KeyRing.splitUserId(entry);
// if (splitUserId[0] != null) {
// vName.setText(splitUserId[0]);
// } else {
// vName.setText(R.string.user_id_no_name);
// }
// if (splitUserId[1] != null) {
// vAddress.setText(splitUserId[1]);
// vAddress.setVisibility(View.VISIBLE);
// } else {
// holder.vAddress.setVisibility(View.GONE);
// }
// if (splitUserId[2] != null) {
// vComment.setText(splitUserId[2]);
// vComment.setVisibility(View.VISIBLE);
// } else {
// holder.vComment.setVisibility(View.GONE);
// }
//
// holder.vCheckBox.setVisibility(View.GONE);
//
// holder.vVerified.setImageResource(R.drawable.key_certify_ok_depth0);
//
// // all items are "new"
// holder.vHasChanges.setVisibility(View.VISIBLE);
return convertView;
}
}

View File

@ -25,9 +25,7 @@ import android.widget.ListView;
* Automatically calculate height of ListView based on contained items. This enables to put this
* ListView into a ScrollView without messing up.
* <p/>
* from
* http://stackoverflow.com/questions/2419246/how-do-i-create-a-listview-thats-not-in-a-scrollview-
* or-has-the-scrollview-dis
* from http://stackoverflow.com/a/3580117
*/
public class FixedListView extends ListView {

View File

@ -388,7 +388,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
// get new key from data bundle returned from service
Bundle data = message.getData();
Bundle data = message.getDataAsStringList();
UncachedSecretKey newKey = PgpConversionHelper
.BytesToPGPSecretKey(data
.getByteArray(KeychainIntentService.RESULT_NEW_KEY));

View File

@ -111,7 +111,7 @@
android:layout_height="match_parent"
android:text="add key"
android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableRight="@drawable/ic_action_add_person"
android:drawableRight="@drawable/ic_action_new_account"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:clickable="true"

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:singleLine="true">
<ImageView
android:id="@+id/has_changes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="10dp"
android:background="@color/result_green" />
<LinearLayout
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_width="0dip"
android:layout_marginLeft="8dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<AutoCompleteTextView
android:id="@+id/user_id_added_item_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_email"
android:inputType="textEmailAddress"
android:textAppearance="?android:attr/textAppearanceMedium" />
<AutoCompleteTextView
android:id="@+id/user_id_added_item_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="@string/label_name"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="@+id/user_id_added_item_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/tertiary_text_light"
android:hint="@string/label_comment"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<ImageButton
android:id="@+id/user_id_added_item_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="8dp"
android:src="@drawable/ic_action_cancel"
android:layout_gravity="center_vertical"
style="@style/SelectableItem" />
</LinearLayout>

View File

@ -51,19 +51,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/edit"
style="@style/SelectableItem"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false"
android:enabled="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black"
android:src="@drawable/ic_action_edit"
android:text="@string/edit"
android:padding="12dp" />
<TextView
android:id="@+id/revoked"
android:layout_width="wrap_content"

View File

@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="10dp"
android:background="@color/emphasis" />
android:background="@color/result_green" />
<CheckBox
android:id="@+id/checkBox"
@ -41,6 +41,8 @@
android:layout_gravity="center_vertical"
android:layout_width="0dip"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_height="wrap_content"
android:layout_weight="1">
@ -68,4 +70,13 @@
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/edit_image"
android:src="@drawable/ic_action_edit"
android:padding="8dp"
android:layout_gravity="center_horizontal" />
</LinearLayout>