Since: API level 20
public class

WidgetItem

extends Object
implements Parcelable
java.lang.Object
   ↳ com.samsung.android.knox.custom.WidgetItem

Class Overview

This class defines a custom widget item in the home screen shortcuts.

Since
API level 20
Version 2.7

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Constructors
WidgetItem(int widgetType, Intent intent, int widgetId, String parent, int x, int y, int sizeX, int sizeY, int moreItems)
Class constructor.
Public Methods
int describeContents()
Not implemented.
int getCellX()
This method gets the CellX, internal member assigned in the constructor.
int getCellY()
This method gets the CellY, internal member assigned in the constructor.
Intent getIntent()
This method gets the Intent, internal member assigned in the constructor.
int getMoreItems()
This method gets the MoreItems, internal member assigned in the constructor.
String getParent()
This method gets the Parent, internal member assigned in the constructor.
int getSizeX()
This method gets the SizeX, internal member assigned in the constructor.
int getSizeY()
This method gets the SizeY, internal member assigned in the constructor.
int getWidgetId()
This method gets the WidgetId, internal member assigned in the constructor.
int getWidgetType()
This method gets the WidgetType, internal member assigned in the constructor.
String toString()
This method returns the string representation of this class instance.
void writeToParcel(Parcel out, int flags)
This method flatten this object in to a Parcel (out).
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Public Constructors

public WidgetItem (int widgetType, Intent intent, int widgetId, String parent, int x, int y, int sizeX, int sizeY, int moreItems)

Since: API level 20

Class constructor.

Parameters
widgetType Specifies type of widget to be added:
WIDGET_APP_TYPE or
WIDGET_SURFACE_TYPE.
intent Specifies intent of widget.
widgetId Specifies ID of widget or USE_DEFAULT for system default value.
parent Specifies screen in which the widget will be added.
x Specifies horizontal offset of widget location.
y Specifies vertical offset of widget location.
sizeX Specifies horizontal size of widget.
sizeY Specifies vertical size of widget.
moreItems Specifies if there are more widgets to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the widgets
are being added and set to OFF for the final widget.
Usage
 int widgetType = CustomDeviceManager.WIDGET_APP_TYPE; // Adding widget
 int widget_X = 0;
 int widget_Y = 1;
 int widget_SizeX = 4;
 int widget_SizeY = 1;
 int widgetId = CustomDeviceManager.USE_DEFAULT;
 moreItems = CustomDeviceManager.OFF;
 String widgetPackage = "com.example.widget";
 String widgetProvider = ".WidgetProvider";
 ComponentName widgetProvider = new ComponentName(widgetPackage, widgetProvider);
 Intent widgetIntent = new Intent();
 widgetIntent.setComponent(widgetProvider);
 WidgetItem widgetItem = new WidgetItem(widgetType, widgetIntent,
         widgetId, kcsm.getParentScreen(3), widget_X, widget_Y, widget_SizeX, widget_SizeY, moreItems);
 
Since
API level 20
Version 2.7

Public Methods

public int describeContents ()

Since: API level 20

Not implemented.

Returns
  • Always 0.
Since
API level 20
Version 2.7

public int getCellX ()

Since: API level 20

This method gets the CellX, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public int getCellY ()

Since: API level 20

This method gets the CellY, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public Intent getIntent ()

Since: API level 20

This method gets the Intent, internal member assigned in the constructor.

Returns
  • Intent assigned in the constructor.
Since
API level 20
Version 2.7

public int getMoreItems ()

Since: API level 20

This method gets the MoreItems, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public String getParent ()

Since: API level 20

This method gets the Parent, internal member assigned in the constructor.

Returns
  • Text string assigned in the constructor.
Since
API level 20
Version 2.7

public int getSizeX ()

Since: API level 20

This method gets the SizeX, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public int getSizeY ()

Since: API level 20

This method gets the SizeY, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public int getWidgetId ()

Since: API level 20

This method gets the WidgetId, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public int getWidgetType ()

Since: API level 20

This method gets the WidgetType, internal member assigned in the constructor.

Returns
  • Id assigned in the constructor.
Since
API level 20
Version 2.7

public String toString ()

Since: API level

This method returns the string representation of this class instance.

Returns
  • String representation of this class instance.
Since
API level 20
Version 2.7

public void writeToParcel (Parcel out, int flags)

Since: API level 20

This method flatten this object in to a Parcel (out).

Parameters
out The parcel where the data is written.
flags Not used.
Since
API level 20
Version 2.7