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

Commit d0c510f5 authored by Haoyu Zhang's avatar Haoyu Zhang Committed by Android (Google) Code Review
Browse files

Merge "Globally enable stylus hover icon" into udc-qpr-dev

parents 1cec4593 8199e8c9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2043,7 +2043,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        final float x = event.getXDispatchLocation(pointerIndex);
        final float y = event.getYDispatchLocation(pointerIndex);
        if (isOnScrollbarThumb(x, y) || isDraggingScrollBar()) {
            return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW);
            // Return null here so that it fallbacks to the default PointerIcon for the source
            // device. For mouse, the default PointerIcon is PointerIcon.TYPE_ARROW.
            // For stylus, the default PointerIcon is PointerIcon.TYPE_NULL.
            return null;
        }
        // Check what the child under the pointer says about the pointer.
        final int childrenCount = mChildrenCount;
+1 −1
Original line number Diff line number Diff line
@@ -4703,7 +4703,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

    @Override
    public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
        if (mFastScroll != null) {
        if (mFastScroll != null && event.isFromSource(InputDevice.SOURCE_MOUSE)) {
            PointerIcon pointerIcon = mFastScroll.onResolvePointerIcon(event, pointerIndex);
            if (pointerIcon != null) {
                return pointerIcon;
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.InputDevice;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.PointerIcon;
@@ -173,7 +174,8 @@ public class Button extends TextView {

    @Override
    public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
        if (getPointerIcon() == null && isClickable() && isEnabled()) {
        if (getPointerIcon() == null && isClickable() && isEnabled()
                && event.isFromSource(InputDevice.SOURCE_MOUSE)) {
            return PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HAND);
        }
        return super.onResolvePointerIcon(event, pointerIndex);
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.widget.RemoteViews.RemoteView;
@@ -99,7 +100,8 @@ public class ImageButton extends ImageView {

    @Override
    public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
        if (getPointerIcon() == null && isClickable() && isEnabled()) {
        if (getPointerIcon() == null && isClickable() && isEnabled()
                && event.isFromSource(InputDevice.SOURCE_MOUSE)) {
            return PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HAND);
        }
        return super.onResolvePointerIcon(event, pointerIndex);
+6 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.util.MathUtils;
import android.util.StateSet;
import android.util.TypedValue;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.view.View;
@@ -1060,10 +1061,12 @@ public class RadialTimePickerView extends View {
        if (!isEnabled()) {
            return null;
        }
        if (event.isFromSource(InputDevice.SOURCE_MOUSE)) {
            final int degrees = getDegreesFromXY(event.getX(), event.getY(), false);
            if (degrees != -1) {
                return PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HAND);
            }
        }
        return super.onResolvePointerIcon(event, pointerIndex);
    }

Loading