Example usage for android.content.res Resources getDrawable

List of usage examples for android.content.res Resources getDrawable

Introduction

In this page you can find the example usage for android.content.res Resources getDrawable.

Prototype

@Deprecated
public Drawable getDrawable(@DrawableRes int id) throws NotFoundException 

Source Link

Document

Return a drawable object associated with a particular resource ID.

Usage

From source file:com.cyou.poplauncher.Workspace.java

/**
 * Initializes various states for this workspace.
 *//*w  w  w. ja v a2  s .co m*/
protected void initWorkspace() {
    Context context = getContext();
    mCurrentPage = mDefaultPage;
    Launcher.setScreen(mCurrentPage);
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    mIconCache = app.getIconCache();
    setWillNotDraw(false);
    setClipChildren(false);
    setClipToPadding(false);
    setChildrenDrawnWithCacheEnabled(true);

    setMinScale(mOverviewModeShrinkFactor);
    setupLayoutTransition();

    final Resources res = getResources();
    try {
        mBackground = res.getDrawable(R.drawable.apps_customize_bg);
    } catch (Resources.NotFoundException e) {
        // In this case, we will skip drawing background protection
    }

    mWallpaperOffset = new WallpaperOffsetInterpolator();
    Display display = mLauncher.getWindowManager().getDefaultDisplay();
    display.getSize(mDisplaySize);

    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);

    // Set the wallpaper dimensions when Launcher starts up
    setWallpaperDimension();
}

From source file:com.auratech.launcher.Workspace.java

/**
 * Initializes various states for this workspace.
 *///from  w w w  .  j  a  v a2  s  .  c  o  m
protected void initWorkspace() {
    Context context = getContext();
    mCurrentPage = mDefaultPage;
    Launcher.setScreen(mCurrentPage);
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    mIconCache = app.getIconCache();
    mPageViewAnimation = app.getPageAnimation();
    setWillNotDraw(false);
    setClipChildren(false);
    setClipToPadding(false);
    setChildrenDrawnWithCacheEnabled(true);

    setMinScale(mOverviewModeShrinkFactor);
    setupLayoutTransition();

    final Resources res = getResources();
    try {
        mBackground = res.getDrawable(R.drawable.apps_customize_bg);
    } catch (Resources.NotFoundException e) {
        // In this case, we will skip drawing background protection
    }

    mWallpaperOffset = new WallpaperOffsetInterpolator();
    Display display = mLauncher.getWindowManager().getDefaultDisplay();
    display.getSize(mDisplaySize);

    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);

    // Set the wallpaper dimensions when Launcher starts up
    setWallpaperDimension();
}

From source file:org.openintents.notepad.NoteEditor.java

