1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 09:52:16 -05:00

Move this View out ( the hosting class is already too long with ~4000 Lines ..)

This commit is contained in:
ligi 2015-01-29 16:30:01 +01:00
parent 4075b72b72
commit 828a580eb8
3 changed files with 43 additions and 37 deletions

View File

@ -43,7 +43,6 @@ import android.os.Parcelable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.util.Rfc822Tokenizer;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
@ -112,6 +111,7 @@ import com.fsck.k9.mail.internet.TextBody;
import com.fsck.k9.mailstore.LocalMessage;
import com.fsck.k9.mailstore.TempFileBody;
import com.fsck.k9.mailstore.TempFileMessageBody;
import com.fsck.k9.ui.EolConvertingEditText;
import com.fsck.k9.view.MessageWebView;
import org.apache.james.mime4j.codec.EncoderUtil;
@ -3950,35 +3950,4 @@ public class MessageCompose extends K9Activity implements OnClickListener,
}
}
/**
* An {@link EditText} extension with methods that convert line endings from
* {@code \r\n} to {@code \n} and back again when setting and getting text.
*
*/
public static class EolConvertingEditText extends EditText {
public EolConvertingEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* Return the text the EolConvertingEditText is displaying.
*
* @return A string with any line endings converted to {@code \r\n}.
*/
public String getCharacters() {
return getText().toString().replace("\n", "\r\n");
}
/**
* Sets the string value of the EolConvertingEditText. Any line endings
* in the string will be converted to {@code \n}.
*
* @param text
*/
public void setCharacters(CharSequence text) {
setText(text.toString().replace("\r\n", "\n"));
}
}
}

View File

@ -0,0 +1,37 @@
package com.fsck.k9.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;
/**
* An {@link android.widget.EditText} extension with methods that convert line endings from
* {@code \r\n} to {@code \n} and back again when setting and getting text.
*
*/
public class EolConvertingEditText extends EditText {
public EolConvertingEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* Return the text the EolConvertingEditText is displaying.
*
* @return A string with any line endings converted to {@code \r\n}.
*/
public String getCharacters() {
return getText().toString().replace("\n", "\r\n");
}
/**
* Sets the string value of the EolConvertingEditText. Any line endings
* in the string will be converted to {@code \n}.
*
* @param text
*/
public void setCharacters(CharSequence text) {
setText(text.toString().replace("\r\n", "\n"));
}
}

View File

@ -139,7 +139,7 @@
<LinearLayout
android:orientation="horizontal"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
@ -217,7 +217,7 @@
<!-- We have to use "wrap_content" (not "0dip") for "layout_height", otherwise the
EditText won't properly grow in height while the user is typing the message -->
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
class="com.fsck.k9.ui.EolConvertingEditText"
android:id="@+id/message_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -230,7 +230,7 @@
android:textAppearance="?android:attr/textAppearanceMedium" />
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
class="com.fsck.k9.ui.EolConvertingEditText"
android:id="@+id/upper_signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -256,7 +256,7 @@
android:layout_height="wrap_content">
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
class="com.fsck.k9.ui.EolConvertingEditText"
android:id="@+id/quoted_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -297,7 +297,7 @@
</RelativeLayout>
<view
class="com.fsck.k9.activity.MessageCompose$EolConvertingEditText"
class="com.fsck.k9.ui.EolConvertingEditText"
android:id="@+id/lower_signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"