aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java36
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java21
3 files changed, 42 insertions, 18 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
index 17d550ce5..60bcf187d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
@@ -109,7 +109,8 @@ public final class Constants {
public static final String SYNC_CONTACTS = "syncContacts";
public static final String SYNC_KEYSERVER = "syncKeyserver";
// other settings
- public static final String ENABLE_EXPERIMENTAL_FEATURES = "enableExperimentalFeatures";
+ public static final String EXPERIMENTAL_ENABLE_WORD_CONFIRM = "experimentalEnableWordConfirm";
+ public static final String EXPERIMENTAL_ENABLE_LINKED_IDENTITIES = "experimentalEnableLinkedIdentities";
public static final class Theme {
public static final String LIGHT = "light";
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java
index 63be1e20f..aec45824e 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java
@@ -553,19 +553,22 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
/**
- * This fragment shows other preferences
+ * This fragment shows experimental features
*/
- public static class OtherPrefsFragment extends PreferenceFragment {
+ public static class ExperimentalPrefsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
- addPreferencesFromResource(R.xml.other_preferences);
+ addPreferencesFromResource(R.xml.experimental_preferences);
- initializeEnableExperimentalFeatures(
- (SwitchPreference) findPreference(Constants.Pref.ENABLE_EXPERIMENTAL_FEATURES));
+ initializeExperimentalEnableWordConfirm(
+ (SwitchPreference) findPreference(Constants.Pref.EXPERIMENTAL_ENABLE_WORD_CONFIRM));
+
+ initializeExperimentalEnableLinkedIdentities(
+ (SwitchPreference) findPreference(Constants.Pref.EXPERIMENTAL_ENABLE_LINKED_IDENTITIES));
}
}
@@ -575,7 +578,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|| ProxyPrefsFragment.class.getName().equals(fragmentName)
|| GuiPrefsFragment.class.getName().equals(fragmentName)
|| SyncPrefsFragment.class.getName().equals(fragmentName)
- || OtherPrefsFragment.class.getName().equals(fragmentName)
+ || ExperimentalPrefsFragment.class.getName().equals(fragmentName)
|| super.isValidFragment(fragmentName);
}
@@ -676,12 +679,23 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
});
}
- private static void initializeEnableExperimentalFeatures(final SwitchPreference mEnableExperimentalFeatures) {
- mEnableExperimentalFeatures.setChecked(sPreferences.getEnableExperimentalFeatures());
- mEnableExperimentalFeatures.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ private static void initializeExperimentalEnableWordConfirm(final SwitchPreference mExperimentalEnableWordConfirm) {
+ mExperimentalEnableWordConfirm.setChecked(sPreferences.getExperimentalEnableWordConfirm());
+ mExperimentalEnableWordConfirm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ mExperimentalEnableWordConfirm.setChecked((Boolean) newValue);
+ sPreferences.setExperimentalEnableWordConfirm((Boolean) newValue);
+ return false;
+ }
+ });
+ }
+
+ private static void initializeExperimentalEnableLinkedIdentities(final SwitchPreference mExperimentalEnableLinkedIdentities) {
+ mExperimentalEnableLinkedIdentities.setChecked(sPreferences.getExperimentalEnableLinkedIdentities());
+ mExperimentalEnableLinkedIdentities.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
- mEnableExperimentalFeatures.setChecked((Boolean) newValue);
- sPreferences.setEnableExperimentalFeatures((Boolean) newValue);
+ mExperimentalEnableLinkedIdentities.setChecked((Boolean) newValue);
+ sPreferences.setExperimentalEnableLinkedIdentities((Boolean) newValue);
return false;
}
});
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java
index 75f83d1f6..3225c3765 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java
@@ -25,7 +25,6 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Constants.Pref;
-import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.KeyserverSyncAdapterService;
import java.net.Proxy;
@@ -360,16 +359,26 @@ public class Preferences {
}
}
- // other prefs
+ // experimental prefs
- public void setEnableExperimentalFeatures(boolean enableExperimentalFeatures) {
+ public void setExperimentalEnableWordConfirm(boolean enableWordConfirm) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
- editor.putBoolean(Pref.ENABLE_EXPERIMENTAL_FEATURES, enableExperimentalFeatures);
+ editor.putBoolean(Pref.EXPERIMENTAL_ENABLE_WORD_CONFIRM, enableWordConfirm);
editor.commit();
}
- public boolean getEnableExperimentalFeatures() {
- return mSharedPreferences.getBoolean(Pref.ENABLE_EXPERIMENTAL_FEATURES, false);
+ public boolean getExperimentalEnableWordConfirm() {
+ return mSharedPreferences.getBoolean(Pref.EXPERIMENTAL_ENABLE_WORD_CONFIRM, false);
+ }
+
+ public void setExperimentalEnableLinkedIdentities(boolean enableLinkedIdentities) {
+ SharedPreferences.Editor editor = mSharedPreferences.edit();
+ editor.putBoolean(Pref.EXPERIMENTAL_ENABLE_LINKED_IDENTITIES, enableLinkedIdentities);
+ editor.commit();
+ }
+
+ public boolean getExperimentalEnableLinkedIdentities() {
+ return mSharedPreferences.getBoolean(Pref.EXPERIMENTAL_ENABLE_LINKED_IDENTITIES, false);
}
public void upgradePreferences(Context context) {