Add extra to show autocrypt hint in OpenKeychain key select dialog

This commit is contained in:
Vincent Breitmoser 2018-04-18 16:36:43 +02:00
parent d61318aaf2
commit e91e8cfc1a
3 changed files with 8 additions and 0 deletions

View file

@ -790,6 +790,7 @@ public class AccountSettings extends K9PreferenceActivity {
pgpCryptoKey.setValue(account.getOpenPgpKey());
pgpCryptoKey.setOpenPgpProvider(openPgpApiManager, pgpProvider);
pgpCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(account.getIdentity(0)));
pgpCryptoKey.setShowAutocryptHint(true);
pgpCryptoKey.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
long value = (Long) newValue;

View file

@ -267,6 +267,7 @@ public class OpenPgpApi {
// GET_SIGN_KEY_ID
public static final String EXTRA_USER_ID = "user_id";
public static final String EXTRA_PRESELECT_KEY_ID = "preselect_key_id";
public static final String EXTRA_SHOW_AUTOCRYPT_HINT = "show_autocrypt_hint";
// GET_KEY
public static final String EXTRA_KEY_ID = "key_id";

View file

@ -41,6 +41,7 @@ import timber.log.Timber;
public class OpenPgpKeyPreference extends Preference implements OpenPgpApiManagerCallback {
private long keyId;
private String defaultUserId;
private boolean showAutocryptHint;
private OpenPgpApiManager openPgpApiManager;
private Intent cachedActivityResultData;
@ -69,6 +70,10 @@ public class OpenPgpKeyPreference extends Preference implements OpenPgpApiManage
defaultUserId = userId;
}
public void setShowAutocryptHint(boolean showAutocryptHint) {
this.showAutocryptHint = showAutocryptHint;
}
@Override
protected void onClick() {
switch (openPgpApiManager.getOpenPgpProviderState()) {
@ -122,6 +127,7 @@ public class OpenPgpKeyPreference extends Preference implements OpenPgpApiManage
data.setAction(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
data.putExtra(OpenPgpApi.EXTRA_USER_ID, defaultUserId);
data.putExtra(OpenPgpApi.EXTRA_PRESELECT_KEY_ID, keyId);
data.putExtra(OpenPgpApi.EXTRA_SHOW_AUTOCRYPT_HINT, showAutocryptHint);
OpenPgpApi api = openPgpApiManager.getOpenPgpApi();
api.executeApiAsync(data, null, null, openPgpCallback);
}