private boolean setRemoteStyle(String styleName, int size) {
    if (TextUtils.isEmpty(styleName)) {
        if (DEBUG) {
            Log.e(TAG, "Empty style name: " + styleName);
        }//from   w  ww.ja v  a  2  s.  c o m
        return false;
    }

    PackageManager pm = getPackageManager();

    String packageName = ThemeUtils.getPackageNameFromStyle(styleName);

    if (packageName == null) {
        Log.e(TAG, "Invalid style name: " + styleName);
        return false;
    }

    Context c = null;
    try {
        c = createPackageContext(packageName, 0);
    } catch (NameNotFoundException e) {
        Log.e(TAG, "Package for style not found: " + packageName + ", " + styleName);
        return false;
    }

    Resources res = c.getResources();

    int themeid = res.getIdentifier(styleName, null, null);
    if (DEBUG) {
        Log.d(TAG, "Retrieving theme: " + styleName + ", " + themeid);
    }

    if (themeid == 0) {
        Log.e(TAG, "Theme name not found: " + styleName);
        return false;
    }

    try {
        ThemeAttributes ta = new ThemeAttributes(c, packageName, themeid);

        mTextTypeface = ta.getString(ThemeNotepad.TEXT_TYPEFACE);
        if (DEBUG) {
            Log.d(TAG, "textTypeface: " + mTextTypeface);
        }

        mCurrentTypeface = null;

        // Look for special cases:
        if ("monospace".equals(mTextTypeface)) {
            mCurrentTypeface = Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL);
        } else if ("sans".equals(mTextTypeface)) {
            mCurrentTypeface = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL);
        } else if ("serif".equals(mTextTypeface)) {
            mCurrentTypeface = Typeface.create(Typeface.SERIF, Typeface.NORMAL);
        } else if (!TextUtils.isEmpty(mTextTypeface)) {

            try {
                if (DEBUG) {
                    Log.d(TAG, "Reading typeface: package: " + packageName + ", typeface: " + mTextTypeface);
                }
                Resources remoteRes = pm.getResourcesForApplication(packageName);
                mCurrentTypeface = Typeface.createFromAsset(remoteRes.getAssets(), mTextTypeface);
                if (DEBUG) {
                    Log.d(TAG, "Result: " + mCurrentTypeface);
                }
            } catch (NameNotFoundException e) {
                Log.e(TAG, "Package not found for Typeface", e);
            }
        }

        mTextUpperCaseFont = ta.getBoolean(ThemeNotepad.TEXT_UPPER_CASE_FONT, false);

        mTextColor = ta.getColor(ThemeNotepad.TEXT_COLOR, android.R.color.white);

        if (DEBUG) {
            Log.d(TAG, "textColor: " + mTextColor);
        }

        if (size == 0) {
            mTextSize = getTextSizeTiny(ta);
        } else if (size == 1) {
            mTextSize = getTextSizeSmall(ta);
        } else if (size == 2) {
            mTextSize = getTextSizeMedium(ta);
        } else {
            mTextSize = getTextSizeLarge(ta);
        }
        if (DEBUG) {
            Log.d(TAG, "textSize: " + mTextSize);
        }

        if (mText != null) {
            mBackgroundPadding = ta.getDimensionPixelOffset(ThemeNotepad.BACKGROUND_PADDING, -1);
            int backgroundPaddingLeft = ta.getDimensionPixelOffset(ThemeNotepad.BACKGROUND_PADDING_LEFT,
                    mBackgroundPadding);
            int backgroundPaddingTop = ta.getDimensionPixelOffset(ThemeNotepad.BACKGROUND_PADDING_TOP,
                    mBackgroundPadding);
            int backgroundPaddingRight = ta.getDimensionPixelOffset(ThemeNotepad.BACKGROUND_PADDING_RIGHT,
                    mBackgroundPadding);
            int backgroundPaddingBottom = ta.getDimensionPixelOffset(ThemeNotepad.BACKGROUND_PADDING_BOTTOM,
                    mBackgroundPadding);

            if (DEBUG) {
                Log.d(TAG,
                        "Padding: " + mBackgroundPadding + "; " + backgroundPaddingLeft + "; "
                                + backgroundPaddingTop + "; " + backgroundPaddingRight + "; "
                                + backgroundPaddingBottom + "; ");
            }

            try {
                Resources remoteRes = pm.getResourcesForApplication(packageName);
                int resid = ta.getResourceId(ThemeNotepad.BACKGROUND, 0);
                if (resid != 0) {
                    Drawable d = remoteRes.getDrawable(resid);
                    mText.setBackgroundDrawable(d);
                } else {
                    // remove background
                    mText.setBackgroundResource(0);
                }
            } catch (NameNotFoundException e) {
                Log.e(TAG, "Package not found for Theme background.", e);
            } catch (Resources.NotFoundException e) {
                Log.e(TAG, "Resource not found for Theme background.", e);
            }

            // Apply padding
            if (mBackgroundPadding >= 0 || backgroundPaddingLeft >= 0 || backgroundPaddingTop >= 0
                    || backgroundPaddingRight >= 0 || backgroundPaddingBottom >= 0) {
                mText.setPadding(backgroundPaddingLeft, backgroundPaddingTop, backgroundPaddingRight,
                        backgroundPaddingBottom);
            } else {
                // 9-patches do the padding automatically
                // todo clear padding
            }
        }

        mLinesMode = ta.getInteger(ThemeNotepad.LINE_MODE, 2);
        mLinesColor = ta.getColor(ThemeNotepad.LINE_COLOR, 0xFF000080);

        if (DEBUG) {
            Log.d(TAG, "line color: " + mLinesColor);
        }

        return true;

    } catch (UnsupportedOperationException e) {
        // This exception is thrown e.g. if one attempts
        // to read an integer attribute as dimension.
        Log.e(TAG, "UnsupportedOperationException", e);
        return false;
    } catch (NumberFormatException e) {
        // This exception is thrown e.g. if one attempts
        // to read a string as integer.
        Log.e(TAG, "NumberFormatException", e);
        return false;
    }
}

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

