Since: API level 20
public class

ShortcutItem

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

Class Overview

This class defines a custom items in the home screen shortcuts.

Since
API level 20
Version 2.7

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Constructors
ShortcutItem(int shortcutType, String name, Intent intent, String parent, int folderPos, int x, int y, int color, BitmapDrawable icon, int moreItems)
Class constructor.
ShortcutItem(int shortcutType, String name, Intent intent, String parentScreen, int x, int y, int moreItems)
This method is a constructor for App Shortcut to be added to a screen.
ShortcutItem(int shortcutType, String name, Intent intent, String parentFolder, int folderPos, int moreItems)
This method is a constructor for App Shortcut to be added to a folder.
ShortcutItem(int shortcutType, String name, Intent intent, String parentScreen, int x, int y, BitmapDrawable icon, int moreItems)
This method is a constructor for File Shortcut to be added to a screen.
ShortcutItem(int shortcutType, String name, Intent intent, String parentFolder, int folderPos, BitmapDrawable icon, int moreItems)
This method is a constructor for File Shortcut to be added to a folder.
ShortcutItem(int shortcutType, String name, String parentScreen, int x, int y, int color, int moreItems)
This method is a constructor for Folder Shortcut to be added to a screen.
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.
int getColour()
This method gets the Color, internal member assigned in the constructor.
int getFolderPosition()
This method gets the FolderPosition, internal member assigned in the constructor.
BitmapDrawable getIcon()
This method gets the Icon, internal member assigned in the constructor.
byte[] getIconArray()
This method gets the Icon as a byte array, 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 getName()
This method gets the Name, internal member assigned in the constructor.
String getParent()
This method gets the Parent, internal member assigned in the constructor.
int getShortcutType()
This method gets the ShortcutType, 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 ShortcutItem (int shortcutType, String name, Intent intent, String parent, int folderPos, int x, int y, int color, BitmapDrawable icon, int moreItems)

Since: API level 20

Class constructor.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_APP_TYPE
SHORTCUT_FILE_TYPE
SHORTCUT_FOLDER_TYPE
name Specifies name of shortcut to be added.
intent Specifies intent of shortcut to be added.
Note: This parameter is ignored for folder shortcuts.
parent Specifies screen or folder in which the shortcut will be added.
folderPos Specifies position within folder of shortcut or USE_DEFAULT.
x Specifies horizontal offset of shortcut location.
y Specifies vertical offset of shortcut location.
color Specifies color of shortcut location:
USE_DEFAULT
FOLDER_COLOUR_1
FOLDER_COLOUR_2
FOLDER_COLOUR_3
FOLDER_COLOUR_4
FOLDER_COLOUR_5
Note: This parameter is ignored for app and file shortcuts.
icon Specifies icon of shortcut to be added.
Note: This parameter is ignored for app and folder shortcuts.
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 int shortcutType = CustomDeviceManager.SHORTCUT_FOLDER_TYPE; // Shortcut for Folder
 String shortcutFolderName = "CustomFolder";
 int shortcut_X = 2;
 int shortcut_Y = 1;
 int folderColor = CustomDeviceManager.FOLDER_COLOUR_1;
 int moreItems = CustomDeviceManager.ON;
 ShortcutItem folderItem = new ShortcutItem(shortcutType,shortcutFolderName,
         null, kcsm.getParentScreen(3), 0, shortcut_X, shortcut_Y, folderColor, null, moreItems);
 shortcutType = CustomDeviceManager.SHORTCUT_APP_TYPE; // Shortcut for App
 String shortcutAppName = "CustomApp"; 
 int folderPos = 0;
 PackageManager pm = getPackageManager();
 Intent shortcutIntent = pm.getLaunchIntentForpackage(getPackageName());
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem appItem = new ShortcutItem(shortcutType,shortcutAppName,
         shortcutIntent, shortcutFolderName, folderPos, shortcut_X, shortcut_Y, CustomDeviceManager.USE_DEFAULT, 
         null, moreItems);
 
Since
API level 20
Version 2.7

public ShortcutItem (int shortcutType, String name, Intent intent, String parentScreen, int x, int y, int moreItems)

Since: API level 20

This method is a constructor for App Shortcut to be added to a screen.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_APP_TYPE
name Specifies name of shortcut to be added.
intent Specifies intent of shortcut to be added.
parentScreen Specifies screen in which the shortcut will be added.
x Specifies horizontal offset of shortcut location.
y Specifies vertical offset of shortcut location.
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 shortcutType = CustomDeviceManager.SHORTCUT_APP_TYPE; // Shortcut for App
 String shortcutAppName = "CustomApp"; 
 shortcut_X = 0;
 shortcut_Y = 0;
 PackageManager pm = getPackageManager();
 Intent shortcutIntent = pm.getLaunchIntentForpackage(getPackageName());
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem appScreenItem = new ShortcutItem(shortcutType,shortcutAppName,
         shortcutIntent, kcsm.getParentScreen(3), shortcut_X, shortcut_Y,  moreItems);
 
Since
API level 20
Version 2.7

public ShortcutItem (int shortcutType, String name, Intent intent, String parentFolder, int folderPos, int moreItems)

Since: API level 20

