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

Commit abe2195b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Custom pointer icon for standard widgets"

parents fea4343c 2a848ff6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package android.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.widget.RemoteViews.RemoteView;


@@ -113,4 +115,12 @@ public class Button extends TextView {
    public CharSequence getAccessibilityClassName() {
        return Button.class.getName();
    }

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

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.widget.RemoteViews.RemoteView;

/**
@@ -94,4 +96,12 @@ public class ImageButton extends ImageView {
    public CharSequence getAccessibilityClassName() {
        return ImageButton.class.getName();
    }

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

import android.annotation.TestApi;
import android.view.PointerIcon;
import com.android.internal.R;
import com.android.internal.view.menu.ShowableListMenu;

@@ -903,6 +904,14 @@ public class Spinner extends AbsSpinner implements OnClickListener {
        }
    }

    @Override
    public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
        if (getPointerIcon() == null && isClickable() && isEnabled()) {
            return PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HAND);
        }
        return super.onResolvePointerIcon(event, pointerIndex);
    }

    static class SavedState extends AbsSpinner.SavedState {
        boolean showDropdown;

+14 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.widget;

import android.view.MotionEvent;
import android.view.PointerIcon;
import com.android.internal.R;

import android.annotation.DrawableRes;
@@ -494,6 +496,10 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
        child.setFocusable(true);
        child.setClickable(true);

        if (child.getPointerIcon() == null) {
            child.setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HAND));
        }

        super.addView(child);

        // TODO: detect this via geometry with a tabwidget listener rather
@@ -507,6 +513,14 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
        mSelectedTab = -1;
    }

    @Override
    public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
        if (!isEnabled()) {
            return null;
        }
        return super.onResolvePointerIcon(event, pointerIndex);
    }

    /**
     * Provides a way for {@link TabHost} to be notified that the user clicked
     * on a tab indicator.