mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Merge branch 'development' into v/crypto-input-parcel
This commit is contained in:
commit
7ffb55faaa
@ -162,7 +162,7 @@ public class ImportKeyResult extends OperationResult {
|
|||||||
if (isOkWithErrors()) {
|
if (isOkWithErrors()) {
|
||||||
// definitely switch to warning-style message in this case!
|
// definitely switch to warning-style message in this case!
|
||||||
duration = 0;
|
duration = 0;
|
||||||
style = Style.ERROR;
|
style = Style.WARN;
|
||||||
str += " " + activity.getResources().getQuantityString(
|
str += " " + activity.getResources().getQuantityString(
|
||||||
R.plurals.import_keys_with_errors, mBadKeys, mBadKeys);
|
R.plurals.import_keys_with_errors, mBadKeys, mBadKeys);
|
||||||
}
|
}
|
||||||
@ -175,7 +175,10 @@ public class ImportKeyResult extends OperationResult {
|
|||||||
? R.string.import_error_nothing_cancelled
|
? R.string.import_error_nothing_cancelled
|
||||||
: R.string.import_error_nothing);
|
: R.string.import_error_nothing);
|
||||||
} else {
|
} else {
|
||||||
str = activity.getResources().getQuantityString(R.plurals.import_error, mBadKeys);
|
str = activity.getResources().getQuantityString(
|
||||||
|
R.plurals.import_error,
|
||||||
|
mBadKeys,
|
||||||
|
mBadKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.R;
|
|||||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.AddEmailDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.AddEmailDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.EmailEditText;
|
import org.sufficientlysecure.keychain.ui.widget.EmailEditText;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -122,16 +123,22 @@ public class CreateKeyEmailFragment extends Fragment {
|
|||||||
mEmailsRecyclerView.setItemAnimator(new DefaultItemAnimator());
|
mEmailsRecyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||||
|
|
||||||
// initial values
|
// initial values
|
||||||
|
if (mAdditionalEmailModels == null) {
|
||||||
mAdditionalEmailModels = new ArrayList<>();
|
mAdditionalEmailModels = new ArrayList<>();
|
||||||
if (mCreateKeyActivity.mAdditionalEmails != null) {
|
if (mCreateKeyActivity.mAdditionalEmails != null) {
|
||||||
setAdditionalEmails(mCreateKeyActivity.mAdditionalEmails);
|
setAdditionalEmails(mCreateKeyActivity.mAdditionalEmails);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mEmailAdapter == null) {
|
||||||
mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
|
mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
addEmail();
|
addEmail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mEmailsRecyclerView.setAdapter(mEmailAdapter);
|
mEmailsRecyclerView.setAdapter(mEmailAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
@ -144,10 +151,27 @@ public class CreateKeyEmailFragment extends Fragment {
|
|||||||
if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
|
if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
|
||||||
Bundle data = message.getData();
|
Bundle data = message.getData();
|
||||||
|
|
||||||
|
String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL);
|
||||||
|
|
||||||
|
if (email.length() > 0 && mEmailEdit.getText().length() > 0 &&
|
||||||
|
email.equals(mEmailEdit.getText().toString())) {
|
||||||
|
Notify.create(getActivity(),
|
||||||
|
getString(R.string.create_key_email_already_exists_text),
|
||||||
|
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//check for duplicated emails inside the adapter
|
||||||
|
for (EmailAdapter.ViewModel model : mAdditionalEmailModels) {
|
||||||
|
if (email.equals(model.email)) {
|
||||||
|
Notify.create(getActivity(),
|
||||||
|
getString(R.string.create_key_email_already_exists_text),
|
||||||
|
Notify.LENGTH_LONG, Notify.Style.ERROR).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add new user id
|
// add new user id
|
||||||
mEmailAdapter.add(
|
mEmailAdapter.add(email);
|
||||||
data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -630,6 +630,7 @@
|
|||||||
<string name="create_key_edit">"Change key configuration"</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">"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>
|
<string name="create_key_add_email_text">"Additional email addresses are also associated to this key and can be used for secure communication."</string>
|
||||||
|
<string name="create_key_email_already_exists_text">"Email has already been added"</string>
|
||||||
|
|
||||||
<!-- View key -->
|
<!-- View key -->
|
||||||
<string name="view_key_revoked">"Revoked: Key must not be used anymore!"</string>
|
<string name="view_key_revoked">"Revoked: Key must not be used anymore!"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user