summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/RemoteViews.java
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2015-05-13 00:12:47 -0400
committerDan Sandler <dsandler@android.com>2015-05-13 23:50:39 -0400
commita22a380fbbe224783d8b82440ca8692b0ff5b0a2 (patch)
treed965ccd538b3c915f517f933122f54683f8ed96b /core/java/android/widget/RemoteViews.java
parentae597c33dc3697cf5c314d88cb597cb41c362eb3 (diff)
downloadframeworks_base-a22a380fbbe224783d8b82440ca8692b0ff5b0a2.zip
frameworks_base-a22a380fbbe224783d8b82440ca8692b0ff5b0a2.tar.gz
frameworks_base-a22a380fbbe224783d8b82440ca8692b0ff5b0a2.tar.bz2
Add Icon support to ImageView.
ImageView.setImageIcon() is remotable, so you can also call RemoteViews.setImageViewIcon(). Bug: 18568715 Change-Id: I456cfa65102e1983d3392d822584d154a6cd761a
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
-rw-r--r--core/java/android/widget/RemoteViews.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index a10be11..dc75fd0 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -35,6 +35,7 @@ import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -1072,6 +1073,7 @@ public class RemoteViews implements Parcelable, Filter {
static final int BUNDLE = 13;
static final int INTENT = 14;
static final int COLOR_STATE_LIST = 15;
+ static final int ICON = 16;
String methodName;
int type;
@@ -1150,6 +1152,10 @@ public class RemoteViews implements Parcelable, Filter {
this.value = ColorStateList.CREATOR.createFromParcel(in);
}
break;
+ case ICON:
+ if (in.readInt() != 0) {
+ this.value = Icon.CREATOR.createFromParcel(in);
+ }
default:
break;
}
@@ -1225,6 +1231,13 @@ public class RemoteViews implements Parcelable, Filter {
if (this.value != null) {
((ColorStateList)this.value).writeToParcel(out, flags);
}
+ break;
+ case ICON:
+ out.writeInt(this.value != null ? 1 : 0);
+ if (this.value != null) {
+ ((Icon)this.value).writeToParcel(out, flags);
+ }
+ break;
default:
break;
}
@@ -1262,6 +1275,8 @@ public class RemoteViews implements Parcelable, Filter {
return Intent.class;
case COLOR_STATE_LIST:
return ColorStateList.class;
+ case ICON:
+ return Icon.class;
default:
return null;
}
@@ -2082,6 +2097,16 @@ public class RemoteViews implements Parcelable, Filter {
}
/**
+ * Equivalent to calling ImageView.setImageIcon
+ *
+ * @param viewId The id of the view whose bitmap should change
+ * @param icon The new Icon for the ImageView
+ */
+ public void setImageViewIcon(int viewId, Icon icon) {
+ setIcon(viewId, "setImageIcon", icon);
+ }
+
+ /**
* Equivalent to calling AdapterView.setEmptyView
*
* @param viewId The id of the view on which to set the empty view
@@ -2519,6 +2544,17 @@ public class RemoteViews implements Parcelable, Filter {
}
/**
+ * Call a method taking one Icon on a view in the layout for this RemoteViews.
+ *
+ * @param viewId The id of the view on which to call the method.
+ * @param methodName The name of the method to call.
+ * @param value The {@link android.graphics.drawable.Icon} to pass the method.
+ */
+ public void setIcon(int viewId, String methodName, Icon value) {
+ addAction(new ReflectionAction(viewId, methodName, ReflectionAction.ICON, value));
+ }
+
+ /**
* Equivalent to calling View.setContentDescription(CharSequence).
*
* @param viewId The id of the view whose content description should change.