/**
 * ADW: Load the specified theme resource
 * /*from w ww  . j a  v a  2s.  c o m*/
 * @param themeResources
 *            Resources from the theme package
 * @param themePackage
 *            the theme's package name
 * @param item_name
 *            the theme item name to load
 * @param item
 *            the View Item to apply the theme into
 * @param themeType
 *            Specify if the themed element will be a background or a
 *            foreground item
 */
public static void loadThemeResource(Resources themeResources, String themePackage, String item_name, View item,
        int themeType) {
    Drawable d = null;
    if (themeResources != null) {
        int resource_id = themeResources.getIdentifier(item_name, "drawable", themePackage);
        if (resource_id != 0) {
            try {
                d = themeResources.getDrawable(resource_id);
            } catch (Resources.NotFoundException e) {
                return;
            }
            if (themeType == THEME_ITEM_FOREGROUND && item instanceof ImageView) {
                // ADW remove the old drawable
                Drawable tmp = ((ImageView) item).getDrawable();
                if (tmp != null) {
                    tmp.setCallback(null);
                    tmp = null;
                }
                ((ImageView) item).setImageDrawable(d);
            } else {
                // ADW remove the old drawable
                Drawable tmp = item.getBackground();
                if (tmp != null) {
                    tmp.setCallback(null);
                    tmp = null;
                }
                item.setBackgroundDrawable(d);
            }
        }
    }
}

From source file:com.phonemetra.turbo.launcher.Workspace.java

/**
 * Initializes various states for this workspace.
 *//*from  w  w w. j  ava 2s .co  m*/
protected void initWorkspace() {
    Context context = getContext();
    mCurrentPage = mDefaultPage;
    Launcher.setScreen(mCurrentPage);
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    mIconCache = app.getIconCache();
    setWillNotDraw(false);
    setClipChildren(false);
    setClipToPadding(false);
    setChildrenDrawnWithCacheEnabled(true);

    setMinScale(mOverviewModeShrinkFactor);
    setupLayoutTransition();

    final Resources res = getResources();
    try {
        mBackground = res.getDrawable(R.drawable.apps_customize_bg);
    } catch (Resources.NotFoundException e) {

    }

    mWallpaperOffset = new WallpaperOffsetInterpolator();
    Display display = mLauncher.getWindowManager().getDefaultDisplay();
    display.getSize(mDisplaySize);

    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);

    // Set the wallpaper dimensions when Launcher starts up
    setWallpaperDimension();
}

From source file:com.wb.launcher3.Workspace.java

/**
 * Initializes various states for this workspace.
 *///from www  . j  ava 2 s .  c o  m
protected void initWorkspace() {
    Context context = getContext();
    //*/Modified by tyd Greg 2014-04-03,for set default page
    mOriginalDefaultPage = mDefaultPage = readDefaultPage();
    //*/
    mCurrentPage = mDefaultPage;
    Launcher.setScreen(mCurrentPage);
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    mIconCache = app.getIconCache();
    setWillNotDraw(false);
    setClipChildren(false);
    setClipToPadding(false);
    setChildrenDrawnWithCacheEnabled(true);

    // This is a bit of a hack to account for the fact that we translate the workspace
    // up a bit, and still need to draw the background covering the whole screen.
    setMinScale(mOverviewModeShrinkFactor - 0.2f);
    setupLayoutTransition();

    final Resources res = getResources();
    try {
        mBackground = res.getDrawable(R.drawable.apps_customize_bg);
    } catch (Resources.NotFoundException e) {
        // In this case, we will skip drawing background protection
    }

    mWallpaperOffset = new WallpaperOffsetInterpolator();
    Display display = mLauncher.getWindowManager().getDefaultDisplay();
    display.getSize(mDisplaySize);

    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
}

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

