com.bumptech.glide.request.target
Class AppWidgetTarget

java.lang.Object
  extended by com.bumptech.glide.request.target.BaseTarget<Z>
      extended by com.bumptech.glide.request.target.SimpleTarget<Bitmap>
          extended by com.bumptech.glide.request.target.AppWidgetTarget
All Implemented Interfaces:
LifecycleListener, Target<Bitmap>

public class AppWidgetTarget
extends SimpleTarget<Bitmap>

This class is used in order to display downloaded Bitmap inside an ImageView of an AppWidget through RemoteViews.

Note - For cancellation to work correctly, you must pass in the same instance of this class for every subsequent load.


Field Summary
 
Fields inherited from interface com.bumptech.glide.request.target.Target
SIZE_ORIGINAL
 
Constructor Summary
AppWidgetTarget(Context context, RemoteViews remoteViews, int viewId, ComponentName componentName)
          Constructor using a ComponentName, when override has been set to get a handle on the Widget in order to update it that uses Target.SIZE_ORIGINAL as the target width and height.
AppWidgetTarget(Context context, RemoteViews remoteViews, int viewId, int... widgetIds)
          Constructor using an int array of widgetIds to get a handle on the Widget in order to update it that uses Target.SIZE_ORIGINAL as the target width and height.
AppWidgetTarget(Context context, RemoteViews remoteViews, int viewId, int width, int height, ComponentName componentName)
          Constructor using a ComponentName to get a handle on the Widget in order to update it.
AppWidgetTarget(Context context, RemoteViews remoteViews, int viewId, int width, int height, int... widgetIds)
          Constructor using an int array of widgetIds to get a handle on the Widget in order to update it.
 
Method Summary
 void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation)
          The method that will be called when the resource load has finished.
 
Methods inherited from class com.bumptech.glide.request.target.SimpleTarget
getSize
 
Methods inherited from class com.bumptech.glide.request.target.BaseTarget
getRequest, onDestroy, onLoadCleared, onLoadFailed, onLoadStarted, onStart, onStop, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppWidgetTarget

public AppWidgetTarget(Context context,
                       RemoteViews remoteViews,
                       int viewId,
                       int width,
                       int height,
                       int... widgetIds)
Constructor using an int array of widgetIds to get a handle on the Widget in order to update it.

Parameters:
context - Context to use in the AppWidgetManager initialization.
remoteViews - RemoteViews object which contains the ImageView that will load the bitmap.
viewId - The id of the ImageView view that will load the image.
width - Desired width in pixels of the bitmap that will be loaded. (Needs to be manually set because of RemoteViews limitations.)
height - Desired height in pixels of the bitmap that will be loaded. (Needs to be manually set because of RemoteViews limitations.)
widgetIds - The int[] that contains the widget ids of an application.

AppWidgetTarget

public AppWidgetTarget(Context context,
                       RemoteViews remoteViews,
                       int viewId,
                       int... widgetIds)
Constructor using an int array of widgetIds to get a handle on the Widget in order to update it that uses Target.SIZE_ORIGINAL as the target width and height.

Parameters:
context - Context to use in the AppWidgetManager initialization.
remoteViews - RemoteViews object which contains the ImageView that will load the bitmap.
viewId - The id of the ImageView view that will load the image.
widgetIds - The int[] that contains the widget ids of an application.

AppWidgetTarget

public AppWidgetTarget(Context context,
                       RemoteViews remoteViews,
                       int viewId,
                       int width,
                       int height,
                       ComponentName componentName)
Constructor using a ComponentName to get a handle on the Widget in order to update it.

Parameters:
context - Context to use in the AppWidgetManager initialization.
remoteViews - RemoteViews object which contains the ImageView that will load the bitmap.
viewId - The id of the ImageView view that will load the image.
width - Desired width in pixels of the bitmap that will be loaded. (Needs to be manually set because of RemoteViews limitations.)
height - Desired height in pixels of the bitmap that will be loaded. (Needs to be manually set because of RemoteViews limitations.)
componentName - The ComponentName that refers to our AppWidget.

AppWidgetTarget

public AppWidgetTarget(Context context,
                       RemoteViews remoteViews,
                       int viewId,
                       ComponentName componentName)
Constructor using a ComponentName, when override has been set to get a handle on the Widget in order to update it that uses Target.SIZE_ORIGINAL as the target width and height.

Parameters:
context - Context to use in the AppWidgetManager initialization.
remoteViews - RemoteViews object which contains the ImageView that will load the bitmap.
viewId - The id of the ImageView view that will load the image.
componentName - The ComponentName that refers to our AppWidget.
Method Detail

onResourceReady

public void onResourceReady(Bitmap resource,
                            GlideAnimation<? super Bitmap> glideAnimation)
Description copied from interface: Target
The method that will be called when the resource load has finished.

Parameters:
resource - the loaded resource.