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
-
Constructor Summary
ConstructorDescriptionDynamicRemoteViewsFactory
(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 TypeMethodDescriptionint
Get the app widget id used by this factory.int
Get the app widget type used by this factory.Get the dynamic context used by this factory.int
Returns the current height of the widget provider used for this factory.int
getWidth()
Returns the current width of the widget provider used for this factory.boolean
Checks whether to adjust position of the scrollable view.void
abstract void
This method will be called on initializing the factory.void
setAdjustPosition
(boolean adjustPosition) Sets the adjust position of the scrollable view for this factory.void
setHeight
(int height) Sets the current height of the widget provider used for this factory.void
setWidth
(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, wait
Methods 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
-true
to 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:
true
to 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
-true
to adjust position of the scrollable view.
-
onDataSetChanged
- Specified by:
onDataSetChanged
in interfaceRemoteViewsService.RemoteViewsFactory
-