private void completeEditShirtcut(Intent data) {
    if (!data.hasExtra(PersonaCustomShirtcutActivity.EXTRA_APPLICATIONINFO))
        return;//from w w w. jav a  2s  .c om
    long appInfoId = data.getLongExtra(PersonaCustomShirtcutActivity.EXTRA_APPLICATIONINFO, 0);
    PersonaApplicationInfo info = PersonaLauncherModel.loadApplicationInfoById(this, appInfoId);
    if (info != null) {
        Bitmap bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);

        Drawable icon = null;
        boolean customIcon = false;
        ShortcutIconResource iconResource = null;

        if (bitmap != null) {
            icon = new PersonaFastBitmapDrawable(PersonaUtilities.createBitmapThumbnail(bitmap, this));
            customIcon = true;
        } else {
            Parcelable extra = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
            if (extra != null && extra instanceof ShortcutIconResource) {
                try {
                    iconResource = (ShortcutIconResource) extra;
                    final PackageManager packageManager = 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 shortcut icon: " + extra);
                }
            }
        }

        if (icon != null) {
            info.icon = icon;
            info.customIcon = customIcon;
            info.iconResource = iconResource;
        }
        info.itemType = PersonaLauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
        info.title = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
        info.intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
        PersonaLauncherModel.updateItemInDatabase(this, info);

        if (info.container == PersonaLauncherSettings.Favorites.CONTAINER_MAB)
            mHandleView.UpdateLaunchInfo(info);
        else if (info.container == PersonaLauncherSettings.Favorites.CONTAINER_LAB)
            mLAB.UpdateLaunchInfo(info);
        else if (info.container == PersonaLauncherSettings.Favorites.CONTAINER_LAB2)
            mLAB2.UpdateLaunchInfo(info);
        else if (info.container == PersonaLauncherSettings.Favorites.CONTAINER_RAB)
            mRAB.UpdateLaunchInfo(info);
        else if (info.container == PersonaLauncherSettings.Favorites.CONTAINER_RAB2)
            mRAB2.UpdateLaunchInfo(info);

        mWorkspace.updateShortcutFromApplicationInfo(info);
    }
}

From source file:com.androzic.MapActivity.java

