From c448a833f586145ba2d1306bc7eab2e2830604d0 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Thu, 11 Dec 2014 22:46:59 -0800 Subject: [PATCH] another minor pref tweak for mms fallback 1) fix summary for outgoing sms/mms 2) disable mms option when TS-users is unselected, same as the fallback approval option. // FREEBIE --- res/values/strings.xml | 3 ++- .../components/OutgoingSmsPreference.java | 7 ++++++- .../preferences/SmsMmsPreferenceFragment.java | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b685044242..e028fc3f10 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -698,7 +698,8 @@ Outgoing SMS/MMS Submit debug log TextSecure users - (ask first) + ask first + no MMS Send secure SMS if data connectivity is lost Ask before sending SMS/MMS Never send MMS diff --git a/src/org/thoughtcrime/securesms/components/OutgoingSmsPreference.java b/src/org/thoughtcrime/securesms/components/OutgoingSmsPreference.java index f21cfca785..0364359478 100644 --- a/src/org/thoughtcrime/securesms/components/OutgoingSmsPreference.java +++ b/src/org/thoughtcrime/securesms/components/OutgoingSmsPreference.java @@ -38,11 +38,16 @@ public class OutgoingSmsPreference extends DialogPreference { dataUsers.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - askForFallback.setEnabled(dataUsers.isChecked()); + updateEnabledViews(); } }); + updateEnabledViews(); + } + + private void updateEnabledViews() { askForFallback.setEnabled(dataUsers.isChecked()); + neverFallbackMms.setEnabled(dataUsers.isChecked()); } @Override diff --git a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java index 36dc032916..4caed2a0bf 100644 --- a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java @@ -12,6 +12,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.preference.PreferenceFragment; +import android.text.TextUtils; import org.thoughtcrime.securesms.ApplicationPreferencesActivity; import org.thoughtcrime.securesms.MmsPreferencesFragment; @@ -20,6 +21,9 @@ import org.thoughtcrime.securesms.components.OutgoingSmsPreference; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.Util; +import java.util.LinkedList; +import java.util.List; + public class SmsMmsPreferenceFragment extends PreferenceFragment { private static final String KITKAT_DEFAULT_PREF = "pref_set_default"; private static final String OUTGOING_SMS_PREF = "pref_outgoing_sms"; @@ -92,11 +96,21 @@ public class SmsMmsPreferenceFragment extends PreferenceFragment { final StringBuilder builder = new StringBuilder(); final boolean dataFallback = TextSecurePreferences.isFallbackSmsAllowed(getActivity()); final boolean dataFallbackAsk = TextSecurePreferences.isFallbackSmsAskRequired(getActivity()); + final boolean mmsFallback = TextSecurePreferences.isFallbackMmsEnabled(getActivity()); final boolean nonData = TextSecurePreferences.isDirectSmsAllowed(getActivity()); if (dataFallback) { builder.append(getString(R.string.preferences__sms_outgoing_push_users)); - if (dataFallbackAsk) builder.append(" ").append(getString(R.string.preferences__sms_fallback_push_users_ask)); + + List fallbackOptions = new LinkedList<>(); + if (dataFallbackAsk) fallbackOptions.add(getString(R.string.preferences__sms_fallback_push_users_ask)); + if (!mmsFallback) fallbackOptions.add(getString(R.string.preferences__sms_fallback_push_users_no_mms)); + + if (fallbackOptions.size() > 0) { + builder.append(" (") + .append(TextUtils.join(", ", fallbackOptions)) + .append(")"); + } } if (nonData) { if (dataFallback) builder.append(", ");