am a22a380f: Add Icon support to ImageView.
* commit 'a22a380fbbe224783d8b82440ca8692b0ff5b0a2': Add Icon support to ImageView.
This commit is contained in:
@@ -40267,6 +40267,7 @@ package android.widget {
|
||||
method public void setImageAlpha(int);
|
||||
method public void setImageBitmap(android.graphics.Bitmap);
|
||||
method public void setImageDrawable(android.graphics.drawable.Drawable);
|
||||
method public void setImageIcon(android.graphics.drawable.Icon);
|
||||
method public void setImageLevel(int);
|
||||
method public void setImageMatrix(android.graphics.Matrix);
|
||||
method public void setImageResource(int);
|
||||
@@ -40847,7 +40848,9 @@ package android.widget {
|
||||
method public void setDouble(int, java.lang.String, double);
|
||||
method public void setEmptyView(int, int);
|
||||
method public void setFloat(int, java.lang.String, float);
|
||||
method public void setIcon(int, java.lang.String, android.graphics.drawable.Icon);
|
||||
method public void setImageViewBitmap(int, android.graphics.Bitmap);
|
||||
method public void setImageViewIcon(int, android.graphics.drawable.Icon);
|
||||
method public void setImageViewResource(int, int);
|
||||
method public void setImageViewUri(int, android.net.Uri);
|
||||
method public void setInt(int, java.lang.String, int);
|
||||
|
||||
@@ -42842,6 +42842,7 @@ package android.widget {
|
||||
method public void setImageAlpha(int);
|
||||
method public void setImageBitmap(android.graphics.Bitmap);
|
||||
method public void setImageDrawable(android.graphics.drawable.Drawable);
|
||||
method public void setImageIcon(android.graphics.drawable.Icon);
|
||||
method public void setImageLevel(int);
|
||||
method public void setImageMatrix(android.graphics.Matrix);
|
||||
method public void setImageResource(int);
|
||||
@@ -43422,7 +43423,9 @@ package android.widget {
|
||||
method public void setDouble(int, java.lang.String, double);
|
||||
method public void setEmptyView(int, int);
|
||||
method public void setFloat(int, java.lang.String, float);
|
||||
method public void setIcon(int, java.lang.String, android.graphics.drawable.Icon);
|
||||
method public void setImageViewBitmap(int, android.graphics.Bitmap);
|
||||
method public void setImageViewIcon(int, android.graphics.drawable.Icon);
|
||||
method public void setImageViewResource(int, int);
|
||||
method public void setImageViewUri(int, android.net.Uri);
|
||||
method public void setInt(int, java.lang.String, int);
|
||||
|
||||
@@ -36,8 +36,10 @@ import android.graphics.RectF;
|
||||
import android.graphics.Xfermode;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -461,6 +463,21 @@ public class ImageView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content of this ImageView to the specified Icon.
|
||||
*
|
||||
* <p class="note">Depending on the Icon type, this may do Bitmap reading and decoding
|
||||
* on the UI thread, which can cause UI jank. If that's a concern, consider using
|
||||
* {@link Icon#loadDrawableAsync(Context, Handler, Icon.OnDrawableLoadedListener)}
|
||||
* and then {@link #setImageDrawable(android.graphics.drawable.Drawable)} instead.</p>
|
||||
*
|
||||
* @param icon an Icon holding the desired image
|
||||
*/
|
||||
@android.view.RemotableViewMethod
|
||||
public void setImageIcon(Icon icon) {
|
||||
setImageDrawable(icon.loadDrawable(mContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a tint to the image drawable. Does not modify the current tint
|
||||
* mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -2081,6 +2096,16 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
setBitmap(viewId, "setImageBitmap", bitmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -2518,6 +2543,17 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
addAction(new ReflectionAction(viewId, methodName, ReflectionAction.INTENT, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user