mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Small behavior improvement
This commit is contained in:
parent
069cf8f10c
commit
a21aa3e68f
1 changed files with 23 additions and 0 deletions
|
@ -66,6 +66,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
@ -285,6 +286,25 @@ public class FragmentCompose extends FragmentBase {
|
||||||
// Wire controls
|
// Wire controls
|
||||||
spIdentity.setOnItemSelectedListener(identitySelected);
|
spIdentity.setOnItemSelectedListener(identitySelected);
|
||||||
|
|
||||||
|
View.OnTouchListener onTouchListener = new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
EditText et = (EditText) v;
|
||||||
|
int sstart = et.getSelectionStart();
|
||||||
|
int send = et.getSelectionEnd();
|
||||||
|
|
||||||
|
if (sstart == send && event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
float x = event.getX() + et.getScrollX();
|
||||||
|
float y = event.getY() + et.getScrollY();
|
||||||
|
int pos = et.getOffsetForPosition(x, y);
|
||||||
|
if (pos >= 0)
|
||||||
|
et.setSelection(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
|
View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
|
@ -309,14 +329,17 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
etTo.setMaxLines(Integer.MAX_VALUE);
|
etTo.setMaxLines(Integer.MAX_VALUE);
|
||||||
etTo.setHorizontallyScrolling(false);
|
etTo.setHorizontallyScrolling(false);
|
||||||
|
etTo.setOnTouchListener(onTouchListener);
|
||||||
etTo.setOnLongClickListener(longClickListener);
|
etTo.setOnLongClickListener(longClickListener);
|
||||||
|
|
||||||
etCc.setMaxLines(Integer.MAX_VALUE);
|
etCc.setMaxLines(Integer.MAX_VALUE);
|
||||||
etCc.setHorizontallyScrolling(false);
|
etCc.setHorizontallyScrolling(false);
|
||||||
|
etCc.setOnTouchListener(onTouchListener);
|
||||||
etCc.setOnLongClickListener(longClickListener);
|
etCc.setOnLongClickListener(longClickListener);
|
||||||
|
|
||||||
etBcc.setMaxLines(Integer.MAX_VALUE);
|
etBcc.setMaxLines(Integer.MAX_VALUE);
|
||||||
etBcc.setHorizontallyScrolling(false);
|
etBcc.setHorizontallyScrolling(false);
|
||||||
|
etBcc.setOnTouchListener(onTouchListener);
|
||||||
etBcc.setOnLongClickListener(longClickListener);
|
etBcc.setOnLongClickListener(longClickListener);
|
||||||
|
|
||||||
etSubject.setMaxLines(Integer.MAX_VALUE);
|
etSubject.setMaxLines(Integer.MAX_VALUE);
|
||||||
|
|
Loading…
Reference in a new issue