Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27d37722 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Some work on issue #2286804: sometimes text field doesn't accept input

This doesn't really fix the problem being brought up here, but fixes a
related issue I found while investigating it -- if you tap a text view
enough to cause it to try to scroll, this will cause the touch to become
a scroll instead of a click, even if there is nothing to scroll.  So
often quick taps to bring up the IME would be canceled because they
became a non-scroll.

Unfortuntately after syncing the latest build, I was having a lot of
trouble reproducing the original problem.  I think I need to punt it to
MR2 at this point.

Change-Id: If1f0bf33de1b4d71c9f677cdad07639b7a3fb772
parent 5886050f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.text.Layout;
import android.text.NoCopySpan;
import android.text.Layout.Alignment;
import android.text.Spannable;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.widget.TextView;
@@ -156,8 +157,17 @@ public class Touch {
                                                            padding));
                    ny = Math.max(ny, 0);
        
                    int oldX = widget.getScrollX();
                    int oldY = widget.getScrollY();

                    scrollTo(widget, layout, nx, ny);

                    // If we actually scrolled, then cancel the up action.
                    if (oldX != widget.getScrollX()
                            || oldY != widget.getScrollY()) {
                        widget.cancelLongPress();
                    }

                    return true;
                }
            }
+1 −4
Original line number Diff line number Diff line
@@ -6529,6 +6529,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            // Reset this state; it will be re-set if super.onTouchEvent
            // causes focus to move to the view.
            mTouchFocusSelected = false;
            mScrolled = false;
        }
        
        final boolean superResult = super.onTouchEvent(event);
@@ -6545,10 +6546,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        if ((mMovement != null || onCheckIsTextEditor()) && mText instanceof Spannable && mLayout != null) {
            
            if (action == MotionEvent.ACTION_DOWN) {
                mScrolled = false;
            }
            
            boolean handled = false;
            
            int oldSelStart = Selection.getSelectionStart(mText);