ApplicationInfopublic class ApplicationInfo extends ItemInfo Represents a launchable application. An application is made of a name (or title),
an intent and an icon. |
Fields Summary |
---|
CharSequence | titleThe application name. | android.content.Intent | intentThe intent used to start the application. | android.graphics.drawable.Drawable | iconThe application icon. | boolean | filteredWhen set to true, indicates that the icon has been resized. | boolean | customIconIndicates whether the icon comes from an application's resource (if false)
or from a custom Bitmap (if true.) | Intent.ShortcutIconResource | iconResourceIf isShortcut=true and customIcon=false, this contains a reference to the
shortcut icon as an application's resource. |
Constructors Summary |
---|
ApplicationInfo()
itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
| public ApplicationInfo(ApplicationInfo info)
super(info);
title = info.title.toString();
intent = new Intent(info.intent);
if (info.iconResource != null) {
iconResource = new Intent.ShortcutIconResource();
iconResource.packageName = info.iconResource.packageName;
iconResource.resourceName = info.iconResource.resourceName;
}
icon = info.icon;
filtered = info.filtered;
customIcon = info.customIcon;
|
Methods Summary |
---|
void | onAddToDatabase(android.content.ContentValues values)
super.onAddToDatabase(values);
String titleStr = title != null ? title.toString() : null;
values.put(LauncherSettings.Favorites.TITLE, titleStr);
String uri = intent != null ? intent.toURI() : null;
values.put(LauncherSettings.Favorites.INTENT, uri);
if (customIcon) {
values.put(LauncherSettings.Favorites.ICON_TYPE,
LauncherSettings.Favorites.ICON_TYPE_BITMAP);
Bitmap bitmap = ((FastBitmapDrawable) icon).getBitmap();
writeBitmap(values, bitmap);
} else {
values.put(LauncherSettings.Favorites.ICON_TYPE,
LauncherSettings.Favorites.ICON_TYPE_RESOURCE);
if (iconResource != null) {
values.put(LauncherSettings.Favorites.ICON_PACKAGE, iconResource.packageName);
values.put(LauncherSettings.Favorites.ICON_RESOURCE, iconResource.resourceName);
}
}
| final void | setActivity(android.content.ComponentName className, int launchFlags)Creates the application intent based on a component name and various launch flags.
Sets {@link #itemType} to {@link LauncherSettings.Favorites#ITEM_TYPE_APPLICATION}.
intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(className);
intent.setFlags(launchFlags);
itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
| public java.lang.String | toString()
return title.toString();
|
|