Added Preference for concealing the PgpApplication

This commit is contained in:
Daniel Albert 2014-07-12 15:12:35 +02:00
parent 066591dab1
commit 92c66743e0
5 changed files with 34 additions and 0 deletions

View File

@ -68,6 +68,7 @@ public final class Constants {
public static final String FORCE_V3_SIGNATURES = "forceV3Signatures";
public static final String KEY_SERVERS = "keyServers";
public static final String KEY_SERVERS_DEFAULT_VERSION = "keyServersDefaultVersion";
public static final String CONCEAL_PGP_APPLICATION = "concealPgpApplication";
}
public static final class Defaults {

View File

@ -187,4 +187,14 @@ public class Preferences {
.commit();
}
}
public void setConcealPgpApplication(boolean conceal) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putBoolean(Constants.Pref.CONCEAL_PGP_APPLICATION, conceal);
editor.commit();
}
public boolean getConcealPgpApplication() {
return mSharedPreferences.getBoolean(Constants.Pref.CONCEAL_PGP_APPLICATION, false);
}
}

View File

@ -121,6 +121,9 @@ public class PreferencesActivity extends PreferenceActivity {
initializeForceV3Signatures(
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
initializeConcealPgpApplication(
(CheckBoxPreference) findPreference(Constants.Pref.CONCEAL_PGP_APPLICATION));
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// Load the legacy preferences headers
addPreferencesFromResource(R.xml.preference_headers_legacy);
@ -264,6 +267,9 @@ public class PreferencesActivity extends PreferenceActivity {
initializeForceV3Signatures(
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
initializeConcealPgpApplication(
(CheckBoxPreference) findPreference(Constants.Pref.CONCEAL_PGP_APPLICATION));
}
}
@ -396,4 +402,15 @@ public class PreferencesActivity extends PreferenceActivity {
}
});
}
private static void initializeConcealPgpApplication(final CheckBoxPreference mConcealPgpApplication) {
mConcealPgpApplication.setChecked(sPreferences.getConcealPgpApplication());
mConcealPgpApplication.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
mConcealPgpApplication.setChecked((Boolean) newValue);
sPreferences.setConcealPgpApplication((Boolean) newValue);
return false;
}
});
}
}

View File

@ -110,6 +110,7 @@
<string name="label_passphrase_again">Again</string>
<string name="label_algorithm">Algorithm</string>
<string name="label_ascii_armor">ASCII Armor</string>
<string name="label_conceal_pgp_application">Conceal PGP Application (OpenKeychain)</string>
<string name="label_select_public_keys">Recipients</string>
<string name="label_delete_after_encryption">Delete After Encryption</string>
<string name="label_delete_after_decryption">Delete After Decryption</string>

View File

@ -38,6 +38,11 @@
android:key="defaultAsciiArmor"
android:persistent="false"
android:title="@string/label_ascii_armor" />
<CheckBoxPreference
android:key="concealPgpApplication"
android:persistent="false"
android:title="@string/label_conceal_pgp_application" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/section_advanced" >
<CheckBoxPreference