Allow the SMS message length to be set via mms_config.xml
Change-Id: I8941fcc9f352805635c638aa2e2bae513b71db8f
Signed-off-by: Soojung Shin <sj46.shin@samsung.com>
diff --git a/res/layout/compose_message_activity.xml b/res/layout/compose_message_activity.xml
index f110d90..61c8931 100644
--- a/res/layout/compose_message_activity.xml
+++ b/res/layout/compose_message_activity.xml
@@ -158,7 +158,6 @@
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
android:imeOptions="actionSend|flagNoEnterAction"
android:background="@android:drawable/edit_text"
- android:maxLength="2000"
/>
<LinearLayout
diff --git a/res/xml/mms_config.xml b/res/xml/mms_config.xml
index 33c7bb4..b3e8d8c 100644
--- a/res/xml/mms_config.xml
+++ b/res/xml/mms_config.xml
@@ -71,6 +71,10 @@
set duration value. -->
<bool name="enableSlideDuration">true</bool>
+ <!-- Maximum length for message text. Use a value of -1
+ to indicate default value -->
+ <int name="maxMessageTextSize">-1</int>
+
<!-- User-Agent parameter used in MMS http request -->
<!-- this is default to "Android-Mms/0.1". Override if necessary. Optional -->
<!--
diff --git a/src/com/android/mms/MmsConfig.java b/src/com/android/mms/MmsConfig.java
index 0e2a69a..86301d6 100755
--- a/src/com/android/mms/MmsConfig.java
+++ b/src/com/android/mms/MmsConfig.java
@@ -36,6 +36,7 @@
private static final int MAX_IMAGE_HEIGHT = 480;
private static final int MAX_IMAGE_WIDTH = 640;
+ private static final int MAX_TEXT_LENGTH = 2000;
/**
* Whether to hide MMS functionality from the user (i.e. SMS only).
@@ -63,6 +64,7 @@
private static int mSmsToMmsTextThreshold = 4;
private static boolean mEnableMultipartSMS = true;
private static boolean mEnableSlideDuration = true;
+ private static int mMaxTextLength = -1;
// This is the max amount of storage multiplied by mMaxMessageSize that we
// allow of unsent messages before blocking the user from sending any more
@@ -139,6 +141,10 @@
return mRecipientLimit;
}
+ public static int getMaxTextLimit() {
+ return mMaxTextLength > -1 ? mMaxTextLength : MAX_TEXT_LENGTH;
+ }
+
public static int getDefaultSMSMessagesPerThread() {
return mDefaultSMSMessagesPerThread;
}
@@ -295,6 +301,8 @@
mAliasRuleMaxChars = Integer.parseInt(text);
} else if ("smsToMmsTextThreshold".equalsIgnoreCase(value)) {
mSmsToMmsTextThreshold = Integer.parseInt(text);
+ } else if ("maxMessageTextSize".equalsIgnoreCase(value)) {
+ mMaxTextLength = Integer.parseInt(text);
}
} else if ("string".equals(tag)) {
// string config tags go here
diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java
old mode 100755
new mode 100644
index 35ef49e..a45cd65
--- a/src/com/android/mms/ui/ComposeMessageActivity.java
+++ b/src/com/android/mms/ui/ComposeMessageActivity.java
@@ -140,6 +140,8 @@
import com.android.mms.util.SendingProgressTokenManager;
import com.android.mms.util.SmileyParser;
+import android.text.InputFilter.LengthFilter;
+
/**
* This is the main UI for:
* 1. Composing a new message;
@@ -2935,6 +2937,8 @@
mTextEditor = (EditText) findViewById(R.id.embedded_text_editor);
mTextEditor.setOnEditorActionListener(this);
mTextEditor.addTextChangedListener(mTextEditorWatcher);
+ mTextEditor.setFilters(new InputFilter[] {
+ new LengthFilter(MmsConfig.getMaxTextLimit())});
mTextCounter = (TextView) findViewById(R.id.text_counter);
mSendButton = (Button) findViewById(R.id.send_button);
mSendButton.setOnClickListener(this);
diff --git a/src/com/android/mms/ui/SlideEditorActivity.java b/src/com/android/mms/ui/SlideEditorActivity.java
index c9aa420..3091af2 100644
--- a/src/com/android/mms/ui/SlideEditorActivity.java
+++ b/src/com/android/mms/ui/SlideEditorActivity.java
@@ -60,6 +60,9 @@
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
+import android.text.InputFilter.LengthFilter;
+import android.widget.EditText;
+import android.text.InputFilter;
/**
* This activity allows user to edit the contents of a slide.
@@ -106,6 +109,7 @@
private Button mPreview;
private Button mReplaceImage;
private Button mRemoveSlide;
+ private EditText mTextEditor;
private Button mDone;
private BasicSlideEditorView mSlideView;
@@ -142,6 +146,10 @@
mRemoveSlide = (Button) findViewById(R.id.remove_slide_button);
mRemoveSlide.setOnClickListener(mOnRemoveSlide);
+ mTextEditor = (EditText) findViewById(R.id.text_message);
+ mTextEditor.setFilters(new InputFilter[] {
+ new LengthFilter(MmsConfig.getMaxTextLimit())});
+
mDone = (Button) findViewById(R.id.done_button);
mDone.setOnClickListener(mDoneClickListener);