/** Called when the activity is first created. */
@SuppressLint("ShowToast")
@Override// ww  w .  j  a v a 2s .  co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.e(TAG, "onCreate()");

    ready = false;
    isFullscreen = false;

    backToast = Toast.makeText(this, R.string.backQuit, Toast.LENGTH_SHORT);
    finishHandler = new FinishHandler(this);

    application = (Androzic) getApplication();

    // FIXME Should find a better place for this
    application.mapObjectsOverlay = new MapObjectsOverlay(this);

    // check if called after crash
    if (!application.mapsInited) {
        restarting = true;
        startActivity(new Intent(this, Splash.class)
                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
                .putExtras(getIntent()));
        finish();
        return;
    }

    application.setMapActivity(this);

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    setRequestedOrientation(Integer.parseInt(settings.getString(getString(R.string.pref_orientation), "-1")));
    settings.registerOnSharedPreferenceChangeListener(this);
    Resources resources = getResources();

    if (settings.getBoolean(getString(R.string.pref_hideactionbar),
            resources.getBoolean(R.bool.def_hideactionbar))) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    }

    panelActions = getResources().getStringArray(R.array.panel_action_values);

    setContentView(R.layout.act_main);
    coordinates = (TextView) findViewById(R.id.coordinates);
    satInfo = (TextView) findViewById(R.id.sats);
    currentFile = (TextView) findViewById(R.id.currentfile);
    mapZoom = (TextView) findViewById(R.id.currentzoom);
    waypointName = (TextView) findViewById(R.id.waypointname);
    waypointExtra = (TextView) findViewById(R.id.waypointextra);
    routeName = (TextView) findViewById(R.id.routename);
    routeExtra = (TextView) findViewById(R.id.routeextra);
    speedValue = (TextView) findViewById(R.id.speed);
    speedUnit = (TextView) findViewById(R.id.speedunit);
    trackValue = (TextView) findViewById(R.id.track);
    trackUnit = (TextView) findViewById(R.id.trackunit);
    elevationValue = (TextView) findViewById(R.id.elevation);
    elevationUnit = (TextView) findViewById(R.id.elevationunit);
    distanceValue = (TextView) findViewById(R.id.distance);
    distanceUnit = (TextView) findViewById(R.id.distanceunit);
    xtkValue = (TextView) findViewById(R.id.xtk);
    xtkUnit = (TextView) findViewById(R.id.xtkunit);
    bearingValue = (TextView) findViewById(R.id.bearing);
    bearingUnit = (TextView) findViewById(R.id.bearingunit);
    turnValue = (TextView) findViewById(R.id.turn);
    trackBar = (SeekBar) findViewById(R.id.trackbar);
    waitBar = (TextView) findViewById(R.id.waitbar);
    map = (MapView) findViewById(R.id.mapview);

    // set button actions
    findViewById(R.id.zoomin).setOnClickListener(this);
    findViewById(R.id.zoomout).setOnClickListener(this);
    findViewById(R.id.nextmap).setOnClickListener(this);
    findViewById(R.id.prevmap).setOnClickListener(this);
    findViewById(R.id.maps).setOnClickListener(this);
    findViewById(R.id.waypoints).setOnClickListener(this);
    findViewById(R.id.info).setOnClickListener(this);
    findViewById(R.id.follow).setOnClickListener(this);
    findViewById(R.id.locate).setOnClickListener(this);
    findViewById(R.id.tracking).setOnClickListener(this);
    findViewById(R.id.expand).setOnClickListener(this);
    findViewById(R.id.finishedit).setOnClickListener(this);
    findViewById(R.id.addpoint).setOnClickListener(this);
    findViewById(R.id.insertpoint).setOnClickListener(this);
    findViewById(R.id.removepoint).setOnClickListener(this);
    findViewById(R.id.orderpoints).setOnClickListener(this);
    findViewById(R.id.finishtrackedit).setOnClickListener(this);
    findViewById(R.id.cutafter).setOnClickListener(this);
    findViewById(R.id.cutbefore).setOnClickListener(this);

    Panel panel = (Panel) findViewById(R.id.panel);
    panel.setOnPanelListener(this);
    panel.setInterpolator(new ExpoInterpolator(Type.OUT));

    wptQuickAction = new QuickAction3D(this, QuickAction3D.VERTICAL);
    wptQuickAction.addActionItem(new ActionItem(qaAddWaypointToRoute, getString(R.string.menu_addtoroute),
            resources.getDrawable(R.drawable.ic_action_add)));
    wptQuickAction.setOnActionItemClickListener(waypointActionItemClickListener);

    rteQuickAction = new QuickAction3D(this, QuickAction3D.VERTICAL);
    rteQuickAction.addActionItem(new ActionItem(qaNavigateToWaypoint, getString(R.string.menu_thisnavpoint),
            resources.getDrawable(R.drawable.ic_action_directions)));
    rteQuickAction.setOnActionItemClickListener(routeActionItemClickListener);

    mobQuickAction = new QuickAction3D(this, QuickAction3D.VERTICAL);
    mobQuickAction.addActionItem(new ActionItem(qaNavigateToMapObject, getString(R.string.menu_navigate),
            resources.getDrawable(R.drawable.ic_action_directions)));
    mobQuickAction.setOnActionItemClickListener(mapObjectActionItemClickListener);

    trackBar.setOnSeekBarChangeListener(this);

    map.initialize(application);

    dimView = new RelativeLayout(this);

    String navWpt = settings.getString(getString(R.string.nav_wpt), "");
    if (!"".equals(navWpt) && savedInstanceState == null) {
        Intent intent = new Intent(getApplicationContext(), NavigationService.class)
                .setAction(NavigationService.NAVIGATE_MAPOBJECT);
        intent.putExtra(NavigationService.EXTRA_NAME, navWpt);
        intent.putExtra(NavigationService.EXTRA_LATITUDE,
                (double) settings.getFloat(getString(R.string.nav_wpt_lat), 0));
        intent.putExtra(NavigationService.EXTRA_LONGITUDE,
                (double) settings.getFloat(getString(R.string.nav_wpt_lon), 0));
        intent.putExtra(NavigationService.EXTRA_PROXIMITY, settings.getInt(getString(R.string.nav_wpt_prx), 0));
        startService(intent);
    }

    String navRoute = settings.getString(getString(R.string.nav_route), "");
    if (!"".equals(navRoute) && settings.getBoolean(getString(R.string.pref_navigation_loadlast),
            getResources().getBoolean(R.bool.def_navigation_loadlast)) && savedInstanceState == null) {
        int ndir = settings.getInt(getString(R.string.nav_route_dir), 0);
        int nwpt = settings.getInt(getString(R.string.nav_route_wpt), -1);
        try {
            int rt = -1;
            Route route = application.getRouteByFile(navRoute);
            if (route != null) {
                route.show = true;
                rt = application.getRouteIndex(route);
            } else {
                File rtf = new File(navRoute);
                // FIXME It's bad - it can be not a first route in a file
                route = OziExplorerFiles.loadRoutesFromFile(rtf, application.charset).get(0);
                rt = application.addRoute(route);
            }
            RouteOverlay newRoute = new RouteOverlay(this, route);
            application.routeOverlays.add(newRoute);
            startService(new Intent(this, NavigationService.class).setAction(NavigationService.NAVIGATE_ROUTE)
                    .putExtra(NavigationService.EXTRA_ROUTE_INDEX, rt)
                    .putExtra(NavigationService.EXTRA_ROUTE_DIRECTION, ndir)
                    .putExtra(NavigationService.EXTRA_ROUTE_START, nwpt));
        } catch (Exception e) {
            Log.e(TAG, "Failed to start navigation", e);
        }
    }

    // set activity preferences
    onSharedPreferenceChanged(settings, getString(R.string.pref_exit));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitprecision));
    // set map preferences
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapadjacent));
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapcropborder));
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapdrawborder));
    onSharedPreferenceChanged(settings, getString(R.string.pref_cursorcolor));
    onSharedPreferenceChanged(settings, getString(R.string.pref_grid_mapshow));
    onSharedPreferenceChanged(settings, getString(R.string.pref_grid_usershow));
    onSharedPreferenceChanged(settings, getString(R.string.pref_grid_preference));
    onSharedPreferenceChanged(settings, getString(R.string.pref_panelactions));

    if (getIntent().getExtras() != null)
        onNewIntent(getIntent());

    ready = true;
}

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

