Example usage for android.provider LiveFolders EXTRA_LIVE_FOLDER_DISPLAY_MODE

List of usage examples for android.provider LiveFolders EXTRA_LIVE_FOLDER_DISPLAY_MODE

Introduction

In this page you can find the example usage for android.provider LiveFolders EXTRA_LIVE_FOLDER_DISPLAY_MODE.

Prototype

String EXTRA_LIVE_FOLDER_DISPLAY_MODE

To view the source code for android.provider LiveFolders EXTRA_LIVE_FOLDER_DISPLAY_MODE.

Click Source Link

Document

The name of the extra used to define the display mode of a live folder.

Usage

From source file:com.cognizant.trumobi.PersonaLauncher.java

static PersonaLiveFolderInfo addLiveFolder(Context context, Intent data, PersonaCellLayout.CellInfo cellInfo,
        boolean notify) {

    Intent baseIntent = data.getParcelableExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT);
    String name = data.getStringExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME);

    Drawable icon = null;//from  www .j  a  va2 s  .  co m
    boolean filtered = false;
    Intent.ShortcutIconResource iconResource = null;

    Parcelable extra = data.getParcelableExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON);
    if (extra != null && extra instanceof Intent.ShortcutIconResource) {
        try {
            iconResource = (Intent.ShortcutIconResource) extra;
            final PackageManager packageManager = context.getPackageManager();
            Resources resources = packageManager.getResourcesForApplication(iconResource.packageName);
            final int id = resources.getIdentifier(iconResource.resourceName, null, null);
            icon = resources.getDrawable(id);
        } catch (Exception e) {
            PersonaLog.w(LOG_TAG, "Could not load live folder icon: " + extra);
        }
    }

    if (icon == null) {
        icon = context.getResources().getDrawable(R.drawable.pr_ic_launcher_folder);
    }

    final PersonaLiveFolderInfo info = new PersonaLiveFolderInfo();
    info.icon = icon;
    info.filtered = filtered;
    info.title = name;
    info.iconResource = iconResource;
    info.uri = data.getData();
    info.baseIntent = baseIntent;
    info.displayMode = data.getIntExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE,
            LiveFolders.DISPLAY_MODE_GRID);

    PersonaLauncherModel.addItemToDatabase(context, info, PersonaLauncherSettings.Favorites.CONTAINER_DESKTOP,
            cellInfo.screen, cellInfo.cellX, cellInfo.cellY, notify);
    sModel.addFolder(info);

    return info;
}