Merge remote-tracking branch 'origin/development' into linked-identities
Conflicts: OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java OpenKeychain/src/main/res/layout/view_key_fragment.xml
This commit is contained in:
@@ -20,17 +20,30 @@ package org.sufficientlysecure.keychain.ui;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.AddEmailDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.widget.EmailEditText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateKeyEmailFragment extends Fragment {
|
||||
|
||||
public static final String ARG_NAME = "name";
|
||||
@@ -38,10 +51,14 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
|
||||
CreateKeyActivity mCreateKeyActivity;
|
||||
EmailEditText mEmailEdit;
|
||||
RecyclerView mEmailsRecyclerView;
|
||||
View mBackButton;
|
||||
View mNextButton;
|
||||
|
||||
String mName;
|
||||
ArrayList<EmailAdapter.ViewModel> mAdditionalEmailModels;
|
||||
|
||||
EmailAdapter mEmailAdapter;
|
||||
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
@@ -86,6 +103,7 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
mEmailEdit = (EmailEditText) view.findViewById(R.id.create_key_email);
|
||||
mBackButton = view.findViewById(R.id.create_key_back_button);
|
||||
mNextButton = view.findViewById(R.id.create_key_next_button);
|
||||
mEmailsRecyclerView = (RecyclerView) view.findViewById(R.id.create_key_emails);
|
||||
|
||||
// initial values
|
||||
mName = getArguments().getString(ARG_NAME);
|
||||
@@ -108,10 +126,45 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
createKeyCheck();
|
||||
}
|
||||
});
|
||||
mEmailsRecyclerView.setHasFixedSize(true);
|
||||
mEmailsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mEmailsRecyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
|
||||
mAdditionalEmailModels = new ArrayList<>();
|
||||
mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
addEmail();
|
||||
}
|
||||
});
|
||||
mEmailsRecyclerView.setAdapter(mEmailAdapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void addEmail() {
|
||||
Handler returnHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
|
||||
Bundle data = message.getData();
|
||||
|
||||
// add new user id
|
||||
mEmailAdapter.add(
|
||||
data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Create a new Messenger for the communication back
|
||||
Messenger messenger = new Messenger(returnHandler);
|
||||
|
||||
AddEmailDialogFragment addEmailDialog = AddEmailDialogFragment.newInstance(messenger);
|
||||
|
||||
addEmailDialog.show(getActivity().getSupportFragmentManager(), "addEmailDialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
@@ -121,14 +174,137 @@ public class CreateKeyEmailFragment extends Fragment {
|
||||
private void createKeyCheck() {
|
||||
if (isEditTextNotEmpty(getActivity(), mEmailEdit)) {
|
||||
|
||||
ArrayList<String> emails = new ArrayList<>();
|
||||
for (EmailAdapter.ViewModel holder : mAdditionalEmailModels) {
|
||||
emails.add(holder.toString());
|
||||
}
|
||||
|
||||
CreateKeyPassphraseFragment frag =
|
||||
CreateKeyPassphraseFragment.newInstance(
|
||||
mName,
|
||||
mEmailEdit.getText().toString()
|
||||
mEmailEdit.getText().toString(),
|
||||
emails
|
||||
);
|
||||
|
||||
mCreateKeyActivity.loadFragment(null, frag, FragAction.TO_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
public static class EmailAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private List<ViewModel> mDataset;
|
||||
private View.OnClickListener mFooterOnClickListener;
|
||||
private static final int TYPE_FOOTER = 0;
|
||||
private static final int TYPE_ITEM = 1;
|
||||
|
||||
public static class ViewModel {
|
||||
String email;
|
||||
|
||||
ViewModel(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return email;
|
||||
}
|
||||
}
|
||||
|
||||
// Provide a reference to the views for each data item
|
||||
// Complex data items may need more than one view per item, and
|
||||
// you provide access to all the views for a data item in a view holder
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
// each data item is just a string in this case
|
||||
public TextView mTextView;
|
||||
public ImageButton mDeleteButton;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mTextView = (TextView) itemView.findViewById(R.id.create_key_email_item_email);
|
||||
mDeleteButton = (ImageButton) itemView.findViewById(R.id.create_key_email_item_delete_button);
|
||||
}
|
||||
}
|
||||
|
||||
class FooterHolder extends RecyclerView.ViewHolder {
|
||||
public Button mAddButton;
|
||||
|
||||
public FooterHolder(View itemView) {
|
||||
super(itemView);
|
||||
mAddButton = (Button) itemView.findViewById(R.id.create_key_add_email);
|
||||
}
|
||||
}
|
||||
|
||||
// Provide a suitable constructor (depends on the kind of dataset)
|
||||
public EmailAdapter(List<ViewModel> myDataset, View.OnClickListener onFooterClickListener) {
|
||||
mDataset = myDataset;
|
||||
mFooterOnClickListener = onFooterClickListener;
|
||||
}
|
||||
|
||||
// Create new views (invoked by the layout manager)
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
if (viewType == TYPE_FOOTER) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.create_key_email_list_footer, parent, false);
|
||||
return new FooterHolder(v);
|
||||
} else {
|
||||
//inflate your layout and pass it to view holder
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.create_key_email_list_item, parent, false);
|
||||
return new ViewHolder(v);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
|
||||
if (holder instanceof ViewHolder) {
|
||||
ViewHolder thisHolder = (ViewHolder) holder;
|
||||
// - get element from your dataset at this position
|
||||
// - replace the contents of the view with that element
|
||||
final ViewModel model = mDataset.get(position);
|
||||
|
||||
thisHolder.mTextView.setText(model.email);
|
||||
thisHolder.mDeleteButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
remove(model);
|
||||
}
|
||||
});
|
||||
} else if (holder instanceof FooterHolder) {
|
||||
FooterHolder thisHolder = (FooterHolder) holder;
|
||||
thisHolder.mAddButton.setOnClickListener(mFooterOnClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDataset.size() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (isPositionFooter(position)) {
|
||||
return TYPE_FOOTER;
|
||||
} else {
|
||||
return TYPE_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPositionFooter(int position) {
|
||||
return position == mDataset.size();
|
||||
}
|
||||
|
||||
public void add(String email) {
|
||||
mDataset.add(new ViewModel(email));
|
||||
notifyItemInserted(mDataset.size() - 1);
|
||||
}
|
||||
|
||||
public void remove(ViewModel model) {
|
||||
int position = mDataset.indexOf(model);
|
||||
mDataset.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class CreateKeyFinalFragment extends Fragment {
|
||||
|
||||
public static final int REQUEST_EDIT_KEY = 0x00008007;
|
||||
@@ -63,10 +66,12 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
|
||||
public static final String ARG_NAME = "name";
|
||||
public static final String ARG_EMAIL = "email";
|
||||
public static final String ARG_ADDITIONAL_EMAILS = "emails";
|
||||
public static final String ARG_PASSPHRASE = "passphrase";
|
||||
|
||||
String mName;
|
||||
String mEmail;
|
||||
ArrayList<String> mAdditionalEmails;
|
||||
String mPassphrase;
|
||||
|
||||
SaveKeyringParcel mSaveKeyringParcel;
|
||||
@@ -74,12 +79,15 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
*/
|
||||
public static CreateKeyFinalFragment newInstance(String name, String email, String passphrase) {
|
||||
public static CreateKeyFinalFragment newInstance(String name, String email,
|
||||
ArrayList<String> additionalEmails,
|
||||
String passphrase) {
|
||||
CreateKeyFinalFragment frag = new CreateKeyFinalFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_NAME, name);
|
||||
args.putString(ARG_EMAIL, email);
|
||||
args.putStringArrayList(ARG_ADDITIONAL_EMAILS, additionalEmails);
|
||||
args.putString(ARG_PASSPHRASE, passphrase);
|
||||
|
||||
frag.setArguments(args);
|
||||
@@ -102,11 +110,25 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
// get args
|
||||
mName = getArguments().getString(ARG_NAME);
|
||||
mEmail = getArguments().getString(ARG_EMAIL);
|
||||
mAdditionalEmails = getArguments().getStringArrayList(ARG_ADDITIONAL_EMAILS);
|
||||
mPassphrase = getArguments().getString(ARG_PASSPHRASE);
|
||||
|
||||
// set values
|
||||
mNameEdit.setText(mName);
|
||||
mEmailEdit.setText(mEmail);
|
||||
if (mAdditionalEmails != null && mAdditionalEmails.size() > 0) {
|
||||
String emailText = mEmail + ", ";
|
||||
Iterator<?> it = mAdditionalEmails.iterator();
|
||||
while (it.hasNext()) {
|
||||
Object next = it.next();
|
||||
emailText += next;
|
||||
if (it.hasNext()) {
|
||||
emailText += ", ";
|
||||
}
|
||||
}
|
||||
mEmailEdit.setText(emailText);
|
||||
} else {
|
||||
mEmailEdit.setText(mEmail);
|
||||
}
|
||||
|
||||
mCreateButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -167,12 +189,19 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
String userId = KeyRing.createUserId(mName, mEmail, null);
|
||||
mSaveKeyringParcel.mAddUserIds.add(userId);
|
||||
mSaveKeyringParcel.mChangePrimaryUserId = userId;
|
||||
if (mAdditionalEmails != null && mAdditionalEmails.size() > 0) {
|
||||
for (String email : mAdditionalEmails) {
|
||||
String thisUserId = KeyRing.createUserId(mName, email, null);
|
||||
mSaveKeyringParcel.mAddUserIds.add(thisUserId);
|
||||
}
|
||||
}
|
||||
mSaveKeyringParcel.mNewUnlock = mPassphrase != null
|
||||
? new ChangeUnlockParcel(mPassphrase, null)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createKey() {
|
||||
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||
intent.setAction(KeychainIntentService.ACTION_EDIT_KEYRING);
|
||||
|
||||
@@ -35,14 +35,18 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.widget.PassphraseEditText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CreateKeyPassphraseFragment extends Fragment {
|
||||
|
||||
public static final String ARG_NAME = "name";
|
||||
public static final String ARG_EMAIL = "email";
|
||||
public static final String ARG_ADDITIONAL_EMAILS = "emails";
|
||||
|
||||
// model
|
||||
String mName;
|
||||
String mEmail;
|
||||
ArrayList<String> mAdditionalEmails;
|
||||
|
||||
// view
|
||||
CreateKeyActivity mCreateKeyActivity;
|
||||
@@ -55,12 +59,14 @@ public class CreateKeyPassphraseFragment extends Fragment {
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
*/
|
||||
public static CreateKeyPassphraseFragment newInstance(String name, String email) {
|
||||
public static CreateKeyPassphraseFragment newInstance(String name, String email,
|
||||
ArrayList<String> additionalEmails) {
|
||||
CreateKeyPassphraseFragment frag = new CreateKeyPassphraseFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_NAME, name);
|
||||
args.putString(ARG_EMAIL, email);
|
||||
args.putStringArrayList(ARG_ADDITIONAL_EMAILS, additionalEmails);
|
||||
|
||||
frag.setArguments(args);
|
||||
|
||||
@@ -114,6 +120,7 @@ public class CreateKeyPassphraseFragment extends Fragment {
|
||||
// initial values
|
||||
mName = getArguments().getString(ARG_NAME);
|
||||
mEmail = getArguments().getString(ARG_EMAIL);
|
||||
mAdditionalEmails = getArguments().getStringArrayList(ARG_ADDITIONAL_EMAILS);
|
||||
mPassphraseEdit.requestFocus();
|
||||
mBackButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -163,6 +170,7 @@ public class CreateKeyPassphraseFragment extends Fragment {
|
||||
CreateKeyFinalFragment.newInstance(
|
||||
mName,
|
||||
mEmail,
|
||||
mAdditionalEmails,
|
||||
mPassphraseEdit.getText().toString()
|
||||
);
|
||||
|
||||
|
||||
@@ -528,7 +528,6 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
}
|
||||
|
||||
private void addUserId() {
|
||||
// Message is received after passphrase is cached
|
||||
Handler returnHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.widget.CardView;
|
||||
@@ -38,6 +42,7 @@ import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.*;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -48,6 +53,11 @@ import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment;
|
||||
import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment.OnIdentityLoadedListener;
|
||||
import org.sufficientlysecure.keychain.util.FilterCursorWrapper;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment;
|
||||
import org.sufficientlysecure.keychain.util.ContactHelper;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
public class ViewKeyFragment extends LoaderFragment implements
|
||||
@@ -58,8 +68,14 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
private static final String ARG_IS_SECRET = "is_secret";
|
||||
|
||||
private ListView mUserIds;
|
||||
//private ListView mLinkedSystemContact;
|
||||
|
||||
boolean mIsSecret = false;
|
||||
private String mName;
|
||||
|
||||
LinearLayout mSystemContactLayout;
|
||||
ImageView mSystemContactPicture;
|
||||
TextView mSystemContactName;
|
||||
|
||||
private static final int LOADER_ID_USER_IDS = 0;
|
||||
private static final int LOADER_ID_LINKED_IDS = 1;
|
||||
@@ -130,6 +146,10 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
}
|
||||
});
|
||||
|
||||
mSystemContactLayout = (LinearLayout) view.findViewById(R.id.system_contact_layout);
|
||||
mSystemContactName = (TextView) view.findViewById(R.id.system_contact_name);
|
||||
mSystemContactPicture = (ImageView) view.findViewById(R.id.system_contact_picture);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -190,6 +210,49 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a system contact exists for given masterKeyId, and if it does, sets name, picture
|
||||
* and onClickListener for the linked system contact's layout
|
||||
*
|
||||
* @param name
|
||||
* @param masterKeyId
|
||||
*/
|
||||
private void loadLinkedSystemContact(String name, final long masterKeyId) {
|
||||
final Context context = mSystemContactName.getContext();
|
||||
final ContentResolver resolver = context.getContentResolver();
|
||||
|
||||
final long contactId = ContactHelper.findContactId(resolver, masterKeyId);
|
||||
|
||||
if (contactId != -1) {//contact exists for given master key
|
||||
mSystemContactName.setText(name);
|
||||
|
||||
Bitmap picture = ContactHelper.loadPhotoByMasterKeyId(resolver, masterKeyId, true);
|
||||
if (picture != null) mSystemContactPicture.setImageBitmap(picture);
|
||||
|
||||
mSystemContactLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
launchContactActivity(contactId, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* launches the default android Contacts app to view a contact with the passed
|
||||
* contactId (CONTACT_ID column from ContactsContract.RawContact table which is _ID column in
|
||||
* ContactsContract.Contact table)
|
||||
*
|
||||
* @param contactId _ID for row in ContactsContract.Contacts table
|
||||
* @param context
|
||||
*/
|
||||
private void launchContactActivity(final long contactId, Context context) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId));
|
||||
intent.setData(uri);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri, boolean isSecret, byte[] fingerprint) {
|
||||
mDataUri = dataUri;
|
||||
mIsSecret = isSecret;
|
||||
@@ -209,6 +272,7 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
setContentShown(false);
|
||||
|
||||
@@ -224,6 +288,7 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
// Swap the new cursor in. (The framework will take care of closing the
|
||||
// old cursor once we return.)
|
||||
@@ -246,6 +311,7 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||
* This is called when the last Cursor provided to onLoadFinished() above is about to be closed.
|
||||
* We need to make sure we are no longer using it.
|
||||
*/
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
switch (loader.getId()) {
|
||||
case LOADER_ID_USER_IDS: {
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.widget.EmailEditText;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
public class AddEmailDialogFragment extends DialogFragment implements OnEditorActionListener {
|
||||
private static final String ARG_MESSENGER = "messenger";
|
||||
|
||||
public static final int MESSAGE_OKAY = 1;
|
||||
public static final int MESSAGE_CANCEL = 2;
|
||||
|
||||
public static final String MESSAGE_DATA_EMAIL = "email";
|
||||
|
||||
private Messenger mMessenger;
|
||||
private EmailEditText mEmail;
|
||||
|
||||
public static AddEmailDialogFragment newInstance(Messenger messenger) {
|
||||
|
||||
AddEmailDialogFragment frag = new AddEmailDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_MESSENGER, messenger);
|
||||
frag.setArguments(args);
|
||||
|
||||
return frag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates dialog
|
||||
*/
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Activity activity = getActivity();
|
||||
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
|
||||
|
||||
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity);
|
||||
|
||||
alert.setTitle(R.string.create_key_add_email);
|
||||
|
||||
LayoutInflater inflater = activity.getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.add_email_dialog, null);
|
||||
alert.setView(view);
|
||||
|
||||
mEmail = (EmailEditText) view.findViewById(R.id.add_email_address);
|
||||
|
||||
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 email = mEmail.getText().toString();
|
||||
data.putString(MESSAGE_DATA_EMAIL, email);
|
||||
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();
|
||||
|
||||
mEmail.setImeActionLabel(getString(android.R.string.ok), EditorInfo.IME_ACTION_DONE);
|
||||
mEmail.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);
|
||||
|
||||
// hide keyboard on dismiss
|
||||
hideKeyboard();
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -267,6 +267,35 @@ public class ContactHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the CONTACT_ID of the raw contact to which a masterKeyId is associated, if the
|
||||
* raw contact has not been marked for deletion
|
||||
*
|
||||
* @param resolver
|
||||
* @param masterKeyId
|
||||
* @return CONTACT_ID (id of aggregated contact) linked to masterKeyId
|
||||
*/
|
||||
public static long findContactId(ContentResolver resolver, long masterKeyId) {
|
||||
long contactId = -1;
|
||||
Cursor raw = resolver.query(ContactsContract.RawContacts.CONTENT_URI,
|
||||
new String[]{
|
||||
ContactsContract.RawContacts.CONTACT_ID
|
||||
},
|
||||
ContactsContract.RawContacts.ACCOUNT_TYPE + "=? AND " +
|
||||
ContactsContract.RawContacts.SOURCE_ID + "=? AND " +
|
||||
ContactsContract.RawContacts.DELETED + "=?",
|
||||
new String[]{//"0" for "not deleted"
|
||||
Constants.ACCOUNT_TYPE, Long.toString(masterKeyId), "0"
|
||||
}, null);
|
||||
if (raw != null) {
|
||||
if (raw.moveToNext()) {
|
||||
contactId = raw.getLong(0);
|
||||
}
|
||||
raw.close();
|
||||
}
|
||||
return contactId;
|
||||
}
|
||||
|
||||
public static Bitmap getCachedPhotoByMasterKeyId(ContentResolver contentResolver, long masterKeyId) {
|
||||
if (masterKeyId == -1) {
|
||||
return null;
|
||||
@@ -357,7 +386,7 @@ public class ContactHelper {
|
||||
|
||||
// Do not store expired or revoked keys in contact db - and remove them if they already exist
|
||||
if (isExpired || isRevoked) {
|
||||
Log.d(Constants.TAG, "Expired or revoked: Deleting " + rawContactId);
|
||||
Log.d(Constants.TAG, "Expired or revoked: Deleting rawContactId " + rawContactId);
|
||||
if (rawContactId != -1) {
|
||||
deleteRawContactById(resolver, rawContactId);
|
||||
}
|
||||
@@ -394,12 +423,15 @@ public class ContactHelper {
|
||||
|
||||
/**
|
||||
* Delete all raw contacts associated to OpenKeychain.
|
||||
* <p/>
|
||||
* TODO: Does this work?
|
||||
*/
|
||||
private static int debugDeleteRawContacts(ContentResolver resolver) {
|
||||
//allows us to actually wipe the RawContact from the device, otherwise would be just flagged
|
||||
//for deletion
|
||||
Uri deleteUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().
|
||||
appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
|
||||
|
||||
Log.d(Constants.TAG, "Deleting all raw contacts associated to OK...");
|
||||
return resolver.delete(ContactsContract.RawContacts.CONTENT_URI,
|
||||
return resolver.delete(deleteUri,
|
||||
ContactsContract.RawContacts.ACCOUNT_TYPE + "=?",
|
||||
new String[]{
|
||||
Constants.ACCOUNT_TYPE
|
||||
@@ -407,7 +439,12 @@ public class ContactHelper {
|
||||
}
|
||||
|
||||
private static int deleteRawContactById(ContentResolver resolver, long rawContactId) {
|
||||
return resolver.delete(ContactsContract.RawContacts.CONTENT_URI,
|
||||
//allows us to actually wipe the RawContact from the device, otherwise would be just flagged
|
||||
//for deletion
|
||||
Uri deleteUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().
|
||||
appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
|
||||
|
||||
return resolver.delete(deleteUri,
|
||||
ContactsContract.RawContacts.ACCOUNT_TYPE + "=? AND " + ContactsContract.RawContacts._ID + "=?",
|
||||
new String[]{
|
||||
Constants.ACCOUNT_TYPE, Long.toString(rawContactId)
|
||||
@@ -415,7 +452,12 @@ public class ContactHelper {
|
||||
}
|
||||
|
||||
private static int deleteRawContactByMasterKeyId(ContentResolver resolver, long masterKeyId) {
|
||||
return resolver.delete(ContactsContract.RawContacts.CONTENT_URI,
|
||||
//allows us to actually wipe the RawContact from the device, otherwise would be just flagged
|
||||
//for deletion
|
||||
Uri deleteUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().
|
||||
appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
|
||||
|
||||
return resolver.delete(deleteUri,
|
||||
ContactsContract.RawContacts.ACCOUNT_TYPE + "=? AND " + ContactsContract.RawContacts.SOURCE_ID + "=?",
|
||||
new String[]{
|
||||
Constants.ACCOUNT_TYPE, Long.toString(masterKeyId)
|
||||
|
||||
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_email_grey_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_email_grey_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 372 B |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_email_grey_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_email_grey_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 307 B |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_email_grey_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_email_grey_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 439 B |
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_email_grey_24dp.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_email_grey_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 563 B |
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
26
OpenKeychain/src/main/res/layout/add_email_dialog.xml
Normal file
26
OpenKeychain/src/main/res/layout/add_email_dialog.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/create_key_add_email_text"
|
||||
android:textAppearance="?android:textAppearanceMedium" />
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.widget.EmailEditText
|
||||
android:id="@+id/add_email_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="@string/label_email"
|
||||
android:imeOptions="actionNext"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/api_account_settings_create_key"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
@@ -34,6 +35,12 @@
|
||||
android:hint="@string/label_email"
|
||||
android:ems="10" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/create_key_emails"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:singleLine="true">
|
||||
|
||||
<Button
|
||||
android:id="@+id/create_key_add_email"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/btn_add_email"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:drawableLeft="@drawable/ic_email_grey_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="left|center_vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:singleLine="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_key_email_item_email"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="alice@example.com"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:paddingLeft="8dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/create_key_email_item_delete_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_close_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -113,7 +113,7 @@
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
android:id="@+id/decrypt_file_browse"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem">
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -81,7 +81,7 @@
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:text="@string/btn_decrypt_verify_file"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableRight="@drawable/ic_save_grey_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
android:clickable="true"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
@@ -121,7 +121,7 @@
|
||||
android:drawableRight="@drawable/ic_vpn_key_grey_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -79,7 +79,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_content_copy_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -56,5 +56,5 @@
|
||||
android:src="@drawable/ic_close_grey_24dp"
|
||||
android:clickable="true"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/SelectableItem"/>
|
||||
android:background="?android:selectableItemBackground"/>
|
||||
</RelativeLayout>
|
||||
@@ -43,7 +43,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
@@ -67,7 +67,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_search_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dip"
|
||||
@@ -48,7 +48,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_settings_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -40,7 +40,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_content_paste_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -40,7 +40,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_nfc_white_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_repeat_grey_24dp"
|
||||
android:padding="12dp"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
android:layout_weight="1"
|
||||
android:text="@string/btn_back"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
@@ -137,7 +137,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -155,7 +155,7 @@
|
||||
android:text="@string/btn_back"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -106,7 +106,7 @@
|
||||
android:layout_weight="1"
|
||||
android:text="@string/btn_back"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
@@ -132,7 +132,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -159,7 +159,7 @@
|
||||
android:text="@string/btn_back"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -99,7 +99,7 @@
|
||||
android:text="@string/btn_back"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -114,7 +114,7 @@
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<View
|
||||
@@ -138,7 +138,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -164,7 +164,7 @@
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<View
|
||||
@@ -188,7 +188,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -49,7 +49,7 @@
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- separate ImageView required for recoloring -->
|
||||
@@ -84,7 +84,7 @@
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- separate ImageView required for recoloring -->
|
||||
@@ -119,7 +119,7 @@
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- separate ImageView required for recoloring -->
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:clickable="true"
|
||||
android:onClick="noPassphrase"
|
||||
style="@style/SelectableItem"/>
|
||||
android:background="?android:selectableItemBackground"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -51,7 +51,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:clickable="true"
|
||||
android:onClick="passphrase"
|
||||
style="@style/SelectableItem"/>
|
||||
android:background="?android:selectableItemBackground"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
@@ -67,7 +67,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:clickable="true"
|
||||
android:onClick="startLockpattern"
|
||||
style="@style/SelectableItem"/>
|
||||
android:background="?android:selectableItemBackground"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
@@ -83,7 +83,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:clickable="true"
|
||||
android:onClick="NFC"
|
||||
style="@style/SelectableItem"/>
|
||||
android:background="?android:selectableItemBackground"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:paddingRight="4dp"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:text="@string/btn_view_cert_key"
|
||||
android:layout_weight="1"
|
||||
android:drawableRight="@drawable/ic_person_grey_24dp"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -59,7 +59,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_content_copy_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -133,7 +133,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_content_copy_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dip"
|
||||
@@ -150,7 +150,7 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_repeat_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:text="@string/key_view_action_upload"
|
||||
android:layout_weight="1"
|
||||
android:drawableRight="@drawable/ic_file_upload_grey_24dp"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_close_grey_24dp"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -75,6 +75,6 @@
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_close_grey_24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -31,14 +31,15 @@
|
||||
style="@style/CardViewHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/section_user_ids" />
|
||||
android:text="@string/section_user_ids"/>
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
||||
android:id="@+id/view_key_user_ids"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp" />
|
||||
android:layout_marginBottom="4dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
@@ -86,9 +87,58 @@
|
||||
android:text="%d more unknown identity types"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
style="@style/SelectableItem" />
|
||||
android:background="?android:selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/linked_system_contact_card"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
card_view:cardBackgroundColor="@android:color/white"
|
||||
card_view:cardElevation="2dp"
|
||||
card_view:cardUseCompatPadding="true"
|
||||
card_view:cardCornerRadius="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/CardViewHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/section_linked_system_contact"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id='@+id/system_contact_layout'
|
||||
android:clickable="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/system_contact_picture"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_person_grey_48dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/system_contact_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/view_key_fragment_no_system_contact"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
<!-- section -->
|
||||
<string name="section_user_ids">"Identities"</string>
|
||||
<string name="section_linked_system_contact">"Linked System Contact"</string>
|
||||
<string name="section_should_you_trust">"Should you trust this key?"</string>
|
||||
<string name="section_proof_details">Proof verification</string>
|
||||
<string name="section_cloud_evidence">"Proofs from the cloud"</string>
|
||||
@@ -99,6 +100,7 @@
|
||||
<string name="btn_decrypt_files">"Decrypt files"</string>
|
||||
<string name="btn_encrypt_files">"Encrypt files"</string>
|
||||
<string name="btn_encrypt_text">"Encrypt text"</string>
|
||||
<string name="btn_add_email">"Add additional email address"</string>
|
||||
|
||||
<!-- menu -->
|
||||
<string name="menu_preferences">"Settings"</string>
|
||||
@@ -629,10 +631,12 @@
|
||||
<string name="create_key_rsa">"(3 subkeys, RSA, 4096 bit)"</string>
|
||||
<string name="create_key_custom">"(custom key configuration)"</string>
|
||||
<string name="create_key_name_text">"Choose a name associated with this key. This can be a full name, e.g., 'John Doe', or a nickname, e.g., 'Johnny'."</string>
|
||||
<string name="create_key_email_text">"Choose the email address used for encrypted communication."</string>
|
||||
<string name="create_key_email_text">"Enter your main email address used for secure communication."</string>
|
||||
<string name="create_key_passphrase_text">"Choose a strong passphrase. It protects your key when your device gets stolen."</string>
|
||||
<string name="create_key_hint_full_name">"Full Name or Nickname"</string>
|
||||
<string name="create_key_edit">"Change key configuration"</string>
|
||||
<string name="create_key_add_email">"Add email address"</string>
|
||||
<string name="create_key_add_email_text">"Additional email addresses are also associated to this key and can be used for secure communication."</string>
|
||||
|
||||
<!-- View key -->
|
||||
<string name="view_key_revoked">"Revoked: Key must not be used anymore!"</string>
|
||||
@@ -642,6 +646,8 @@
|
||||
<string name="view_key_verified">"Confirmed Key"</string>
|
||||
<string name="view_key_unverified">"Unconfirmed: Scan QR Code to confirm key!"</string>
|
||||
|
||||
<string name="view_key_fragment_no_system_contact">"<none>"</string>
|
||||
|
||||
<!-- Navigation Drawer -->
|
||||
<string name="nav_keys">"Keys"</string>
|
||||
<string name="nav_encrypt_decrypt">"Encrypt/Decrypt"</string>
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<style name="SelectableItem">
|
||||
<item name="android:background">@drawable/selector_transparent_button</item>
|
||||
</style>
|
||||
|
||||
<style name="FabMenuStyle">
|
||||
<item name="android:background">@drawable/fab_label_background</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
|
||||
Reference in New Issue
Block a user