void resetLayout() { mContent.removeAllViewsInLayout(); // Add the Apps button Context context = getContext(); LayoutInflater inflater = LayoutInflater.from(context); BubbleTextView allAppsButton = (BubbleTextView) inflater.inflate(R.layout.application_allapps, mContent, false); allAppsButton.setCompoundDrawablesWithIntrinsicBounds( null, context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null); allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); allAppsButton.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (mLauncher != null && (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) { mLauncher.onTouchDownAllAppsButton(v); } return false; } }); allAppsButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(android.view.View v) { if (LauncherLog.DEBUG) { LauncherLog.d(TAG, "Click on all apps view on hotseat: mLauncher = " + mLauncher); } if (mLauncher != null) { mLauncher.onClickAllAppsButton(v); } } }); // Note: We do this to ensure that the hotseat is always laid out in the orientation of // the hotseat in order regardless of which orientation they were added int x = getCellXFromOrder(mAllAppsButtonRank); int y = getCellYFromOrder(mAllAppsButtonRank); CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1); lp.canReorder = false; mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true); }
protected View createAndAddShortcut(ShortcutInfo item) { final BubbleTextView textView = (BubbleTextView) mInflater.inflate(R.layout.folder_application, this, false); textView.applyFromShortcutInfo(item, mIconCache, false); int color = SettingsProvider.getInt( getContext(), SettingsProvider.FOLDER_ICON_TEXT_COLOR, getResources().getColor(R.color.folder_items_text_color)); textView.setTextColor(color); textView.setOnClickListener(this); textView.setOnLongClickListener(this); textView.setOnFocusChangeListener(mFocusIndicatorHandler); // We need to check here to verify that the given item's location isn't already occupied // by another item. if (mContent.getChildAt(item.cellX, item.cellY) != null || item.cellX < 0 || item.cellY < 0 || item.cellX >= mContent.getCountX() || item.cellY >= mContent.getCountY()) { // This shouldn't happen, log it. Log.e(TAG, "Folder order not properly persisted during bind"); if (!findAndSetEmptyCells(item)) { return null; } } CellLayout.LayoutParams lp = new CellLayout.LayoutParams(item.cellX, item.cellY, item.spanX, item.spanY); boolean insert = false; textView.setOnKeyListener(new FolderKeyEventListener()); mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int) item.id, lp, true); return textView; }