From 8fa32cc4f7ce6c633ce7e423967848acc5997c79 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 24 Dec 2018 01:51:38 +0100 Subject: [PATCH] refine preference ux --- res/xml/preferences_app_protection.xml | 68 +++++++++---------- .../AppProtectionPreferenceFragment.java | 12 ++-- .../AppearancePreferenceFragment.java | 8 +-- 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/res/xml/preferences_app_protection.xml b/res/xml/preferences_app_protection.xml index c2a4336d4..265ffd4a5 100644 --- a/res/xml/preferences_app_protection.xml +++ b/res/xml/preferences_app_protection.xml @@ -1,6 +1,40 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java index b15573ee5..4ce31c271 100644 --- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java @@ -138,12 +138,16 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment } public static CharSequence getSummary(Context context) { - final int privacySummaryResId = R.string.pref_summary_privacy; - final String onRes = context.getString(R.string.pref_summary_on); - final String offRes = context.getString(R.string.pref_summary_off); + final String onRes = context.getString(R.string.on); + final String offRes = context.getString(R.string.off); String screenLockState = Prefs.isScreenLockEnabled(context) ? onRes : offRes; String readReceiptState = DcHelper.getContext(context).getConfigInt("mdns_enabled", DcContext.DC_PREF_DEFAULT_MDNS_ENABLED)!=0? onRes : offRes; - return context.getString(privacySummaryResId, screenLockState, readReceiptState); + + // adding combined strings as "Read receipt: %1$s, Screen lock: %1$s, " + // makes things inflexible on changes and/or adds lot of additional works to programmers. + // however, if needed, we can refine this later. + return context.getString(R.string.pref_read_receipts) + " " + readReceiptState + ", " + + context.getString(R.string.screenlock_title) + " " + screenLockState; } private class ChangePassphraseClickListener implements Preference.OnPreferenceClickListener { diff --git a/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java index e277112cd..7f59d217b 100644 --- a/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java @@ -44,10 +44,10 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment String imagePath = Prefs.getBackgroundImagePath(getContext()); String backgroundString; if(imagePath.isEmpty()){ - backgroundString = this.getString(R.string.pref_summary_default); + backgroundString = this.getString(R.string.def); } else{ - backgroundString = this.getString(R.string.pref_summary_custom); + backgroundString = this.getString(R.string.custom); } this.findPreference(Prefs.BACKGROUND_PREF).setSummary(backgroundString); } @@ -73,10 +73,10 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment String imagePath = Prefs.getBackgroundImagePath(context); String backgroundString; if(imagePath.isEmpty()){ - backgroundString = context.getString(R.string.pref_summary_default); + backgroundString = context.getString(R.string.def); } else{ - backgroundString = context.getString(R.string.pref_summary_custom); + backgroundString = context.getString(R.string.custom); } return context.getString(R.string.pref_summary_appearance,