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

Commit 8b5927e5 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Set movement method to the focusable text

The keyboard navigation should work for focusable text, thus
set ArrowKeyMovementMethod to the focusable TextView.

Bug: 244260144
Test: Manually done with demo app
Change-Id: I0b1e046b84641a40cb801e107980504dccd31f8a
parent 862f455d
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -2438,8 +2438,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
     * Subclasses override this to specify a default movement method.
     * Subclasses override this to specify a default movement method.
     */
     */
    protected MovementMethod getDefaultMovementMethod() {
    protected MovementMethod getDefaultMovementMethod() {
        if (isFocusable() || isFocusableInTouchMode()) {
            return ArrowKeyMovementMethod.getInstance();
        } else {
            return null;
            return null;
        }
        }
    }
    /**
    /**
     * Return the text that TextView is displaying. If {@link #setText(CharSequence)} was called
     * Return the text that TextView is displaying. If {@link #setText(CharSequence)} was called
@@ -2653,9 +2657,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    /**
    /**
     * Gets the {@link android.text.method.MovementMethod} being used for this TextView,
     * Gets the {@link android.text.method.MovementMethod} being used for this TextView,
     * which provides positioning, scrolling, and text selection functionality.
     * which provides positioning, scrolling, and text selection functionality.
     * This will frequently be null for non-EditText TextViews.
     * By default, this returns an instance of {@link android.text.method.ArrowKeyMovementMethod}
     * if this View is focusable or focusable in touch mode.
     *
     * @return the movement method being used for this TextView.
     * @return the movement method being used for this TextView.
     * @see android.text.method.MovementMethod
     * @see android.text.method.MovementMethod
     * @see android.text.method.ArrowKeyMovementMethod
     */
     */
    public final MovementMethod getMovementMethod() {
    public final MovementMethod getMovementMethod() {
        return mMovement;
        return mMovement;