List of usage examples for android.view View setId
public void setId(@IdRes int id)
From source file:com.harlan.jxust.ui.view.bottombar.BottomBar.java
private void updateItems(final BottomBarItemBase[] bottomBarItems) { if (mItemContainer == null) { initializeViews();/* w ww . j a v a2s . c om*/ } int index = 0; int biggestWidth = 0; mIsShiftingMode = MAX_FIXED_TAB_COUNT < bottomBarItems.length; if (!mIsDarkTheme && !mIgnoreNightMode && MiscUtils.isNightMode(mContext)) { mIsDarkTheme = true; } if (mIsDarkTheme) { darkThemeMagic(); } else if (!mIsTabletMode && mIsShiftingMode) { mDefaultBackgroundColor = mCurrentBackgroundColor = mPrimaryColor; mBackgroundView.setBackgroundColor(mDefaultBackgroundColor); if (mContext instanceof Activity) { navBarMagic((Activity) mContext, this); } } View[] viewsToAdd = new View[bottomBarItems.length]; for (BottomBarItemBase bottomBarItemBase : bottomBarItems) { int layoutResource; if (mIsShiftingMode && !mIsTabletMode) { layoutResource = R.layout.bb_bottom_bar_item_shifting; } else { layoutResource = mIsTabletMode ? R.layout.bb_bottom_bar_item_fixed_tablet : R.layout.bb_bottom_bar_item_fixed; } View bottomBarTab = View.inflate(mContext, layoutResource, null); ImageView icon = (ImageView) bottomBarTab.findViewById(R.id.bb_bottom_bar_icon); icon.setImageDrawable(bottomBarItemBase.getIcon(mContext)); if (!mIsTabletMode) { TextView title = (TextView) bottomBarTab.findViewById(R.id.bb_bottom_bar_title); title.setText(bottomBarItemBase.getTitle(mContext)); if (mPendingTextAppearance != -1) { MiscUtils.setTextAppearance(title, mPendingTextAppearance); } if (mPendingTypeface != null) { title.setTypeface(mPendingTypeface); } } if (mIsDarkTheme || (!mIsTabletMode && mIsShiftingMode)) { icon.setColorFilter(mWhiteColor); } if (bottomBarItemBase instanceof BottomBarTab) { bottomBarTab.setId(((BottomBarTab) bottomBarItemBase).id); } if (index == mCurrentTabPosition) { selectTab(bottomBarTab, false); } else { unselectTab(bottomBarTab, false); } if (!mIsTabletMode) { if (bottomBarTab.getWidth() > biggestWidth) { biggestWidth = bottomBarTab.getWidth(); } viewsToAdd[index] = bottomBarTab; } else { mItemContainer.addView(bottomBarTab); } bottomBarTab.setOnClickListener(this); bottomBarTab.setOnLongClickListener(this); index++; } if (!mIsTabletMode) { int proposedItemWidth = Math.min(MiscUtils.dpToPixel(mContext, mScreenWidth / bottomBarItems.length), mMaxFixedItemWidth); mInActiveShiftingItemWidth = (int) (proposedItemWidth * 0.9); mActiveShiftingItemWidth = (int) (proposedItemWidth + (proposedItemWidth * (bottomBarItems.length * 0.1))); for (View bottomBarView : viewsToAdd) { LinearLayout.LayoutParams params; if (mIsShiftingMode && !mIgnoreShiftingResize) { if (TAG_BOTTOM_BAR_VIEW_ACTIVE.equals(bottomBarView.getTag())) { params = new LinearLayout.LayoutParams(mActiveShiftingItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } else { params = new LinearLayout.LayoutParams(mInActiveShiftingItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } } else { params = new LinearLayout.LayoutParams(proposedItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } bottomBarView.setLayoutParams(params); mItemContainer.addView(bottomBarView); } } if (mPendingTextAppearance != -1) { mPendingTextAppearance = -1; } if (mPendingTypeface != null) { mPendingTypeface = null; } }
From source file:com.plusot.senselib.SenseMain.java
private void addView() { // ViewGroup vg = (ViewGroup) findViewById(R.id.values_layout); if (viewsAdded >= MAX_VIEWS_ADDED) return;// w w w .j a va 2 s .com ViewGroup vg; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || map != null) { switch (viewsAdded) { case 0: case 2: vg = (ViewGroup) findViewById(R.id.double1); break; case 1: case 3: vg = (ViewGroup) findViewById(R.id.double2); break; case 4: case 5: vg = (ViewGroup) findViewById(R.id.double3); break; case 6: case 7: vg = (ViewGroup) findViewById(R.id.double4); break; default: vg = (ViewGroup) findViewById(R.id.main_layout); break; } } else { switch (viewsAdded) { case 0: case 7: vg = (ViewGroup) findViewById(R.id.double1); break; case 1: case 6: vg = (ViewGroup) findViewById(R.id.double2); break; case 2: case 5: vg = (ViewGroup) findViewById(R.id.double3); break; case 3: case 4: vg = (ViewGroup) findViewById(R.id.double4); break; default: vg = (ViewGroup) findViewById(R.id.main_layout); break; } } final View view = LayoutInflater.from(this).inflate(R.layout.graph_view, vg, false); valueViews[viewsAdded] = view; if (Globals.testing.isTest()) { FitLabelView fit = (FitLabelView) view.findViewById(R.id.caption); fit.setPadding(0, 0, 0, 6); fit.setHeightPercentage(0.24f); } view.setId(viewsAdded + VIEW_ID_BASE); vg.addView(view); View value = view.findViewById(R.id.value); addOnValueClick(value, VIEW_ID_BASE + viewsAdded); value.setOnTouchListener(new GestureTouchListener(this, view)); viewsAdded++; adjustViews(); }
From source file:com.android.leanlauncher.CellLayout.java
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, boolean markCells) { child.setScaleX(getChildrenScale()); child.setScaleY(getChildrenScale()); // Generate an id for each view, this assumes we have at most 256x256 cells // per workspace screen if (params.cellX >= 0 && params.cellX <= mCountX - 1 && params.cellY >= 0 && params.cellY <= mCountY - 1) { // If the horizontal or vertical span is set to -1, it is taken to // mean that it spans the extent of the CellLayout if (params.cellHSpan < 0) params.cellHSpan = mCountX;/* ww w . j av a2 s . c o m*/ if (params.cellVSpan < 0) params.cellVSpan = mCountY; child.setId(childId); mShortcutsAndWidgets.addView(child, index, params); mShortcutsAndWidgets.setTag(child); if (markCells) markCellsAsOccupiedForView(child); return true; } return false; }
From source file:com.lite.android.launcher3.CellLayout.java
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, boolean markCells) { final LayoutParams lp = params; // Hotseat icons - remove text if (mIsHotseat && child instanceof BubbleTextView) { ((BubbleTextView) child).setTextVisibility(false); }// w w w.j ava 2s . co m child.setScaleX(getChildrenScale()); child.setScaleY(getChildrenScale()); // Generate an id for each view, this assumes we have at most 256x256 cells // per workspace screen if (lp.cellX >= 0 && lp.cellX <= mCountX - 1 && lp.cellY >= 0 && lp.cellY <= mCountY - 1) { // If the horizontal or vertical span is set to -1, it is taken to // mean that it spans the extent of the CellLayout if (lp.cellHSpan < 0) lp.cellHSpan = mCountX; if (lp.cellVSpan < 0) lp.cellVSpan = mCountY; child.setId(childId); mShortcutsAndWidgets.addView(child, index, lp); if (markCells) markCellsAsOccupiedForView(child); return true; } return false; }
From source file:com.android.mylauncher3.CellLayout.java
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, boolean markCells) { final LayoutParams lp = params; // Hotseat icons - remove text if (child instanceof BubbleTextView) { BubbleTextView bubbleChild = (BubbleTextView) child; bubbleChild.setTextVisibility(!mIsHotseat); }//from ww w . j ava2s.c o m child.setScaleX(getChildrenScale()); child.setScaleY(getChildrenScale()); // Generate an id for each view, this assumes we have at most 256x256 cells // per workspace screen if (lp.cellX >= 0 && lp.cellX <= mCountX - 1 && lp.cellY >= 0 && lp.cellY <= mCountY - 1) { // If the horizontal or vertical span is set to -1, it is taken to // mean that it spans the extent of the CellLayout if (lp.cellHSpan < 0) lp.cellHSpan = mCountX; if (lp.cellVSpan < 0) lp.cellVSpan = mCountY; child.setId(childId); mShortcutsAndWidgets.addView(child, index, lp); if (markCells) markCellsAsOccupiedForView(child); return true; } return false; }
From source file:com.android.launcher3.CellLayout.java
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, boolean markCells) { final LayoutParams lp = params; // Hotseat icons - remove text if (child instanceof BubbleTextView) { BubbleTextView bubbleChild = (BubbleTextView) child; bubbleChild.setTextVisibility(!mIsHotseat); }//ww w . j a v a 2 s. c o m child.setScaleX(getChildrenScale()); child.setScaleY(getChildrenScale()); // Generate an id for each view, this assumes we have at most 256x256 cells // per workspace screen if (lp.cellX >= 0 && lp.cellX <= mCountX - 1 && lp.cellY >= 0 && lp.cellY <= mCountY - 1) { // If the horizontal or vertical span is set to -1, it is taken to // mean that it spans the extent of the CellLayout if (lp.cellHSpan < 0) lp.cellHSpan = mCountX; if (lp.cellVSpan < 0) lp.cellVSpan = mCountY; child.setId(childId); if (LOGD) { Log.d(TAG, "Adding view to ShortcutsAndWidgetsContainer: " + child); } mShortcutsAndWidgets.addView(child, index, lp); if (markCells) markCellsAsOccupiedForView(child); return true; } return false; }
From source file:com.android.launcher2.Launcher.java
public void showFirstRunWorkspaceCling() { // Enable the clings only if they have not been dismissed before if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) && !skipCustomClingIfNoAccounts()) { // If we're not using the default workspace layout, replace workspace cling // with a custom workspace cling (usually specified in an overlay) // For now, only do this on tablets if (mSharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 && getResources().getBoolean(R.bool.config_useCustomClings)) { // Use a custom cling View cling = findViewById(R.id.workspace_cling); ViewGroup clingParent = (ViewGroup) cling.getParent(); int clingIndex = clingParent.indexOfChild(cling); clingParent.removeViewAt(clingIndex); View customCling = mInflater.inflate(R.layout.custom_workspace_cling, clingParent, false); clingParent.addView(customCling, clingIndex); customCling.setId(R.id.workspace_cling); }/*from www .j ava 2 s. c o m*/ initCling(R.id.workspace_cling, null, false, 0); } else { removeCling(R.id.workspace_cling); } }
From source file:com.android.soma.Launcher.java
public void showFirstRunCling() { if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.FIRST_RUN_CLING_DISMISSED_KEY, false) && !skipCustomClingIfNoAccounts()) { // If we're not using the default workspace layout, replace workspace cling // with a custom workspace cling (usually specified in an overlay) // For now, only do this on tablets if (!DISABLE_CUSTOM_CLINGS) { if (mSharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 && getResources().getBoolean(R.bool.config_useCustomClings)) { // Use a custom cling View cling = findViewById(R.id.workspace_cling); ViewGroup clingParent = (ViewGroup) cling.getParent(); int clingIndex = clingParent.indexOfChild(cling); clingParent.removeViewAt(clingIndex); View customCling = mInflater.inflate(R.layout.custom_workspace_cling, clingParent, false); clingParent.addView(customCling, clingIndex); customCling.setId(R.id.workspace_cling); }/* w w w . ja v a 2 s. co m*/ } Cling cling = (Cling) findViewById(R.id.first_run_cling); if (cling != null) { String sbHintStr = getFirstRunClingSearchBarHint(); String ccHintStr = getFirstRunCustomContentHint(); if (!sbHintStr.isEmpty()) { TextView sbHint = (TextView) cling.findViewById(R.id.search_bar_hint); sbHint.setText(sbHintStr); sbHint.setVisibility(View.VISIBLE); } setCustomContentHintVisibility(cling, ccHintStr, true, false); } initCling(R.id.first_run_cling, 0, false, true); } else { removeCling(R.id.first_run_cling); } }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public void setupBaseBarButtons(Menu menu, boolean flush) { if (flush)//w ww .ja v a 2s . co m mLastMenuClass = ""; TableLayout mBaseBar = (TableLayout) findViewById(R.id.base_bar); mToolbarButtons = (ViewGroup) findViewById(R.id.base_row); mStaticButtons = (ViewGroup) findViewById(R.id.title_static_buttons); OpenFragment f = getSelectedFragment(); boolean topButtons = false; if (!getResources().getBoolean(R.bool.allow_split_actionbar) || !(getSetting(null, "pref_basebar", true) || mBaseBar == null || mToolbarButtons == null) && findViewById(R.id.title_buttons) != null) { mToolbarButtons = (ViewGroup) findViewById(R.id.title_buttons); if (mToolbarButtons == null && !BEFORE_HONEYCOMB) mToolbarButtons = (ViewGroup) getActionBar().getCustomView().findViewById(R.id.title_buttons); if (mBaseBar != null) mBaseBar.setVisibility(View.GONE); topButtons = true; } if (!shouldFlushMenu(menu)) return; USE_SPLIT_ACTION_BAR = !topButtons; if (mToolbarButtons != null) { mToolbarButtons.removeAllViews(); //if(!topButtons) mToolbarButtons.measure(LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height)); int i = -1; int btnWidth = getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_width) + (getResources().getDimensionPixelSize(R.dimen.vpi_padding_horizontal) * 2); // (int)(16 * getResources().getDimension(R.dimen.one_dp)); int tblWidth = mToolbarButtons.getWidth(); if (tblWidth <= 0 && !topButtons) tblWidth = getWindowWidth(); if (topButtons || tblWidth <= 0 || tblWidth > getWindowWidth() || !getResources().getBoolean(R.bool.ignore_max_base_buttons)) tblWidth = btnWidth * getResources().getInteger(R.integer.max_base_buttons); ArrayList<View> buttons = new ArrayList<View>(); buttons.addAll(ViewUtils.findChildByClass(mToolbarButtons, ImageButton.class)); boolean maxedOut = false; while (++i < menu.size()) { if (buttons.size() * btnWidth >= tblWidth) { maxedOut = true; Logger.LogDebug("Base bar full after #" + i + " ~ " + buttons.size() + " (" + (buttons.size() * btnWidth) + ">" + tblWidth + ")!"); break; } else if (menu.getItem(i) instanceof MenuItemImpl) { final MenuItemImpl item = (MenuItemImpl) menu.getItem(i); //if(item.getItemId() == R.id.title_menu) break; if (!item.isCheckable() && item.isVisible()) { View btn = makeMenuButton(item, mToolbarButtons); if (item.hasSubMenu()) btn.setTag(item.getSubMenu()); else if (!BEFORE_HONEYCOMB && item.getActionView() != null) { if (DEBUG) Logger.LogDebug("ACTION VIEW!!!"); btn = item.getActionView(); //ActionBarHelper h = ActionBarHelper.createInstance(this); } buttons.add(btn); if (i > 0) btn.setNextFocusLeftId(menu.getItem(i - 1).getItemId()); if (i < menu.size() - 1) btn.setNextFocusRightId(menu.getItem(i + 1).getItemId()); if (!USE_PRETTY_MENUS || topButtons) btn.setOnCreateContextMenuListener(this); menu.getItem(i).setVisible(false); btn.setOnClickListener(this); btn.setOnFocusChangeListener(this); btn.setOnKeyListener(this); if (mToolbarButtons.findViewById(menu.getItem(i).getItemId()) == null) mToolbarButtons.addView(btn); //menu.removeItem(item.getItemId()); if (DEBUG) Logger.LogDebug("Added " + item.getTitle() + " to base bar."); } //else Logger.LogWarning(item.getTitle() + " should not show. " + item.getShowAsAction() + " :: " + item.getFlags()); } } mToolbarButtons.setVisibility(View.VISIBLE); mLastMenuClass = f.getClassName(); if (MenuUtils.countVisibleMenus(mMainMenu) > 0) { if (maxedOut && buttons.size() > 0) { View old = buttons.remove(buttons.size() - 1); MenuUtils.setMenuVisible(mMainMenu, true, old.getId()); mToolbarButtons.removeView(old); } final ImageButton btn = (ImageButton) getLayoutInflater().inflate(R.layout.toolbar_button, mToolbarButtons); btn.setImageResource(R.drawable.ic_menu_more); //btn.measure(getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_home_width), getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height)); btn.setId(R.id.menu_more); if (buttons.size() > 0) { buttons.get(buttons.size() - 1).setNextFocusRightId(R.id.menu_more); btn.setNextFocusLeftId(buttons.get(buttons.size() - 1).getId()); } btn.setOnKeyListener(this); btn.setOnClickListener(this); btn.setOnLongClickListener(this); btn.setFocusable(true); btn.setOnFocusChangeListener(this); buttons.add(btn); mToolbarButtons.addView(btn); } if (buttons.size() > 0) { View last = buttons.get(buttons.size() - 1); last.setNextFocusRightId(android.R.id.home); if (findViewById(android.R.id.home) != null) findViewById(android.R.id.home).setNextFocusLeftId(last.getId()); } Logger.LogDebug("Added " + buttons.size() + " children to Base Bar."); if (mBaseBar != null) { if (buttons.size() < 1) mBaseBar.setVisibility(View.GONE); else mBaseBar.setStretchAllColumns(true); } } else if (BEFORE_HONEYCOMB) Logger.LogWarning("No Base Row!?"); }
From source file:com.android.launcher2.Workspace.java
public void onDrop(final DragObject d) { mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, d.dragView, mDragViewVisualCenter);//from w w w . jav a2 s . com CellLayout dropTargetLayout = mDropToLayout; // We want the point to be mapped to the dragTarget. if (dropTargetLayout != null) { if (mLauncher.isHotseatLayout(dropTargetLayout)) { mapPointFromSelfToHotseatLayout(mLauncher.getHotseat(), mDragViewVisualCenter); } else { mapPointFromSelfToChild(dropTargetLayout, mDragViewVisualCenter, null); } } int snapScreen = -1; boolean resizeOnDrop = false; if (d.dragSource != this) { final int[] touchXY = new int[] { (int) mDragViewVisualCenter[0], (int) mDragViewVisualCenter[1] }; onDropExternal(touchXY, d.dragInfo, dropTargetLayout, false, d); } else if (mDragInfo != null) { final View cell = mDragInfo.cell; Runnable resizeRunnable = null; if (dropTargetLayout != null) { // Move internally boolean hasMovedLayouts = (getParentCellLayoutForView(cell) != dropTargetLayout); boolean hasMovedIntoHotseat = mLauncher.isHotseatLayout(dropTargetLayout); long container = hasMovedIntoHotseat ? LauncherSettings.Favorites.CONTAINER_HOTSEAT : LauncherSettings.Favorites.CONTAINER_DESKTOP; int screen = (mTargetCell[0] < 0) ? mDragInfo.screen : indexOfChild(dropTargetLayout); int spanX = mDragInfo != null ? mDragInfo.spanX : 1; int spanY = mDragInfo != null ? mDragInfo.spanY : 1; // First we find the cell nearest to point at which the item is // dropped, without any consideration to whether there is an item there. mTargetCell = findNearestArea((int) mDragViewVisualCenter[0], (int) mDragViewVisualCenter[1], spanX, spanY, dropTargetLayout, mTargetCell); float distance = dropTargetLayout.getDistanceFromCell(mDragViewVisualCenter[0], mDragViewVisualCenter[1], mTargetCell); // If the item being dropped is a shortcut and the nearest drop // cell also contains a shortcut, then create a folder with the two shortcuts. if (!mInScrollArea && createUserFolderIfNecessary(cell, container, dropTargetLayout, mTargetCell, distance, false, d.dragView, null)) { return; } if (addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell, distance, d, false)) { return; } // Aside from the special case where we're dropping a shortcut onto a shortcut, // we need to find the nearest cell location that is vacant ItemInfo item = (ItemInfo) d.dragInfo; int minSpanX = item.spanX; int minSpanY = item.spanY; if (item.minSpanX > 0 && item.minSpanY > 0) { minSpanX = item.minSpanX; minSpanY = item.minSpanY; } int[] resultSpan = new int[2]; mTargetCell = dropTargetLayout.createArea((int) mDragViewVisualCenter[0], (int) mDragViewVisualCenter[1], minSpanX, minSpanY, spanX, spanY, cell, mTargetCell, resultSpan, CellLayout.MODE_ON_DROP); boolean foundCell = mTargetCell[0] >= 0 && mTargetCell[1] >= 0; // if the widget resizes on drop if (foundCell && (cell instanceof AppWidgetHostView) && (resultSpan[0] != item.spanX || resultSpan[1] != item.spanY)) { resizeOnDrop = true; item.spanX = resultSpan[0]; item.spanY = resultSpan[1]; AppWidgetHostView awhv = (AppWidgetHostView) cell; AppWidgetResizeFrame.updateWidgetSizeRanges(awhv, mLauncher, resultSpan[0], resultSpan[1]); } if (mCurrentPage != screen && !hasMovedIntoHotseat) { snapScreen = screen; snapToPage(screen); } if (foundCell) { final ItemInfo info = (ItemInfo) cell.getTag(); if (hasMovedLayouts) { // Reparent the view getParentCellLayoutForView(cell).removeView(cell); addInScreen(cell, container, screen, mTargetCell[0], mTargetCell[1], info.spanX, info.spanY); } // update the item's position after drop CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams(); lp.cellX = lp.tmpCellX = mTargetCell[0]; lp.cellY = lp.tmpCellY = mTargetCell[1]; lp.cellHSpan = item.spanX; lp.cellVSpan = item.spanY; lp.isLockedToGrid = true; cell.setId(LauncherModel.getCellLayoutChildId(container, mDragInfo.screen, mTargetCell[0], mTargetCell[1], mDragInfo.spanX, mDragInfo.spanY)); if (container != LauncherSettings.Favorites.CONTAINER_HOTSEAT && cell instanceof LauncherAppWidgetHostView) { final CellLayout cellLayout = dropTargetLayout; // We post this call so that the widget has a chance to be placed // in its final location final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell; AppWidgetProviderInfo pinfo = hostView.getAppWidgetInfo(); if (pinfo != null && pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) { final Runnable addResizeFrame = new Runnable() { public void run() { DragLayer dragLayer = mLauncher.getDragLayer(); dragLayer.addResizeFrame(info, hostView, cellLayout); } }; resizeRunnable = (new Runnable() { public void run() { if (!isPageMoving()) { addResizeFrame.run(); } else { mDelayedResizeRunnable = addResizeFrame; } } }); } } LauncherModel.moveItemInDatabase(mLauncher, info, container, screen, lp.cellX, lp.cellY); } else { // If we can't find a drop location, we return the item to its original position CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams(); mTargetCell[0] = lp.cellX; mTargetCell[1] = lp.cellY; CellLayout layout = (CellLayout) cell.getParent().getParent(); layout.markCellsAsOccupiedForView(cell); } } final CellLayout parent = (CellLayout) cell.getParent().getParent(); final Runnable finalResizeRunnable = resizeRunnable; // Prepare it to be animated into its new position // This must be called after the view has been re-parented final Runnable onCompleteRunnable = new Runnable() { @Override public void run() { mAnimatingViewIntoPlace = false; updateChildrenLayersEnabled(false); if (finalResizeRunnable != null) { finalResizeRunnable.run(); } } }; mAnimatingViewIntoPlace = true; if (d.dragView.hasDrawn()) { final ItemInfo info = (ItemInfo) cell.getTag(); if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET) { int animationType = resizeOnDrop ? ANIMATE_INTO_POSITION_AND_RESIZE : ANIMATE_INTO_POSITION_AND_DISAPPEAR; animateWidgetDrop(info, parent, d.dragView, onCompleteRunnable, animationType, cell, false); } else { int duration = snapScreen < 0 ? -1 : ADJACENT_SCREEN_DROP_DURATION; mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell, duration, onCompleteRunnable, this); } } else { d.deferDragViewCleanupPostAnimation = false; cell.setVisibility(VISIBLE); } parent.onDropChild(cell); } }