Update pointer hotspots to scale for DPI
Also updates the bitmap resources, which weren't scaled correctly for their respective DPI buckets. BUG: 16459309 Change-Id: Iedc781e2ee47a8b960390fea718cb08bcfb84ae3
@@ -149,9 +149,9 @@ public final class PointerIcon implements Parcelable {
|
||||
* Creates a custom pointer from the given bitmap and hotspot information.
|
||||
*
|
||||
* @param bitmap The bitmap for the icon.
|
||||
* @param hotspotX The X offset of the pointer icon hotspot in the bitmap.
|
||||
* @param hotSpotX The X offset of the pointer icon hotspot in the bitmap.
|
||||
* Must be within the [0, bitmap.getWidth()) range.
|
||||
* @param hotspotY The Y offset of the pointer icon hotspot in the bitmap.
|
||||
* @param hotSpotY The Y offset of the pointer icon hotspot in the bitmap.
|
||||
* Must be within the [0, bitmap.getHeight()) range.
|
||||
* @return A pointer icon for this bitmap.
|
||||
*
|
||||
@@ -374,18 +374,18 @@ public final class PointerIcon implements Parcelable {
|
||||
}
|
||||
|
||||
private void loadResource(Context context, Resources resources, int resourceId) {
|
||||
XmlResourceParser parser = resources.getXml(resourceId);
|
||||
final XmlResourceParser parser = resources.getXml(resourceId);
|
||||
final int bitmapRes;
|
||||
final float hotSpotX;
|
||||
final float hotSpotY;
|
||||
try {
|
||||
XmlUtils.beginDocument(parser, "pointer-icon");
|
||||
|
||||
TypedArray a = resources.obtainAttributes(
|
||||
final TypedArray a = resources.obtainAttributes(
|
||||
parser, com.android.internal.R.styleable.PointerIcon);
|
||||
bitmapRes = a.getResourceId(com.android.internal.R.styleable.PointerIcon_bitmap, 0);
|
||||
hotSpotX = a.getFloat(com.android.internal.R.styleable.PointerIcon_hotSpotX, 0);
|
||||
hotSpotY = a.getFloat(com.android.internal.R.styleable.PointerIcon_hotSpotY, 0);
|
||||
hotSpotX = a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotX, 0);
|
||||
hotSpotY = a.getDimension(com.android.internal.R.styleable.PointerIcon_hotSpotY, 0);
|
||||
a.recycle();
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalArgumentException("Exception parsing pointer icon resource.", ex);
|
||||
|
||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_anchor"
|
||||
android:hotSpotX="33"
|
||||
android:hotSpotY="33" />
|
||||
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 7.8 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_hover"
|
||||
android:hotSpotX="33"
|
||||
android:hotSpotY="33" />
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_touch"
|
||||
android:hotSpotX="24"
|
||||
android:hotSpotY="24" />
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_arrow"
|
||||
android:hotSpotX="6"
|
||||
android:hotSpotY="6" />
|
||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_arrow"
|
||||
android:hotSpotX="12"
|
||||
android:hotSpotY="12" />
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_arrow"
|
||||
android:hotSpotX="9"
|
||||
android:hotSpotY="9" />
|
||||
android:hotSpotX="6dp"
|
||||
android:hotSpotY="6dp" />
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_anchor"
|
||||
android:hotSpotX="33"
|
||||
android:hotSpotY="33" />
|
||||
android:hotSpotX="22dp"
|
||||
android:hotSpotY="22dp" />
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_hover"
|
||||
android:hotSpotX="33"
|
||||
android:hotSpotY="33" />
|
||||
android:hotSpotX="22dp"
|
||||
android:hotSpotY="22dp" />
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:bitmap="@drawable/pointer_spot_touch"
|
||||
android:hotSpotX="24"
|
||||
android:hotSpotY="24" />
|
||||
android:hotSpotX="16dp"
|
||||
android:hotSpotY="16dp" />
|
||||
@@ -7112,9 +7112,9 @@
|
||||
<!-- Drawable to use as the icon bitmap. -->
|
||||
<attr name="bitmap" format="reference" />
|
||||
<!-- X coordinate of the icon hot spot. -->
|
||||
<attr name="hotSpotX" format="float" />
|
||||
<attr name="hotSpotX" format="dimension" />
|
||||
<!-- Y coordinate of the icon hot spot. -->
|
||||
<attr name="hotSpotY" format="float" />
|
||||
<attr name="hotSpotY" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="Storage">
|
||||
|
||||