Allow specifying pointer shape from xml resource.
Bug: 25777986
Change-Id: I8be5d2cb130299b0ea8f4f4d3dc582143f7ff553
diff --git a/api/current.txt b/api/current.txt
index d17f4b6..f5ccf0e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -925,6 +925,7 @@
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
+ field public static final int pointerShape = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
diff --git a/api/system-current.txt b/api/system-current.txt
index 492d6a9..bc63b48 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1019,6 +1019,7 @@
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
+ field public static final int pointerShape = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
diff --git a/api/test-current.txt b/api/test-current.txt
index 680f783..a222037 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -925,6 +925,7 @@
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
+ field public static final int pointerShape = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 183ccf3..3db18066 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4487,6 +4487,12 @@
initializeScrollIndicators = true;
}
break;
+ case R.styleable.View_pointerShape:
+ final int pointerShape = a.getInt(attr, PointerIcon.STYLE_NOT_SPECIFIED);
+ if (pointerShape != PointerIcon.STYLE_NOT_SPECIFIED) {
+ setPointerShape(pointerShape);
+ }
+ break;
}
}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 786554c..9f13565 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2791,6 +2791,56 @@
<flag name="end" value="0x20" />
</attr>
+ <attr name="pointerShape">
+ <!-- Null icon, pointer becomes invisible. -->
+ <enum name="none" value="0" />
+ <!-- The default icon of arrow pointer. -->
+ <enum name="arrow" value="1000" />
+ <!-- Pointer icon indicating context-menu will appear. -->
+ <enum name="context_menu" value="1001" />
+ <!-- Pointer icon of a hand with the index finger. -->
+ <enum name="hand" value="1002" />
+ <!-- Pointer icon indicating help. -->
+ <enum name="help" value="1003" />
+ <!-- Pointer icon indicating something is going on and waiting. -->
+ <enum name="wait" value="1004" />
+ <!-- Pointer icon for cell and grid. -->
+ <enum name="cell" value="1006" />
+ <!-- Pointer icon of crosshair, indicating to spot a location. -->
+ <enum name="crosshair" value="1007" />
+ <!-- Pointer icon of I-beam, usually for text. -->
+ <enum name="text" value="1008" />
+ <!-- Pointer icon of I-beam with 90-degree rotated, for vertical text. -->
+ <enum name="vertical_text" value="1009" />
+ <!-- Pointer icon of 'alias', indicating an alias of/shortcut to something is to be
+ created. -->
+ <enum name="alias" value="1010" />
+ <!-- Pointer icon of 'copy', used for drag/drop. -->
+ <enum name="copy" value="1011" />
+ <!-- Pointer icon of 'no-drop', indicating the drop will not be accepted at the
+ current location. -->
+ <enum name="no_drop" value="1012" />
+ <!-- Pointer icon of four-way arrows, indicating scrolling all direction. -->
+ <enum name="all_scroll" value="1013" />
+ <!-- Pointer icon of horizontal double arrow, indicating horizontal resize. -->
+ <enum name="horizontal_double_arrow" value="1014" />
+ <!-- Pointer icon of vertical double arrow, indicating vertical resize. -->
+ <enum name="vertical_double_arrow" value="1015" />
+ <!-- Pointer icon of diagonal double arrow, starting from top-right to bottom-left.
+ Indicating freeform resize. -->
+ <enum name="top_right_diagonal_double_arrow" value="1016" />
+ <!-- Pointer icon of diagonal double arrow, starting from top-left to bottom-right.
+ Indicating freeform resize. -->
+ <enum name="top_left_diagonal_double_arrow" value="1017" />
+ <!-- Pointer icon indicating zoom-in. -->
+ <enum name="zoom_in" value="1018" />
+ <!-- Pointer icon indicating zoom-out. -->
+ <enum name="zoom_out" value="1019" />
+ <!-- Pointer icon of a hand sign to grab something. -->
+ <enum name="grab" value="1020" />
+ <!-- Pointer icon of a hand sign while grabbing something. -->
+ <enum name="grabbing" value="1021" />
+ </attr>
</declare-styleable>
<!-- Attributes that can be assigned to a tag for a particular View. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index addeb05..ad36f3c 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2684,6 +2684,7 @@
<public type="attr" name="preferenceFragmentStyle" />
<public type="attr" name="canControlMagnification" />
<public type="attr" name="languageTag" />
+ <public type="attr" name="pointerShape" />
<public type="style" name="Theme.Material.DayNight" />
<public type="style" name="Theme.Material.DayNight.DarkActionBar" />