/**
 * ADW: Create a copy of an folder icon with a reflection
 * // w w w.j a  v a 2 s . c  o  m
 * @param layoutResId
 * @param parent
 * @param info
 * @return
 */
View createSmallFolder(int layoutResId, ViewGroup parent, PersonaUserFolderInfo info) {
    ImageView favorite = (ImageView) mInflater.inflate(layoutResId, parent, false);

    final Resources resources = getResources();
    // Drawable d = resources.getDrawable(R.drawable.ic_launcher_folder);
    Drawable d = null;
    if (PersonaAlmostNexusSettingsHelper.getThemeIcons(this)) {
        String packageName = PersonaAlmostNexusSettingsHelper.getThemePackageName(this, THEME_DEFAULT);
        if (packageName.equals(THEME_DEFAULT)) {
            d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
        } else {
            d = PersonaFolderIcon.loadFolderFromTheme(this, getPackageManager(), packageName,
                    "ic_launcher_folder");
            if (d == null) {
                d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
            }
        }
    } else {
        d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
    }
    d = PersonaUtilities.drawReflection(d, this);
    favorite.setImageDrawable(d);
    PersonaLog.d("personalauncher", "------settag done in createsmallfolder-------");
    favorite.setTag(info);
    favorite.setOnClickListener(this);
    return favorite;
}

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

/**
 * ADW: Create a copy of an PersonaLiveFolder icon with a reflection
 * //from w ww.ja v a2  s. co  m
 * @param layoutResId
 * @param parent
 * @param info
 * @return
 */
View createSmallLiveFolder(int layoutResId, ViewGroup parent, PersonaLiveFolderInfo info) {
    ImageView favorite = (ImageView) mInflater.inflate(layoutResId, parent, false);

    final Resources resources = getResources();
    Drawable d = info.icon;
    if (d == null) {
        if (PersonaAlmostNexusSettingsHelper.getThemeIcons(this)) {
            // Drawable d =
            // resources.getDrawable(R.drawable.ic_launcher_folder);
            String packageName = PersonaAlmostNexusSettingsHelper.getThemePackageName(this, THEME_DEFAULT);
            if (packageName.equals(THEME_DEFAULT)) {
                d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
            } else {
                d = PersonaFolderIcon.loadFolderFromTheme(this, getPackageManager(), packageName,
                        "ic_launcher_folder");
                if (d == null) {
                    d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
                }
            }
        } else {
            d = resources.getDrawable(R.drawable.pr_ic_launcher_folder);
        }
        info.filtered = true;
    }
    d = PersonaUtilities.drawReflection(d, this);
    favorite.setImageDrawable(d);
    PersonaLog.d("personalauncher", "------settag done in createsmalllivefolder-------");
    favorite.setTag(info);
    favorite.setOnClickListener(this);
    return favorite;
}