@Override public void shortcutPicked(String uri, String friendlyName, Bitmap bmp, boolean isApplication) { NavBarButton button = mButtons.get(mPendingButton); boolean longpress = button.getPickLongPress(); if (!longpress) { button.setClickAction(uri); if (bmp == null) { button.setIconURI(""); } else { String iconName = getIconFileName(mPendingButton); FileOutputStream iconStream = null; try { iconStream = mContext.openFileOutput(iconName, Context.MODE_WORLD_READABLE); } catch (FileNotFoundException e) { return; // NOOOOO } bmp.compress(Bitmap.CompressFormat.PNG, 100, iconStream); button.setIconURI(Uri.fromFile(mContext.getFileStreamPath(iconName)).toString()); } } else { button.setLongPress(uri); } refreshButtons(); }
private void onActionDialogClick(NavBarButton button, int command) { if (command == mActions.length - 1) { // This is the last action - should be **app** mPicker.pickShortcut(); } else { // This should be any other defined action. if (button.getPickLongPress()) { button.setLongPress(mActionCodes[command]); } else { button.setClickAction(mActionCodes[command]); } } refreshButtons(); }