From a2d2da90984a6cc4191d55d349372f1ac5d6259a Mon Sep 17 00:00:00 2001 From: Andrea Torlaschi Date: Tue, 17 May 2016 16:51:44 +0200 Subject: Settings: change CheckBoxPreference to SwitchPreference --- .../java/org/sufficientlysecure/keychain/ui/SettingsActivity.java | 5 ++--- OpenKeychain/src/main/res/xml/cloud_search_preferences.xml | 4 ---- OpenKeychain/src/main/res/xml/passphrase_preferences.xml | 8 +++----- 3 files changed, 5 insertions(+), 12 deletions(-) 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 4fd327c8f..e71846577 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java @@ -30,7 +30,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; @@ -213,7 +212,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { }); initializePassphraseCacheSubs( - (CheckBoxPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_SUBS)); + (SwitchPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_SUBS)); } } @@ -592,7 +591,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { || super.isValidFragment(fragmentName); } - private static void initializePassphraseCacheSubs(final CheckBoxPreference mPassphraseCacheSubs) { + private static void initializePassphraseCacheSubs(final SwitchPreference mPassphraseCacheSubs) { mPassphraseCacheSubs.setChecked(sPreferences.getPassphraseCacheSubs()); mPassphraseCacheSubs.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { diff --git a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml index 85d6a6bca..e1ab50d63 100644 --- a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml +++ b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml @@ -5,17 +5,13 @@ android:key="search_keyserver_pref" android:summary="@string/pref_keyserver_summary" android:title="@string/pref_keyserver" /> - - - \ No newline at end of file diff --git a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml index 40500e53c..fa801ed8b 100644 --- a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml +++ b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml @@ -1,15 +1,13 @@ + - - -- cgit v1.2.3 From 2ab55b6767abd516ef86a6289d50ffe4bff2703a Mon Sep 17 00:00:00 2001 From: Andrea Torlaschi Date: Tue, 17 May 2016 17:09:03 +0200 Subject: Settings: remove unuseful initialization --- .../sufficientlysecure/keychain/ui/SettingsActivity.java | 14 -------------- .../org/sufficientlysecure/keychain/util/Preferences.java | 6 ------ OpenKeychain/src/main/res/xml/passphrase_preferences.xml | 1 + 3 files changed, 1 insertion(+), 20 deletions(-) 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 e71846577..894ce7846 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java @@ -210,9 +210,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity { return false; } }); - - initializePassphraseCacheSubs( - (SwitchPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_SUBS)); } } @@ -590,15 +587,4 @@ public class SettingsActivity extends AppCompatPreferenceActivity { || ExperimentalPrefsFragment.class.getName().equals(fragmentName) || super.isValidFragment(fragmentName); } - - private static void initializePassphraseCacheSubs(final SwitchPreference mPassphraseCacheSubs) { - mPassphraseCacheSubs.setChecked(sPreferences.getPassphraseCacheSubs()); - mPassphraseCacheSubs.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - public boolean onPreferenceChange(Preference preference, Object newValue) { - mPassphraseCacheSubs.setChecked((Boolean) newValue); - sPreferences.setPassphraseCacheSubs((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 2abd53f62..7ca2875ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -107,12 +107,6 @@ public class Preferences { return mSharedPreferences.getBoolean(Pref.PASSPHRASE_CACHE_SUBS, false); } - public void setPassphraseCacheSubs(boolean value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Pref.PASSPHRASE_CACHE_SUBS, value); - editor.commit(); - } - public boolean getCachedConsolidate() { return mSharedPreferences.getBoolean(Pref.CACHED_CONSOLIDATE, false); } diff --git a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml index fa801ed8b..b9696492a 100644 --- a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml +++ b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml @@ -4,6 +4,7 @@ android:key="passphraseCacheTtls" android:title="@string/label_passphrase_cache_ttl" /> Date: Tue, 17 May 2016 17:20:01 +0200 Subject: Remove dividers Divider shouldn't be used after last item --- OpenKeychain/src/main/res/layout/backup_restore_fragment.xml | 5 ----- OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml index ce97b7fd4..a71a0783b 100644 --- a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml +++ b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml @@ -83,11 +83,6 @@ android:text="@string/btn_decrypt_files" android:textAppearance="?android:attr/textAppearanceMedium" /> - \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml index 7bd919abc..c5cf16e1b 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml @@ -56,11 +56,6 @@ android:drawablePadding="8dp" android:gravity="center_vertical" /> - - - -- cgit v1.2.3 From dc32ff270732053fec29f44b27b320276bb139de Mon Sep 17 00:00:00 2001 From: Andrea Torlaschi Date: Tue, 17 May 2016 17:41:04 +0200 Subject: Padding cleanup --- .../main/res/layout/backup_restore_fragment.xml | 9 +-- .../main/res/layout/encrypt_decrypt_fragment.xml | 67 +++++++++------------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml index a71a0783b..21bd4ba88 100644 --- a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml +++ b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml @@ -10,12 +10,11 @@ android:orientation="vertical" android:paddingLeft="16dp" android:paddingRight="16dp" - android:paddingTop="24dp"> + android:paddingTop="16dp"> @@ -36,8 +35,6 @@ android:drawableRight="@drawable/ic_save_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/backup_all" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -56,8 +53,6 @@ android:drawableRight="@drawable/ic_save_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/backup_public_keys" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -78,8 +73,6 @@ android:drawableRight="@drawable/ic_folder_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/btn_decrypt_files" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml index c5cf16e1b..55b3d6b51 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml @@ -1,6 +1,5 @@ - @@ -8,33 +7,29 @@ + android:paddingTop="16dp"> + android:drawableRight="@drawable/ic_folder_grey_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_encrypt_files" + android:textAppearance="?android:attr/textAppearanceMedium" /> + android:drawableRight="@drawable/ic_comment_text_grey600_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_encrypt_text" + android:textAppearance="?android:attr/textAppearanceMedium" /> + android:drawableRight="@drawable/ic_folder_grey_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_decrypt_files" + android:textAppearance="?android:attr/textAppearanceMedium" /> + android:layout_weight="1" + android:text="@string/btn_decrypt_clipboard" + android:textAppearance="?android:attr/textAppearanceMedium" /> + android:layout_gravity="center_vertical" + android:paddingLeft="8dp" + android:src="@drawable/ic_content_paste_grey_24dp" /> -- cgit v1.2.3