Skip to content
Browse files

Add an option to disable the transformation from SMS to MMS when the …

…lenght of the message is > 3 sms.

It is also possible to still have this transformation but to change the number of text needed before the sms is transformed to mms

EN, FR, DE and SV translation included (thanks to Markus Hoeber for DE and Björn Lundén for SV)

Patch Set 1 : code
Patch Set 2 : Tabulation removed
Patch Set 3 : German translation added
Patch Set 4 : English strings corrected
Patch Set 5 : Swedish translation added, trailing spaces removed

Change-Id: I9d2f2eea29587c07b790c0f8055cb703bdfd2463
  • Loading branch information...
1 parent 902f170 commit 55c5edc494886605058b22e968ce31a9365ebe62 travp624 committed May 19, 2012
View
4 res/values-de/strings.xml
@@ -381,4 +381,8 @@
<string name="template_select">Vorlage auswählen</string>
<string name="template_cancel_confirm_title">Warnung</string>
<string name="template_cancel_confirm_text">Diese Aktion abbrechen?</string>
+ <string name="pref_title_sms_EnableMultipartSMS">"SMS zu MMS"</string>
+ <string name="pref_summary_sms_EnableMultipartSMS">"wandelt lange SMS-Nachricht in MMS um"</string>
+ <string name="pref_title_sms_SmsToMmsTextThreshold">"SMS Anzahl"</string>
+ <string name="pref_summary_sms_SmsToMmsTextThreshold">"<xliff:g id="COUNT">%1$s</xliff:g>SMS bevor in MMS umgewandelt wird"</string>
</resources>
View
5 res/values-en-rGB/strings.xml
@@ -328,4 +328,9 @@
<item quantity="other" msgid="7338580381574463136">"<xliff:g id="NUMBER">%1$s</xliff:g> people"</item>
</plurals>
<string name="disable_notifications_dialog_message" msgid="7644011234972074096">"Stop duplicate text message notifications from default Messaging app?"</string>
+
+ <string name="pref_title_sms_EnableMultipartSMS">"SMS to MMS"</string>
+ <string name="pref_summary_sms_EnableMultipartSMS">"Transform long text messages into MMS"</string>
+ <string name="pref_title_sms_SmsToMmsTextThreshold">"SMS count"</string>
+ <string name="pref_summary_sms_SmsToMmsTextThreshold">"<xliff:g id="COUNT">%1$s</xliff:g> messages before MMS conversion"</string>
</resources>
View
5 res/values-fr/strings.xml
@@ -328,4 +328,9 @@
<item quantity="other" msgid="7338580381574463136">"<xliff:g id="NUMBER">%1$s</xliff:g> personnes"</item>
</plurals>
<string name="disable_notifications_dialog_message" msgid="7644011234972074096">"Cesser de dupliquer les notifications SMS à partir de l\'application SMS/MMS par défaut ?"</string>
+
+ <string name="pref_title_sms_EnableMultipartSMS">"SMS en MMS"</string>
+ <string name="pref_summary_sms_EnableMultipartSMS">"Transformer les longs messages en MMS"</string>
+ <string name="pref_title_sms_SmsToMmsTextThreshold">"Nombre de SMS"</string>
+ <string name="pref_summary_sms_SmsToMmsTextThreshold">"<xliff:g id="COUNT">%1$s</xliff:g> messages avant conversion en MMS"</string>
</resources>
View
5 res/values-sv/strings.xml
@@ -328,4 +328,9 @@
<item quantity="other" msgid="7338580381574463136">"<xliff:g id="NUMBER">%1$s</xliff:g> personer"</item>
</plurals>
<string name="disable_notifications_dialog_message" msgid="7644011234972074096">"Vill du sluta kopiera meddelanden om SMS från standardappen Meddelanden?"</string>
+
+ <string name="pref_title_sms_EnableMultipartSMS">"SMS till MMS"</string>
+ <string name="pref_summary_sms_EnableMultipartSMS">"Konvertera långa SMS till MMS"</string>
+ <string name="pref_title_sms_SmsToMmsTextThreshold">"Antal SMS"</string>
+ <string name="pref_summary_sms_SmsToMmsTextThreshold">"<xliff:g id="COUNT">%1$s</xliff:g> SMS kvar innan MMS-konvertering"</string>
</resources>
View
4 res/values/strings.xml
@@ -822,4 +822,8 @@
<string name="pref_title_mms_notification_vibrate_custom">Custom vibrate pattern</string>
<string name="pref_text_mms_notification_vibrate_custom">Format off/on in milliseconds: off, on, off, on, ...</string>
+ <string name="pref_title_sms_EnableMultipartSMS">"SMS to MMS"</string>
+ <string name="pref_summary_sms_EnableMultipartSMS">"Transform long text messages into MMS"</string>
+ <string name="pref_title_sms_SmsToMmsTextThreshold">"SMS count"</string>
+ <string name="pref_summary_sms_SmsToMmsTextThreshold">"<xliff:g id="COUNT">%1$s</xliff:g> messages before MMS conversion"</string>
</resources>
View
10 res/xml/preferences.xml
@@ -46,6 +46,16 @@
android:dependency="pref_key_strip_unicode"
android:defaultValue="false" />
+ <CheckBoxPreference android:key="pref_key_sms_EnableMultipartSMS"
+ android:title="@string/pref_title_sms_EnableMultipartSMS"
+ android:summary="@string/pref_summary_sms_EnableMultipartSMS"
+ android:defaultValue="true" />
+
+ <Preference android:key="pref_key_sms_SmsToMmsTextThreshold"
+ android:dependency="pref_key_sms_EnableMultipartSMS"
+ android:summary="@string/pref_summary_sms_SmsToMmsTextThreshold"
+ android:title="@string/pref_title_sms_SmsToMmsTextThreshold" />
+
</PreferenceCategory>
<PreferenceCategory
View
20 src/com/android/mms/MmsConfig.java
@@ -24,7 +24,9 @@
import com.android.internal.telephony.TelephonyProperties;
import android.content.Context;
+import android.content.SharedPreferences;
import android.content.res.XmlResourceParser;
+import android.preference.PreferenceManager;
import android.util.Log;
public class MmsConfig {
@@ -65,6 +67,8 @@
// See the comment below for mEnableMultipartSMS.
private static int mSmsToMmsTextThreshold = 4;
+ private static int mSmsToMmsTextThresholdMin = 1; // default value
+ private static int mSmsToMmsTextThresholdMax = 100; // default value
// This flag is somewhat confusing. If mEnableMultipartSMS is true, long sms messages are
// always sent as multi-part sms messages, with no checked limit on the number of segments.
@@ -115,6 +119,15 @@ public static void init(Context context) {
public static int getSmsToMmsTextThreshold() {
return mSmsToMmsTextThreshold;
}
+ public static void setSmsToMmsTextThreshold(int threshold) {
+ mSmsToMmsTextThreshold = threshold;
+ }
+ public static int getSmsToMmsTextThresholdMin() {
+ return mSmsToMmsTextThresholdMin;
+ }
+ public static int getSmsToMmsTextThresholdMax() {
+ return mSmsToMmsTextThresholdMax;
+ }
public static boolean getMmsEnabled() {
return mMmsEnabled;
@@ -203,6 +216,9 @@ public static int getMinimumSlideElementDuration() {
public static boolean getMultipartSmsEnabled() {
return mEnableMultipartSMS;
}
+ public static void setEnableMultipartSMS(boolean enable) {
+ mEnableMultipartSMS = enable;
+ }
public static boolean getSplitSmsEnabled() {
return mEnableSplitSMS;
@@ -384,6 +400,10 @@ private static void loadMmsSettings(Context context) {
}
}
}
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ //as the checkbox is checked when the boolean is supposed to be false, double negation :
+ mEnableMultipartSMS = !prefs.getBoolean("pref_key_sms_EnableMultipartSMS", !getMultipartSmsEnabled());
+ mSmsToMmsTextThreshold = prefs.getInt("pref_key_sms_SmsToMmsTextThreshold", getSmsToMmsTextThreshold());
} catch (XmlPullParserException e) {
Log.e(TAG, "loadMmsSettings caught ", e);
} catch (NumberFormatException e) {
View
39 src/com/android/mms/ui/MessagingPreferenceActivity.java
@@ -92,6 +92,8 @@
private Preference mMmsReadReportPref;
private Preference mManageSimPref;
private Preference mClearHistoryPref;
+ private CheckBoxPreference mEnableMultipartSMS;
+ private Preference mSmsToMmsTextThreshold;
private ListPreference mVibrateWhenPref;
private CheckBoxPreference mEnableNotificationsPref;
private Recycler mSmsRecycler;
@@ -120,6 +122,9 @@ protected void onCreate(Bundle icicle) {
mManageTemplate = findPreference(MANAGE_TEMPLATES);
mGestureSensitivity = (ListPreference) findPreference(GESTURE_SENSITIVITY);
+ mEnableMultipartSMS = (CheckBoxPreference)findPreference("pref_key_sms_EnableMultipartSMS");
+ mSmsToMmsTextThreshold = findPreference("pref_key_sms_SmsToMmsTextThreshold");
+
mVibrateEntries = getResources().getTextArray(R.array.prefEntries_vibrateWhen);
mVibrateValues = getResources().getTextArray(R.array.prefValues_vibrateWhen);
@@ -181,6 +186,9 @@ private void setMessagePreferences() {
}
}
+ mEnableMultipartSMS.setChecked(!MmsConfig.getMultipartSmsEnabled());
+ mSmsToMmsTextThreshold.setDefaultValue(MmsConfig.getSmsToMmsTextThreshold()-1);
+
setEnabledNotificationsPref();
// If needed, migrate vibration setting from a previous version
@@ -226,6 +234,9 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
setSmsDisplayLimit();
setMmsDisplayLimit();
+ // Fix up the sms to mms treshold
+ setSmsToMmsTextThreshold();
+
adjustVibrateSummary(mVibrateWhenPref.getValue());
}
@@ -247,6 +258,12 @@ private void setMmsDisplayLimit() {
mMmsRecycler.getMessageLimit(this)));
}
+ private void setSmsToMmsTextThreshold() {
+ mSmsToMmsTextThreshold.setSummary(
+ getString(R.string.pref_summary_sms_SmsToMmsTextThreshold,
+ MmsConfig.getSmsToMmsTextThreshold()-1));
+ }
+
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.clear();
@@ -287,6 +304,13 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
mMmsRecycler.getMessageMinLimit(),
mMmsRecycler.getMessageMaxLimit(),
R.string.pref_title_mms_delete).show();
+ } else if (preference == mSmsToMmsTextThreshold) {
+ new NumberPickerDialog(this,
+ mSmsToMmsTextThresholdListener,
+ MmsConfig.getSmsToMmsTextThreshold()-1,
+ MmsConfig.getSmsToMmsTextThresholdMin()-1,
+ MmsConfig.getSmsToMmsTextThresholdMax()-1,
+ R.string.pref_title_sms_SmsToMmsTextThreshold).show();
} else if (preference == mManageSimPref) {
startActivity(new Intent(this, ManageSimMessages.class));
} else if (preference == mClearHistoryPref) {
@@ -295,6 +319,9 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
} else if (preference == mEnableNotificationsPref) {
// Update the actual "enable notifications" value that is stored in secure settings.
enableNotifications(mEnableNotificationsPref.isChecked(), this);
+ } else if (preference == mEnableMultipartSMS) {
+ //should be false when the checkbox is checked
+ MmsConfig.setEnableMultipartSMS(!mEnableMultipartSMS.isChecked());
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -325,6 +352,18 @@ public void onNumberSet(int limit) {
}
};
+ NumberPickerDialog.OnNumberSetListener mSmsToMmsTextThresholdListener =
+ new NumberPickerDialog.OnNumberSetListener() {
+ public void onNumberSet(int limit) {
+ SharedPreferences.Editor editPrefs =
+ PreferenceManager.getDefaultSharedPreferences(MessagingPreferenceActivity.this).edit();
+ editPrefs.putInt("pref_key_sms_SmsToMmsTextThreshold", limit);
+ editPrefs.apply();
+ MmsConfig.setSmsToMmsTextThreshold(limit+1);
+ setSmsToMmsTextThreshold();
+ }
+ };
+
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {

0 comments on commit 55c5edc

Please sign in to comment.
Something went wrong with that request. Please try again.