public final class PointerIcon extends Object implements Parcelable
Pointer icons can be provided either by the system using system types, or by applications using bitmaps or application resources.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<PointerIcon> |
CREATOR |
static int |
TYPE_ALIAS
Type constant: alias (indicating an alias of/shortcut to something is
to be created.
|
static int |
TYPE_ALL_SCROLL
Type constant: all-scroll.
|
static int |
TYPE_ARROW
Type constant: Arrow icon.
|
static int |
TYPE_CELL
Type constant: cell.
|
static int |
TYPE_CONTEXT_MENU
Type constant: context-menu.
|
static int |
TYPE_COPY
Type constant: copy.
|
static int |
TYPE_CROSSHAIR
Type constant: crosshair.
|
static int |
TYPE_CUSTOM
Type constant: Custom icon with a user-supplied bitmap.
|
static int |
TYPE_DEFAULT
The default pointer icon.
|
static int |
TYPE_GRAB
Type constant: grab.
|
static int |
TYPE_GRABBING
Type constant: grabbing.
|
static int |
TYPE_HAND
Type constant: hand.
|
static int |
TYPE_HELP
Type constant: help.
|
static int |
TYPE_HORIZONTAL_DOUBLE_ARROW
Type constant: horizontal double arrow mainly for resizing.
|
static int |
TYPE_NO_DROP
Type constant: no-drop.
|
static int |
TYPE_NOT_SPECIFIED
Type constant: no icons are specified.
|
static int |
TYPE_NULL
Type constant: Null icon.
|
static int |
TYPE_SPOT_ANCHOR
Type constant: Spot anchor icon for touchpads.
|
static int |
TYPE_SPOT_HOVER
Type constant: Spot hover icon for touchpads.
|
static int |
TYPE_SPOT_TOUCH
Type constant: Spot touch icon for touchpads.
|
static int |
TYPE_TEXT
Type constant: text.
|
static int |
TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-left to bottom-right.
|
static int |
TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-right to bottom-left.
|
static int |
TYPE_VERTICAL_DOUBLE_ARROW
Type constant: vertical double arrow mainly for resizing.
|
static int |
TYPE_VERTICAL_TEXT
Type constant: vertical-text.
|
static int |
TYPE_WAIT
Type constant: wait.
|
static int |
TYPE_ZOOM_IN
Type constant: zoom-in.
|
static int |
TYPE_ZOOM_OUT
Type constant: zoom-out.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
static PointerIcon |
create(Bitmap bitmap,
float hotSpotX,
float hotSpotY)
Creates a custom pointer icon from the given bitmap and hotspot information.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
boolean |
equals(Object other)
Indicates whether some other object is "equal to" this one.
|
static PointerIcon |
getDefaultIcon(Context context)
Gets the default pointer icon.
|
static PointerIcon |
getNullIcon()
Gets a special pointer icon that has no bitmap.
|
static PointerIcon |
getSystemIcon(Context context,
int type)
Gets a system pointer icon for the given type.
|
int |
getType() |
PointerIcon |
load(Context context)
Loads the bitmap and hotspot information for a pointer icon, if it is not already loaded.
|
static PointerIcon |
load(Resources resources,
int resourceId)
Loads a custom pointer icon from an XML resource.
|
static void |
setUseLargeIcons(boolean use)
Updates wheter accessibility large icons are used or not.
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final int TYPE_CUSTOM
public static final int TYPE_NULL
public static final int TYPE_NOT_SPECIFIED
public static final int TYPE_ARROW
public static final int TYPE_SPOT_HOVER
public static final int TYPE_SPOT_TOUCH
public static final int TYPE_SPOT_ANCHOR
public static final int TYPE_CONTEXT_MENU
public static final int TYPE_HAND
public static final int TYPE_HELP
public static final int TYPE_WAIT
public static final int TYPE_CELL
public static final int TYPE_CROSSHAIR
public static final int TYPE_TEXT
public static final int TYPE_VERTICAL_TEXT
public static final int TYPE_ALIAS
public static final int TYPE_COPY
public static final int TYPE_NO_DROP
public static final int TYPE_ALL_SCROLL
public static final int TYPE_HORIZONTAL_DOUBLE_ARROW
public static final int TYPE_VERTICAL_DOUBLE_ARROW
public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_ZOOM_IN
public static final int TYPE_ZOOM_OUT
public static final int TYPE_GRAB
public static final int TYPE_GRABBING
public static final int TYPE_DEFAULT
public static final Parcelable.Creator<PointerIcon> CREATOR
public static PointerIcon getNullIcon()
TYPE_NULL
public static PointerIcon getDefaultIcon(Context context)
context
- The context.IllegalArgumentException
- if context is null.public static PointerIcon getSystemIcon(Context context, int type)
context
- The context.type
- The pointer icon type.IllegalArgumentException
- if context is null.public static void setUseLargeIcons(boolean use)
public static PointerIcon create(Bitmap bitmap, float hotSpotX, float hotSpotY)
bitmap
- The bitmap for the icon.hotSpotX
- The X offset of the pointer icon hotspot in the bitmap.
Must be within the [0, bitmap.getWidth()) range.hotSpotY
- The Y offset of the pointer icon hotspot in the bitmap.
Must be within the [0, bitmap.getHeight()) range.IllegalArgumentException
- if bitmap is null, or if the x/y hotspot
parameters are invalid.public static PointerIcon load(Resources resources, @XmlRes int resourceId)
The XML resource should have the following form:
<?xml version="1.0" encoding="utf-8"?>
<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
android:bitmap="@drawable/my_pointer_bitmap"
android:hotSpotX="24"
android:hotSpotY="24" />
resources
- The resources object.resourceId
- The resource id.IllegalArgumentException
- if resources is null.Resources.NotFoundException
- if the resource was not found or the drawable
linked in the resource was not found.public PointerIcon load(Context context)
context
- The context.IllegalArgumentException
- if context is null.public int getType()
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel out, int flags)
Parcelable
writeToParcel
in interface Parcelable
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public boolean equals(Object other)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
other
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap