Class DynamicRemoteViewsFactory
java.lang.Object
com.pranavpandey.android.dynamic.support.factory.DynamicRemoteViewsFactory
- All Implemented Interfaces:
RemoteViewsService.RemoteViewsFactory
public abstract class DynamicRemoteViewsFactory
extends Object
implements RemoteViewsService.RemoteViewsFactory
A customisable
RemoteViewsService.RemoteViewsFactory to provide basic functionality.
Extend it and implement necessary methods according to the requirements.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDynamicRemoteViewsFactory(Context context, int appWidgetId, int appWidgetType, int width, int height) Constructor to initialize an object of this class.DynamicRemoteViewsFactory(Context context, int appWidgetId, int appWidgetType, int width, int height, boolean adjustPosition) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionintGet the app widget id used by this factory.intGet the app widget type used by this factory.Get the dynamic context used by this factory.intReturns the current height of the widget provider used for this factory.intgetWidth()Returns the current width of the widget provider used for this factory.booleanChecks whether to adjust position of the scrollable view.voidabstract voidThis method will be called on initializing the factory.voidsetAdjustPosition(boolean adjustPosition) Sets the adjust position of the scrollable view for this factory.voidsetHeight(int height) Sets the current height of the widget provider used for this factory.voidsetWidth(int width) Sets the current width of the widget provider used for this factory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface android.widget.RemoteViewsService.RemoteViewsFactory
getCount, getItemId, getLoadingView, getViewAt, getViewTypeCount, hasStableIds, onCreate, onDestroy
-
Field Details
-
mContext
Dynamic context used by this factory.
-
-
Constructor Details
-
DynamicRemoteViewsFactory
public DynamicRemoteViewsFactory(@NonNull Context context, int appWidgetId, int appWidgetType, int width, int height) Constructor to initialize an object of this class.- Parameters:
context- The dynamic context for this factory.appWidgetId- The app widget id for this factory.appWidgetType- The app widget type for this factory.width- The current width of the widget provider.height- The current height of the widget provider.
-
DynamicRemoteViewsFactory
public DynamicRemoteViewsFactory(@NonNull Context context, int appWidgetId, int appWidgetType, int width, int height, boolean adjustPosition) Constructor to initialize an object of this class.- Parameters:
context- The dynamic context for this factory.appWidgetId- The app widget id for this factory.appWidgetType- The app widget type for this factory.width- The current width of the widget provider.height- The current height of the widget provider.adjustPosition-trueto adjust the scrollable view position.
-
-
Method Details
-
onInitialize
public abstract void onInitialize()This method will be called on initializing the factory. -
getContext
Get the dynamic context used by this factory.- Returns:
- The dynamic context used by this factory.
-
getAppWidgetId
public int getAppWidgetId()Get the app widget id used by this factory.- Returns:
- The app widget id used by this factory.
-
getAppWidgetType
public int getAppWidgetType()Get the app widget type used by this factory.- Returns:
- The app widget type used by this factory.
-
getWidth
public int getWidth()Returns the current width of the widget provider used for this factory.- Returns:
- The current width of the widget provider used for this factory.
-
setWidth
public void setWidth(int width) Sets the current width of the widget provider used for this factory.- Parameters:
width- The width to be set.
-
getHeight
public int getHeight()Returns the current height of the widget provider used for this factory.- Returns:
- The current height of the widget provider used for this factory.
-
setHeight
public void setHeight(int height) Sets the current height of the widget provider used for this factory.- Parameters:
height- The height to be set.
-
isAdjustPosition
public boolean isAdjustPosition()Checks whether to adjust position of the scrollable view.- Returns:
trueto adjust position of the scrollable view.
-
setAdjustPosition
public void setAdjustPosition(boolean adjustPosition) Sets the adjust position of the scrollable view for this factory.- Parameters:
adjustPosition-trueto adjust position of the scrollable view.
-
onDataSetChanged
- Specified by:
onDataSetChangedin interfaceRemoteViewsService.RemoteViewsFactory
-