mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 14:08:24 -05:00
Add user id with dialog
This commit is contained in:
parent
acbf2a1861
commit
c9b028804c
@ -1,12 +1,15 @@
|
|||||||
package org.sufficientlysecure.keychain.pgp;
|
package org.sufficientlysecure.keychain.pgp;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/** An abstract KeyRing.
|
/**
|
||||||
*
|
* An abstract KeyRing.
|
||||||
|
* <p/>
|
||||||
* This is an abstract class for all KeyRing constructs. It serves as a common
|
* This is an abstract class for all KeyRing constructs. It serves as a common
|
||||||
* denominator of available information, two implementations wrapping the same
|
* denominator of available information, two implementations wrapping the same
|
||||||
* keyring should in all cases agree on the output of all methods described
|
* keyring should in all cases agree on the output of all methods described
|
||||||
@ -14,7 +17,6 @@ import java.util.regex.Pattern;
|
|||||||
*
|
*
|
||||||
* @see CanonicalizedKeyRing
|
* @see CanonicalizedKeyRing
|
||||||
* @see org.sufficientlysecure.keychain.provider.CachedPublicKeyRing
|
* @see org.sufficientlysecure.keychain.provider.CachedPublicKeyRing
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class KeyRing {
|
public abstract class KeyRing {
|
||||||
|
|
||||||
@ -77,4 +79,24 @@ public abstract class KeyRing {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a composed user id. Returns null if name is null!
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param email
|
||||||
|
* @param comment
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String createUserId(String name, String email, String comment) {
|
||||||
|
String userId = name; // consider name a required value
|
||||||
|
if (userId != null && !TextUtils.isEmpty(comment)) {
|
||||||
|
userId += " (" + comment + ")";
|
||||||
|
}
|
||||||
|
if (userId != null && !TextUtils.isEmpty(email)) {
|
||||||
|
userId += " <" + email + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import org.spongycastle.bcpg.sig.KeyFlags;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||||
@ -171,7 +172,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.CERTIFY_OTHER, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.CERTIFY_OTHER, null));
|
||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.SIGN_DATA, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.SIGN_DATA, null));
|
||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, null));
|
||||||
String userId = mName + " <" + mEmail + ">";
|
String userId = KeyRing.createUserId(mName, mEmail, null);
|
||||||
parcel.mAddUserIds.add(userId);
|
parcel.mAddUserIds.add(userId);
|
||||||
parcel.mNewPassphrase = mPassphrase;
|
parcel.mNewPassphrase = mPassphrase;
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ import org.sufficientlysecure.keychain.R;
|
|||||||
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
||||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||||
@ -55,6 +57,7 @@ import org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter;
|
|||||||
import org.sufficientlysecure.keychain.ui.adapter.SubkeysAddedAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.SubkeysAddedAdapter;
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter;
|
||||||
|
import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.ChangeExpiryDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.ChangeExpiryDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
|
||||||
@ -89,11 +92,10 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
private UserIdsAddedAdapter mUserIdsAddedAdapter;
|
private UserIdsAddedAdapter mUserIdsAddedAdapter;
|
||||||
private SubkeysAddedAdapter mSubkeysAddedAdapter;
|
private SubkeysAddedAdapter mSubkeysAddedAdapter;
|
||||||
|
|
||||||
private ArrayList<UserIdsAddedAdapter.UserIdModel> mUserIdsAddedData;
|
|
||||||
|
|
||||||
private Uri mDataUri;
|
private Uri mDataUri;
|
||||||
|
|
||||||
private SaveKeyringParcel mSaveKeyringParcel;
|
private SaveKeyringParcel mSaveKeyringParcel;
|
||||||
|
private String mPrimaryUserId;
|
||||||
|
|
||||||
private String mCurrentPassphrase;
|
private String mCurrentPassphrase;
|
||||||
|
|
||||||
@ -173,8 +175,13 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
|
|
||||||
mSaveKeyringParcel = new SaveKeyringParcel(keyRing.getMasterKeyId(),
|
mSaveKeyringParcel = new SaveKeyringParcel(keyRing.getMasterKeyId(),
|
||||||
keyRing.getUncachedKeyRing().getFingerprint());
|
keyRing.getUncachedKeyRing().getFingerprint());
|
||||||
|
mPrimaryUserId = keyRing.getPrimaryUserIdWithFallback();
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Log.e(Constants.TAG, "Keyring not found: " + e.getMessage(), e);
|
Log.e(Constants.TAG, "Keyring not found", e);
|
||||||
|
Toast.makeText(getActivity(), R.string.error_no_secret_key_found, Toast.LENGTH_SHORT).show();
|
||||||
|
getActivity().finish();
|
||||||
|
} catch (PgpGeneralException e) {
|
||||||
|
Log.e(Constants.TAG, "PgpGeneralException", e);
|
||||||
Toast.makeText(getActivity(), R.string.error_no_secret_key_found, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.error_no_secret_key_found, Toast.LENGTH_SHORT).show();
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
@ -213,9 +220,8 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: mUserIdsAddedData and SaveParcel from savedInstance?!
|
// TODO: SaveParcel from savedInstance?!
|
||||||
mUserIdsAddedData = new ArrayList<UserIdsAddedAdapter.UserIdModel>();
|
mUserIdsAddedAdapter = new UserIdsAddedAdapter(getActivity(), mSaveKeyringParcel.mAddUserIds);
|
||||||
mUserIdsAddedAdapter = new UserIdsAddedAdapter(getActivity(), mUserIdsAddedData);
|
|
||||||
mUserIdsAddedList.setAdapter(mUserIdsAddedAdapter);
|
mUserIdsAddedList.setAdapter(mUserIdsAddedAdapter);
|
||||||
|
|
||||||
mSubkeysAdapter = new SubkeysAdapter(getActivity(), null, 0, mSaveKeyringParcel);
|
mSubkeysAdapter = new SubkeysAdapter(getActivity(), null, 0, mSaveKeyringParcel);
|
||||||
@ -421,7 +427,29 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addUserId() {
|
private void addUserId() {
|
||||||
mUserIdsAddedAdapter.add(new UserIdsAddedAdapter.UserIdModel());
|
// Message is received after passphrase is cached
|
||||||
|
Handler returnHandler = new Handler() {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message message) {
|
||||||
|
if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
|
||||||
|
Bundle data = message.getData();
|
||||||
|
|
||||||
|
// add new user id
|
||||||
|
mUserIdsAddedAdapter.add(data
|
||||||
|
.getString(AddUserIdDialogFragment.MESSAGE_DATA_USER_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a new Messenger for the communication back
|
||||||
|
Messenger messenger = new Messenger(returnHandler);
|
||||||
|
|
||||||
|
// pre-fill out primary name
|
||||||
|
String predefinedName = KeyRing.splitUserId(mPrimaryUserId)[0];
|
||||||
|
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger,
|
||||||
|
predefinedName);
|
||||||
|
|
||||||
|
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSubkey() {
|
private void addSubkey() {
|
||||||
@ -451,8 +479,6 @@ public class EditKeyFragment extends LoaderFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void save(String passphrase) {
|
private void save(String passphrase) {
|
||||||
mSaveKeyringParcel.mAddUserIds = mUserIdsAddedAdapter.getDataAsStringList();
|
|
||||||
|
|
||||||
Log.d(Constants.TAG, "mSaveKeyringParcel.mAddUserIds: " + mSaveKeyringParcel.mAddUserIds);
|
Log.d(Constants.TAG, "mSaveKeyringParcel.mAddUserIds: " + mSaveKeyringParcel.mAddUserIds);
|
||||||
Log.d(Constants.TAG, "mSaveKeyringParcel.mNewPassphrase: " + mSaveKeyringParcel.mNewPassphrase);
|
Log.d(Constants.TAG, "mSaveKeyringParcel.mNewPassphrase: " + mSaveKeyringParcel.mNewPassphrase);
|
||||||
Log.d(Constants.TAG, "mSaveKeyringParcel.mRevokeUserIds: " + mSaveKeyringParcel.mRevokeUserIds);
|
Log.d(Constants.TAG, "mSaveKeyringParcel.mRevokeUserIds: " + mSaveKeyringParcel.mRevokeUserIds);
|
||||||
|
@ -114,7 +114,7 @@ public class SubkeysAdapter extends CursorAdapter {
|
|||||||
ImageView vEncryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
|
ImageView vEncryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
|
||||||
ImageView vSignIcon = (ImageView) view.findViewById(R.id.ic_signKey);
|
ImageView vSignIcon = (ImageView) view.findViewById(R.id.ic_signKey);
|
||||||
ImageView vRevokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey);
|
ImageView vRevokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey);
|
||||||
ImageView vEditImage = (ImageView) view.findViewById(R.id.edit_image);
|
ImageView vEditImage = (ImageView) view.findViewById(R.id.user_id_item_edit_image);
|
||||||
|
|
||||||
long keyId = cursor.getLong(INDEX_KEY_ID);
|
long keyId = cursor.getLong(INDEX_KEY_ID);
|
||||||
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
|
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
|
||||||
|
@ -102,11 +102,14 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
TextView vName = (TextView) view.findViewById(R.id.userId);
|
TextView vName = (TextView) view.findViewById(R.id.user_id_item_name);
|
||||||
TextView vAddress = (TextView) view.findViewById(R.id.address);
|
TextView vAddress = (TextView) view.findViewById(R.id.user_id_item_address);
|
||||||
TextView vComment = (TextView) view.findViewById(R.id.comment);
|
TextView vComment = (TextView) view.findViewById(R.id.user_id_item_comment);
|
||||||
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
|
ImageView vVerified = (ImageView) view.findViewById(R.id.user_id_item_certified);
|
||||||
ImageView vEditImage = (ImageView) view.findViewById(R.id.edit_image);
|
View vVerifiedLayout = view.findViewById(R.id.user_id_item_certified_layout);
|
||||||
|
ImageView vEditImage = (ImageView) view.findViewById(R.id.user_id_item_edit_image);
|
||||||
|
ImageView vDeleteButton = (ImageView) view.findViewById(R.id.user_id_item_delete_button);
|
||||||
|
vDeleteButton.setVisibility(View.GONE); // not used
|
||||||
|
|
||||||
String userId = cursor.getString(INDEX_USER_ID);
|
String userId = cursor.getString(INDEX_USER_ID);
|
||||||
String[] splitUserId = KeyRing.splitUserId(userId);
|
String[] splitUserId = KeyRing.splitUserId(userId);
|
||||||
@ -152,8 +155,10 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
|
|||||||
}
|
}
|
||||||
|
|
||||||
vEditImage.setVisibility(View.VISIBLE);
|
vEditImage.setVisibility(View.VISIBLE);
|
||||||
|
vVerifiedLayout.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
vEditImage.setVisibility(View.GONE);
|
vEditImage.setVisibility(View.GONE);
|
||||||
|
vVerifiedLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRevoked) {
|
if (isRevoked) {
|
||||||
@ -211,7 +216,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CheckBox vCheckBox = (CheckBox) view.findViewById(R.id.checkBox);
|
final CheckBox vCheckBox = (CheckBox) view.findViewById(R.id.user_id_item_check_box);
|
||||||
final int position = cursor.getPosition();
|
final int position = cursor.getPosition();
|
||||||
vCheckBox.setOnCheckedChangeListener(null);
|
vCheckBox.setOnCheckedChangeListener(null);
|
||||||
vCheckBox.setChecked(mCheckStates.get(position));
|
vCheckBox.setChecked(mCheckStates.get(position));
|
||||||
@ -225,7 +230,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||||
CheckBox box = ((CheckBox) view.findViewById(R.id.checkBox));
|
CheckBox box = ((CheckBox) view.findViewById(R.id.user_id_item_check_box));
|
||||||
if (box != null) {
|
if (box != null) {
|
||||||
box.toggle();
|
box.toggle();
|
||||||
}
|
}
|
||||||
@ -251,7 +256,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
|
|||||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||||
View view = mInflater.inflate(R.layout.view_key_user_id_item, null);
|
View view = mInflater.inflate(R.layout.view_key_user_id_item, null);
|
||||||
// only need to do this once ever, since mShowCheckBoxes is final
|
// only need to do this once ever, since mShowCheckBoxes is final
|
||||||
view.findViewById(R.id.checkBox).setVisibility(mCheckStates != null ? View.VISIBLE : View.GONE);
|
view.findViewById(R.id.user_id_item_check_box).setVisibility(mCheckStates != null ? View.VISIBLE : View.GONE);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,163 +19,66 @@ package org.sufficientlysecure.keychain.ui.adapter;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
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.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.helper.ContactHelper;
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
public class UserIdsAddedAdapter extends ArrayAdapter<UserIdsAddedAdapter.UserIdModel> {
|
public class UserIdsAddedAdapter extends ArrayAdapter<String> {
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private Activity mActivity;
|
|
||||||
|
|
||||||
private ArrayAdapter<String> mAutoCompleteNameAdapter;
|
|
||||||
private ArrayAdapter<String> mAutoCompleteEmailAdapter;
|
|
||||||
|
|
||||||
// hold a private reference to the underlying data List
|
// hold a private reference to the underlying data List
|
||||||
private List<UserIdModel> mData;
|
private List<String> mData;
|
||||||
|
|
||||||
public static class UserIdModel {
|
public UserIdsAddedAdapter(Activity activity, List<String> data) {
|
||||||
String name = "";
|
|
||||||
String address = "";
|
|
||||||
String comment = "";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
String 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);
|
super(activity, -1, data);
|
||||||
mActivity = activity;
|
|
||||||
mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
mData = data;
|
mData = data;
|
||||||
mAutoCompleteNameAdapter = new ArrayAdapter<String>
|
|
||||||
(mActivity, android.R.layout.simple_spinner_dropdown_item,
|
|
||||||
ContactHelper.getPossibleUserNames(mActivity)
|
|
||||||
);
|
|
||||||
mAutoCompleteEmailAdapter = new ArrayAdapter<String>
|
|
||||||
(mActivity, android.R.layout.simple_spinner_dropdown_item,
|
|
||||||
ContactHelper.getPossibleUserEmails(mActivity)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getDataAsStringList() {
|
public List<String> getData() {
|
||||||
ArrayList<String> out = new ArrayList<String>();
|
return mData;
|
||||||
for (UserIdModel id : mData) {
|
|
||||||
// ignore empty user ids
|
|
||||||
if (!TextUtils.isEmpty(id.toString())) {
|
|
||||||
out.add(id.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ViewHolder {
|
static class ViewHolder {
|
||||||
public AutoCompleteTextView vAddress;
|
public TextView vAddress;
|
||||||
public AutoCompleteTextView vName;
|
public TextView vName;
|
||||||
public EditText vComment;
|
public TextView vComment;
|
||||||
public ImageButton vDelete;
|
public ImageButton vDelete;
|
||||||
// also hold a reference to the model item
|
// also hold a reference to the model item
|
||||||
public UserIdModel mModel;
|
public String mModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
// Not recycled, inflate a new view
|
// Not recycled, inflate a new view
|
||||||
convertView = mInflater.inflate(R.layout.edit_key_user_id_added_item, null);
|
convertView = mInflater.inflate(R.layout.view_key_user_id_item, null);
|
||||||
final ViewHolder holder = new ViewHolder();
|
final ViewHolder holder = new ViewHolder();
|
||||||
holder.vAddress = (AutoCompleteTextView) convertView.findViewById(R.id.user_id_added_item_address);
|
holder.vAddress = (TextView) convertView.findViewById(R.id.user_id_item_address);
|
||||||
holder.vName = (AutoCompleteTextView) convertView.findViewById(R.id.user_id_added_item_name);
|
holder.vName = (TextView) convertView.findViewById(R.id.user_id_item_name);
|
||||||
holder.vComment = (EditText) convertView.findViewById(R.id.user_id_added_item_comment);
|
holder.vComment = (TextView) convertView.findViewById(R.id.user_id_item_comment);
|
||||||
holder.vDelete = (ImageButton) convertView.findViewById(R.id.user_id_added_item_delete);
|
holder.vDelete = (ImageButton) convertView.findViewById(R.id.user_id_item_delete_button);
|
||||||
|
holder.vDelete.setVisibility(View.VISIBLE); // always visible
|
||||||
|
|
||||||
|
// not used:
|
||||||
|
CheckBox checkBox = (CheckBox) convertView.findViewById(R.id.user_id_item_check_box);
|
||||||
|
View certifiedLayout = convertView.findViewById(R.id.user_id_item_certified_layout);
|
||||||
|
ImageView editImage = (ImageView) convertView.findViewById(R.id.user_id_item_edit_image);
|
||||||
|
checkBox.setVisibility(View.GONE);
|
||||||
|
certifiedLayout.setVisibility(View.GONE);
|
||||||
|
editImage.setVisibility(View.GONE);
|
||||||
|
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
|
|
||||||
holder.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
|
|
||||||
holder.mModel.address = s.toString();
|
|
||||||
|
|
||||||
// show icon on valid email addresses
|
|
||||||
if (holder.mModel.address.length() > 0) {
|
|
||||||
Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(holder.mModel.address);
|
|
||||||
if (emailMatcher.matches()) {
|
|
||||||
holder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
|
||||||
R.drawable.uid_mail_ok, 0);
|
|
||||||
} else {
|
|
||||||
holder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
|
||||||
R.drawable.uid_mail_bad, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// remove drawable if email is empty
|
|
||||||
holder.vAddress.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.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
|
|
||||||
holder.mModel.name = s.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.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
|
|
||||||
holder.mModel.comment = s.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.vDelete.setOnClickListener(new View.OnClickListener() {
|
holder.vDelete.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -183,22 +86,30 @@ public class UserIdsAddedAdapter extends ArrayAdapter<UserIdsAddedAdapter.UserId
|
|||||||
UserIdsAddedAdapter.this.remove(holder.mModel);
|
UserIdsAddedAdapter.this.remove(holder.mModel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
final ViewHolder holder = (ViewHolder) convertView.getTag();
|
final ViewHolder holder = (ViewHolder) convertView.getTag();
|
||||||
|
|
||||||
// save reference to model item
|
// save reference to model item
|
||||||
holder.mModel = getItem(position);
|
holder.mModel = getItem(position);
|
||||||
|
|
||||||
holder.vAddress.setText(holder.mModel.address);
|
String[] splitUserId = KeyRing.splitUserId(holder.mModel);
|
||||||
holder.vAddress.setThreshold(1); // Start working from first character
|
if (splitUserId[0] != null) {
|
||||||
holder.vAddress.setAdapter(mAutoCompleteEmailAdapter);
|
holder.vName.setText(splitUserId[0]);
|
||||||
|
} else {
|
||||||
holder.vName.setText(holder.mModel.name);
|
holder.vName.setText(R.string.user_id_no_name);
|
||||||
holder.vName.setThreshold(1); // Start working from first character
|
}
|
||||||
holder.vName.setAdapter(mAutoCompleteNameAdapter);
|
if (splitUserId[1] != null) {
|
||||||
|
holder.vAddress.setText(splitUserId[1]);
|
||||||
holder.vComment.setText(holder.mModel.comment);
|
holder.vAddress.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
holder.vAddress.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (splitUserId[2] != null) {
|
||||||
|
holder.vComment.setText(splitUserId[2]);
|
||||||
|
holder.vComment.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
holder.vComment.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,268 @@
|
|||||||
|
/*
|
||||||
|
* 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.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.os.Messenger;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Patterns;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.AutoCompleteTextView;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.helper.ContactHelper;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
public class AddUserIdDialogFragment extends DialogFragment implements OnEditorActionListener {
|
||||||
|
private static final String ARG_MESSENGER = "messenger";
|
||||||
|
private static final String ARG_NAME = "name";
|
||||||
|
|
||||||
|
public static final int MESSAGE_OKAY = 1;
|
||||||
|
public static final int MESSAGE_CANCEL = 2;
|
||||||
|
|
||||||
|
public static final String MESSAGE_DATA_USER_ID = "user_id";
|
||||||
|
|
||||||
|
private Messenger mMessenger;
|
||||||
|
private AutoCompleteTextView mName;
|
||||||
|
private AutoCompleteTextView mEmail;
|
||||||
|
private EditText mComment;
|
||||||
|
|
||||||
|
public static AddUserIdDialogFragment newInstance(Messenger messenger, String predefinedName) {
|
||||||
|
|
||||||
|
AddUserIdDialogFragment frag = new AddUserIdDialogFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putParcelable(ARG_MESSENGER, messenger);
|
||||||
|
args.putString(ARG_NAME, predefinedName);
|
||||||
|
frag.setArguments(args);
|
||||||
|
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates dialog
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
|
||||||
|
String predefinedName = getArguments().getString(ARG_NAME);
|
||||||
|
|
||||||
|
ArrayAdapter<String> autoCompleteEmailAdapter = new ArrayAdapter<String>
|
||||||
|
(getActivity(), android.R.layout.simple_spinner_dropdown_item,
|
||||||
|
ContactHelper.getPossibleUserEmails(getActivity())
|
||||||
|
);
|
||||||
|
|
||||||
|
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity);
|
||||||
|
|
||||||
|
alert.setTitle(R.string.edit_key_action_add_identity);
|
||||||
|
|
||||||
|
LayoutInflater inflater = activity.getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.add_user_id_dialog, null);
|
||||||
|
alert.setView(view);
|
||||||
|
|
||||||
|
mName = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_name);
|
||||||
|
mEmail = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_address);
|
||||||
|
mComment = (EditText) view.findViewById(R.id.add_user_id_comment);
|
||||||
|
|
||||||
|
mName.setText(predefinedName);
|
||||||
|
|
||||||
|
mEmail.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 editable) {
|
||||||
|
String email = editable.toString();
|
||||||
|
if (email.length() > 0) {
|
||||||
|
Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email);
|
||||||
|
if (emailMatcher.matches()) {
|
||||||
|
mEmail.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
||||||
|
R.drawable.uid_mail_ok, 0);
|
||||||
|
} else {
|
||||||
|
mEmail.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
||||||
|
R.drawable.uid_mail_bad, 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// remove drawable if email is empty
|
||||||
|
mEmail.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mEmail.setThreshold(1); // Start working from first character
|
||||||
|
mEmail.setAdapter(autoCompleteEmailAdapter);
|
||||||
|
|
||||||
|
alert.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dismiss();
|
||||||
|
|
||||||
|
// return new user id back to activity
|
||||||
|
Bundle data = new Bundle();
|
||||||
|
String userId = KeyRing.createUserId(mName.getText().toString(),
|
||||||
|
mEmail.getText().toString(), mComment.getText().toString());
|
||||||
|
data.putString(MESSAGE_DATA_USER_ID, userId);
|
||||||
|
sendMessageToHandler(MESSAGE_OKAY, data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setNegativeButton(android.R.string.cancel, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hack to open keyboard.
|
||||||
|
// This is the only method that I found to work across all Android versions
|
||||||
|
// http://turbomanage.wordpress.com/2012/05/02/show-soft-keyboard-automatically-when-edittext-receives-focus/
|
||||||
|
// Notes: * onCreateView can't be used because we want to add buttons to the dialog
|
||||||
|
// * opening in onActivityCreated does not work on Android 4.4
|
||||||
|
mEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
mEmail.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
InputMethodManager imm = (InputMethodManager) getActivity()
|
||||||
|
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(mEmail, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mEmail.requestFocus();
|
||||||
|
|
||||||
|
mComment.setImeActionLabel(getString(android.R.string.ok), EditorInfo.IME_ACTION_DONE);
|
||||||
|
mComment.setOnEditorActionListener(this);
|
||||||
|
|
||||||
|
return alert.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
super.onCancel(dialog);
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
sendMessageToHandler(MESSAGE_CANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
Log.d(Constants.TAG, "onDismiss");
|
||||||
|
|
||||||
|
// hide keyboard on dismiss
|
||||||
|
hideKeyboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideKeyboard() {
|
||||||
|
InputMethodManager inputManager = (InputMethodManager) getActivity()
|
||||||
|
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
||||||
|
//check if no view has focus:
|
||||||
|
View v = getActivity().getCurrentFocus();
|
||||||
|
if (v == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate the "done" button on the soft keyboard with the okay button in the view
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
|
if (EditorInfo.IME_ACTION_DONE == actionId) {
|
||||||
|
AlertDialog dialog = ((AlertDialog) getDialog());
|
||||||
|
Button bt = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
|
|
||||||
|
bt.performClick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send message back to handler which is initialized in a activity
|
||||||
|
*
|
||||||
|
* @param what Message integer you want to send
|
||||||
|
*/
|
||||||
|
private void sendMessageToHandler(Integer what) {
|
||||||
|
Message msg = Message.obtain();
|
||||||
|
msg.what = what;
|
||||||
|
|
||||||
|
try {
|
||||||
|
mMessenger.send(msg);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Log.w(Constants.TAG, "Messenger is null!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send message back to handler which is initialized in a activity
|
||||||
|
*
|
||||||
|
* @param what Message integer you want to send
|
||||||
|
*/
|
||||||
|
private void sendMessageToHandler(Integer what, Bundle data) {
|
||||||
|
Message msg = Message.obtain();
|
||||||
|
msg.what = what;
|
||||||
|
if (data != null) {
|
||||||
|
msg.setData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mMessenger.send(msg);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Log.w(Constants.TAG, "Messenger is null!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -110,7 +110,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
mName = (EditText) findViewById(R.id.name);
|
mName = (EditText) findViewById(R.id.name);
|
||||||
mName.addTextChangedListener(mTextWatcher);
|
mName.addTextChangedListener(mTextWatcher);
|
||||||
mEmail = (AutoCompleteTextView) findViewById(R.id.email);
|
mEmail = (AutoCompleteTextView) findViewById(R.id.email);
|
||||||
mComment = (EditText) findViewById(R.id.comment);
|
mComment = (EditText) findViewById(R.id.user_id_item_comment);
|
||||||
mComment.addTextChangedListener(mTextWatcher);
|
mComment.addTextChangedListener(mTextWatcher);
|
||||||
|
|
||||||
|
|
||||||
|
41
OpenKeychain/src/main/res/layout/add_user_id_dialog.xml
Normal file
41
OpenKeychain/src/main/res/layout/add_user_id_dialog.xml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?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:orientation="vertical"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/add_user_id_address"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/label_email"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/add_user_id_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:hint="@string/create_key_hint_full_name"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/add_user_id_comment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/tertiary_text_light"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:lines="1"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:hint="@string/label_comment"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -64,6 +64,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:hint="@string/label_passphrase"
|
android:hint="@string/label_passphrase"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
<?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:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:minWidth="10dp"
|
|
||||||
android:background="@color/android_green_light" />
|
|
||||||
|
|
||||||
<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>
|
|
@ -67,7 +67,7 @@
|
|||||||
android:text="@string/label_comment" />
|
android:text="@string/label_comment" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/comment"
|
android:id="@+id/user_id_item_comment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/edit_image"
|
android:id="@+id/user_id_item_edit_image"
|
||||||
android:src="@drawable/ic_action_edit"
|
android:src="@drawable/ic_action_edit"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_toRightOf="@id/ic_masterKey"
|
android:layout_toRightOf="@id/ic_masterKey"
|
||||||
android:layout_toLeftOf="@id/edit_image"
|
android:layout_toLeftOf="@id/user_id_item_edit_image"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -7,13 +7,14 @@
|
|||||||
android:singleLine="true">
|
android:singleLine="true">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBox"
|
android:id="@+id/user_id_item_check_box"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false" />
|
android:focusable="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/user_id_item_certified_layout"
|
||||||
android:layout_width="22dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
@ -21,9 +22,9 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/user_id_item_certified"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/certified"
|
|
||||||
android:layout_gravity="center_horizontal" />
|
android:layout_gravity="center_horizontal" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -39,21 +40,21 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/address"
|
android:id="@+id/user_id_item_address"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="alice@example.com"
|
android:text="alice@example.com"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userId"
|
android:id="@+id/user_id_item_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Alice"
|
android:text="Alice"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment"
|
android:id="@+id/user_id_item_comment"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/tertiary_text_light"
|
android:textColor="@color/tertiary_text_light"
|
||||||
@ -63,11 +64,20 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/edit_image"
|
android:id="@+id/user_id_item_edit_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@drawable/ic_action_edit"
|
android:src="@drawable/ic_action_edit"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:layout_gravity="center_horizontal" />
|
android:layout_gravity="center_horizontal" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/user_id_item_delete_button"
|
||||||
|
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>
|
</LinearLayout>
|
||||||
|
@ -311,9 +311,9 @@
|
|||||||
<string name="progress_modify">modifying keyring…</string>
|
<string name="progress_modify">modifying keyring…</string>
|
||||||
|
|
||||||
<string name="progress_modify_unlock">unlocking keyring…</string>
|
<string name="progress_modify_unlock">unlocking keyring…</string>
|
||||||
<string name="progress_modify_adduid">adding user ids…</string>
|
<string name="progress_modify_adduid">adding user IDs…</string>
|
||||||
<string name="progress_modify_revokeuid">revoking user ids…</string>
|
<string name="progress_modify_revokeuid">revoking user IDs…</string>
|
||||||
<string name="progress_modify_primaryuid">changing primary user id…</string>
|
<string name="progress_modify_primaryuid">changing primary user ID…</string>
|
||||||
<string name="progress_modify_subkeychange">modifying subkeys…</string>
|
<string name="progress_modify_subkeychange">modifying subkeys…</string>
|
||||||
<string name="progress_modify_subkeyrevoke">revoking subkeys…</string>
|
<string name="progress_modify_subkeyrevoke">revoking subkeys…</string>
|
||||||
<string name="progress_modify_subkeyadd">adding subkeys…</string>
|
<string name="progress_modify_subkeyadd">adding subkeys…</string>
|
||||||
|
2
extern/openkeychain-api-lib
vendored
2
extern/openkeychain-api-lib
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 02cb8ad24b780f3b97073f2526f83057c99d4243
|
Subproject commit 48941ca6ec58c4583cdcf9d647ad5174925e2f28
|
2
extern/openpgp-api-lib
vendored
2
extern/openpgp-api-lib
vendored
@ -1 +1 @@
|
|||||||
Subproject commit e515a49027fc5de36b8977cf8b096afc9838a9be
|
Subproject commit 869ab96e6dcd4821fd5360248429e49dae6fbaca
|
2
extern/spongycastle
vendored
2
extern/spongycastle
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9e4fb80c4f8efb8a0f8fd0c1cc1e74a421d1eb7e
|
Subproject commit a68ebd1ffc5af880903b2905c17e4f6ac0f13988
|
Loading…
Reference in New Issue
Block a user