This method is a constructor for App Shortcut to be added to a folder.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_APP_TYPE
name Specifies name of shortcut to be added.
intent Specifies intent of shortcut to be added.
parentFolder Specifies folder in which the shortcut will be added.
folderPos Specifies position within folder of shortcut or USE_DEFAULT.
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 shortcutType = CustomDeviceManager.SHORTCUT_APP_TYPE; // Shortcut for App
 String shortcutAppName = "CustomApp";
 String shortcutFolderName = "CustomFolder";
 int folderPosition = CustomDeviceManager.USE_DEFAULT;
 PackageManager pm = getPackageManager();
 Intent shortcutIntent = pm.getLaunchIntentForpackage(getPackageName());
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem appFolderItem = new ShortcutItem(shortcutType,shortcutAppName,
         shortcutIntent, shortcutFolderName, folderPosition,  moreItems);
 
Since
API level 20
Version 2.7

public ShortcutItem (int shortcutType, String name, Intent intent, String parentScreen, int x, int y, BitmapDrawable icon, int moreItems)

Since: API level 20

This method is a constructor for File Shortcut to be added to a screen.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_FILE_TYPE or
name Specifies name of shortcut to be added.
intent Specifies intent of shortcut to be added.
parentScreen Specifies screen in which the shortcut will be added.
x Specifies horizontal offset of shortcut location.
y Specifies vertical offset of shortcut location.
icon Specifies icon of shortcut to be added.
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 shortcutType = CustomDeviceManager.SHORTCUT_FILE_TYPE; // Shortcut for File
 String shortcutFileName = "CustomFile"; 
 shortcut_X = 0;
 shortcut_Y = 0;
 String filePath = "/storage/emulated/0/Samsung/Music/Over the Horizon.mp3";
 File f = new File(filePath);
 Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
 MimeTypeMap mime = MimeTypeMap.getSingleton();
 String mimeType = mime.getMimeTypeFromExtension("mp3");
 shortcutIntent.setDataAndType(Uri.fromFile(f), mimeType);
 BitmapDrawable icon = getResources().getDrawable("com.test.app");
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem fileScreenItem = new ShortcutItem(shortcutType,shortcutFileName,
         shortcutIntent, kcsm.getParentScreen(3), shortcut_X, shortcut_Y, icon, moreItems);
 
Since
API level 20
Version 2.7

public ShortcutItem (int shortcutType, String name, Intent intent, String parentFolder, int folderPos, BitmapDrawable icon, int moreItems)

Since: API level 20

This method is a constructor for File Shortcut to be added to a folder.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_FILE_TYPE
name Specifies name of shortcut to be added.
intent Specifies intent of shortcut to be added.
parentFolder Specifies folder in which the shortcut will be added.
folderPos Specifies position within folder of shortcut or USE_DEFAULT.
icon Specifies icon of shortcut to be added.
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 shortcutType = CustomDeviceManager.SHORTCUT_FILE_TYPE; // Shortcut for File
 String shortcutFileName = "CustomFile";
 String shortcutFolderName = "CustomFolder";
 int folderPosition = 0;
 String filePath = "/storage/emulated/0/Samsung/Music/Over the Horizon.mp3";
 File f = new File(filePath);
 Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
 MimeTypeMap mime = MimeTypeMap.getSingleton();
 String mimeType = mime.getMimeTypeFromExtension("mp3");
 shortcutIntent.setDataAndType(Uri.fromFile(f), mimeType);
 BitmapDrawable icon = getResources().getDrawable("com.test.app");
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem fileFolderItem = new ShortcutItem(shortcutType,shortcutFileName,
         shortcutIntent, shortcutFolderName, folderPosition, icon,  moreItems);
 
Since
API level 20
Version 2.7

public ShortcutItem (int shortcutType, String name, String parentScreen, int x, int y, int color, int moreItems)

Since: API level 20

This method is a constructor for Folder Shortcut to be added to a screen.

Parameters
shortcutType Specifies type of shortcut to be added:
SHORTCUT_FOLDER_TYPE
name Specifies name of shortcut to be added.
parentScreen Specifies screen in which the shortcut will be added.
x Specifies horizontal offset of shortcut location.
y Specifies vertical offset of shortcut location.
color Specifies color of shortcut location:
USE_DEFAULT
FOLDER_COLOUR_1
FOLDER_COLOUR_2
FOLDER_COLOUR_3
FOLDER_COLOUR_4
FOLDER_COLOUR_5
moreItems Specifies if there are more shortcuts to be added
ON or
OFF.
Note: This parameter should be set to ON whilst the shortcuts
are being added and set to OFF for the final shortcut.
Usage
 shortcutType = CustomDeviceManager.SHORTCUT_FOLDER_TYPE; // Shortcut for Folder
 String shortcutFolderName = "CustomFolder";
 shortcut_X = 0;
 shortcut_Y = 0;
 int folderColor = CustomDeviceManager.FOLDER_COLOUR_1;
 moreItems = CustomDeviceManager.OFF;
 ShortcutItem folderScreenItem = new ShortcutItem(shortcutType,shortcutFolderName,
         kcsm.getParentScreen(3), shortcut_X, shortcut_Y, folderColor, 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 int getColour ()

Since: API level 20

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

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

public int getFolderPosition ()

Since: API level 20

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

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

public BitmapDrawable getIcon ()

Since: API level 20

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

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

public byte[] getIconArray ()

Since: API level 20

This method gets the Icon as a byte array, internal member assigned in the constructor.

Returns
  • Icon assigned in the constructor as byte array.
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 getName ()

Since: API level 20

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

Returns
  • Text string 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 getShortcutType ()

Since: API level 20

This method gets the ShortcutType, 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