List of usage examples for android.view View getTag
@ViewDebug.ExportedProperty
public Object getTag()
From source file:cm.aptoide.pt.MainActivity.java
private void loadUIEditorsApps() { final int[] res_ids = { R.id.central, R.id.topleft, R.id.topright, R.id.bottomleft, R.id.bottomcenter, R.id.bottomright };/*www . j a v a 2s .co m*/ final ArrayList<HashMap<String, String>> image_urls = db.getFeaturedGraphics(); final HashMap<String, String> image_url_highlight = db.getHighLightFeature(); // System.out.println(image_url_highlight + "ASDASDASDASD"); // System.out.println(image_urls + "ASDASDASDASD"); runOnUiThread(new Runnable() { @Override public void run() { if (image_url_highlight.size() > 0) { a = 1; ImageView v = (ImageView) featuredView.findViewById(res_ids[0]); // imageLoader.DisplayImage(-1, image_url_highlight.get("url"), v, // mContext); DisplayImageOptions options = new DisplayImageOptions.Builder() .displayer(new FadeInBitmapDisplayer(1000)).cacheOnDisc().cacheInMemory().build(); cm.aptoide.com.nostra13.universalimageloader.core.ImageLoader.getInstance() .displayImage(image_url_highlight.get("url"), v, options); v.setTag(image_url_highlight.get("id")); v.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, ApkInfo.class); i.putExtra("_id", Long.parseLong((String) arg0.getTag())); i.putExtra("top", false); i.putExtra("category", Category.EDITORSCHOICE.ordinal()); startActivity(i); } }); // v.setOnClickListener(featuredListener); } } }); Collections.shuffle(image_urls); runOnUiThread(new Runnable() { public void run() { for (int i = a; i != res_ids.length; i++) { try { ImageView v = (ImageView) featuredView.findViewById(res_ids[i]); // imageLoader.DisplayImage(-1, // image_urls.get(i).get("url"), v, mContext); DisplayImageOptions options = new DisplayImageOptions.Builder() .displayer(new FadeInBitmapDisplayer(1000)).cacheOnDisc().cacheInMemory().build(); cm.aptoide.com.nostra13.universalimageloader.core.ImageLoader.getInstance() .displayImage(image_urls.get(i - a).get("url"), v, options); v.setTag(image_urls.get(i - a).get("id")); v.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, ApkInfo.class); i.putExtra("_id", Long.parseLong((String) arg0.getTag())); i.putExtra("top", false); i.putExtra("category", Category.EDITORSCHOICE.ordinal()); startActivity(i); } }); // v.setOnClickListener(featuredListener); } catch (Exception e) { e.printStackTrace(); } } } }); }
From source file:cm.aptoide.pt.MainActivity.java
private void loadUItopapps() { ((ToggleButton) featuredView.findViewById(R.id.toggleButton1)).setOnCheckedChangeListener(null); Cursor c = db.getFeaturedTopApps(); values = new ArrayList<HashMap<String, String>>(); for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) { HashMap<String, String> item = new HashMap<String, String>(); item.put("name", c.getString(1)); item.put("icon", db.getIconsPath(0, Category.TOPFEATURED) + c.getString(4)); item.put("rating", c.getString(5)); item.put("id", c.getString(0)); item.put("apkid", c.getString(7)); item.put("vercode", c.getString(8)); item.put("vername", c.getString(2)); item.put("downloads", c.getString(6)); if (values.size() == 26) { break; }/*from w w w . j a va2s . c o m*/ values.add(item); } c.close(); runOnUiThread(new Runnable() { public void run() { LinearLayout ll = (LinearLayout) featuredView.findViewById(R.id.container); ll.removeAllViews(); LinearLayout llAlso = new LinearLayout(MainActivity.this); llAlso.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); llAlso.setOrientation(LinearLayout.HORIZONTAL); for (int i = 0; i != values.size(); i++) { LinearLayout txtSamItem = (LinearLayout) getLayoutInflater().inflate(R.layout.row_grid_item, null); ((TextView) txtSamItem.findViewById(R.id.name)).setText(values.get(i).get("name")); // ((TextView) txtSamItem.findViewById(R.id.version)) // .setText(getString(R.string.version) +" "+ // values.get(i).get("vername")); ((TextView) txtSamItem.findViewById(R.id.downloads)).setText( "(" + values.get(i).get("downloads") + " " + getString(R.string.downloads) + ")"); String hashCode = (values.get(i).get("apkid") + "|" + values.get(i).get("vercode")) + ""; cm.aptoide.com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage( values.get(i).get("icon"), (ImageView) txtSamItem.findViewById(R.id.icon), hashCode); // imageLoader.DisplayImage(-1, values.get(i).get("icon"), // (ImageView) txtSamItem.findViewById(R.id.icon), // mContext); float stars = 0f; try { stars = Float.parseFloat(values.get(i).get("rating")); } catch (Exception e) { stars = 0f; } ((RatingBar) txtSamItem.findViewById(R.id.rating)).setRating(stars); ((RatingBar) txtSamItem.findViewById(R.id.rating)).setIsIndicator(true); txtSamItem.setPadding(10, 0, 0, 0); txtSamItem.setTag(values.get(i).get("id")); txtSamItem.setLayoutParams( new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 100, 1)); // txtSamItem.setOnClickListener(featuredListener); txtSamItem.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, ApkInfo.class); long id = Long.parseLong((String) arg0.getTag()); i.putExtra("_id", id); i.putExtra("top", true); i.putExtra("category", Category.TOPFEATURED.ordinal()); startActivity(i); } }); txtSamItem.measure(0, 0); if (i % 2 == 0) { ll.addView(llAlso); llAlso = new LinearLayout(MainActivity.this); llAlso.setLayoutParams( new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 100)); llAlso.setOrientation(LinearLayout.HORIZONTAL); llAlso.addView(txtSamItem); } else { llAlso.addView(txtSamItem); } } ll.addView(llAlso); SharedPreferences sPref = PreferenceManager.getDefaultSharedPreferences(mContext); // System.out.println(sPref.getString("app_rating", // "All").equals( // "Mature")); ((ToggleButton) featuredView.findViewById(R.id.toggleButton1)) .setChecked(!sPref.getBoolean("matureChkBox", false)); ((ToggleButton) featuredView.findViewById(R.id.toggleButton1)) .setOnCheckedChangeListener(adultCheckedListener); } }); }
From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java
private void displayPeopleSection(List<LightUserRepresentation> people) { show(R.id.task_details_people_card); if (people.isEmpty() || isEnded) { hide(R.id.task_details_people_card); return;/*from w w w . java2s . c o m*/ } // USER INVOLVED LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout userContainer = (LinearLayout) viewById(R.id.task_details_people_container); userContainer.removeAllViews(); View v; if (people == null || people.isEmpty()) { v = inflater.inflate(R.layout.row_single_line, userContainer, false); ((TextView) v.findViewById(R.id.toptext)).setText(R.string.task_message_no_people_involved); v.findViewById(R.id.icon).setVisibility(View.GONE); userContainer.addView(v); } else { TwoLinesViewHolder vh; for (LightUserRepresentation user : people) { v = inflater.inflate(R.layout.row_two_lines_swipe, userContainer, false); v.setTag(user.getId()); String fullName = user.getFullname(); vh = HolderUtils.configure(v, fullName != null && !fullName.isEmpty() ? fullName : user.getEmail(), null, R.drawable.ic_account_circle_grey); if (picasso != null) { picasso.cancelRequest(vh.icon); picasso.load(getAPI().getUserGroupService().getPicture(user.getId())) .placeholder(R.drawable.ic_account_circle_grey).fit().transform(roundedTransformation) .into(vh.icon); } SwipeLayout swipeLayout = (SwipeLayout) v.findViewById(R.id.swipe_layout); swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown); swipeLayout.setDragEdge(SwipeLayout.DragEdge.Right); LinearLayout actions = (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper); ImageButton action = (ImageButton) inflater.inflate(R.layout.form_swipe_action_, (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper), false); action.setImageResource(R.drawable.ic_remove_circle_outline_white); action.setTag(user); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { removeInvolved(((LightUserRepresentation) v.getTag()), new InvolveTaskRepresentation(((LightUserRepresentation) v.getTag()).getId())); } }); actions.addView(action); userContainer.addView(v); } } if (!isEnded) { v = inflater.inflate(R.layout.footer_two_buttons_borderless, userContainer, false); Button b = (Button) v.findViewById(R.id.button_action_left); b.setVisibility(View.GONE); b = (Button) v.findViewById(R.id.button_action_right); b.setText(R.string.task_action_involve); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startInvolveAction(); } }); userContainer.addView(v); } }
From source file:cm.aptoide.pt.MainActivity.java
private void loadRecommended() { if (Login.isLoggedIn(mContext)) { ((TextView) featuredView.findViewById(R.id.recommended_text)).setVisibility(View.GONE); } else {// ww w .ja va2 s. co m ((TextView) featuredView.findViewById(R.id.recommended_text)).setVisibility(View.VISIBLE); } new Thread(new Runnable() { private ArrayList<HashMap<String, String>> valuesRecommended; public void run() { loadUIRecommendedApps(); File f = null; try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); NetworkUtils utils = new NetworkUtils(); BufferedInputStream bis = new BufferedInputStream( utils.getInputStream("http://webservices.aptoide.com/webservices/listUserBasedApks/" + Login.getToken(mContext) + "/10/xml", null, null, mContext), 8 * 1024); f = File.createTempFile("abc", "abc"); OutputStream out = new FileOutputStream(f); byte buf[] = new byte[1024]; int len; while ((len = bis.read(buf)) > 0) out.write(buf, 0, len); out.close(); bis.close(); String hash = Md5Handler.md5Calc(f); ViewApk parent_apk = new ViewApk(); parent_apk.setApkid("recommended"); if (!hash.equals(db.getItemBasedApksHash(parent_apk.getApkid()))) { // Database.database.beginTransaction(); db.deleteItemBasedApks(parent_apk); sp.parse(f, new HandlerItemBased(parent_apk)); db.insertItemBasedApkHash(hash, parent_apk.getApkid()); // Database.database.setTransactionSuccessful(); // Database.database.endTransaction(); loadUIRecommendedApps(); } } catch (Exception e) { e.printStackTrace(); } if (f != null) f.delete(); } private void loadUIRecommendedApps() { valuesRecommended = db.getItemBasedApksRecommended("recommended"); runOnUiThread(new Runnable() { public void run() { LinearLayout ll = (LinearLayout) featuredView.findViewById(R.id.recommended_container); ll.removeAllViews(); LinearLayout llAlso = new LinearLayout(MainActivity.this); llAlso.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); llAlso.setOrientation(LinearLayout.HORIZONTAL); if (valuesRecommended.isEmpty()) { if (Login.isLoggedIn(mContext)) { TextView tv = new TextView(mContext); tv.setText(R.string.no_recommended_apps); tv.setTextAppearance(mContext, android.R.attr.textAppearanceMedium); tv.setPadding(10, 10, 10, 10); ll.addView(tv); } } else { for (int i = 0; i != valuesRecommended.size(); i++) { LinearLayout txtSamItem = (LinearLayout) getLayoutInflater() .inflate(R.layout.row_grid_item, null); ((TextView) txtSamItem.findViewById(R.id.name)) .setText(valuesRecommended.get(i).get("name")); ImageLoader.getInstance().displayImage(valuesRecommended.get(i).get("icon"), (ImageView) txtSamItem.findViewById(R.id.icon)); float stars = 0f; try { stars = Float.parseFloat(valuesRecommended.get(i).get("rating")); } catch (Exception e) { stars = 0f; } ((RatingBar) txtSamItem.findViewById(R.id.rating)).setIsIndicator(true); ((RatingBar) txtSamItem.findViewById(R.id.rating)).setRating(stars); txtSamItem.setPadding(10, 0, 0, 0); // ((TextView) // txtSamItem.findViewById(R.id.version)) // .setText(getString(R.string.version) +" "+ // valuesRecommended.get(i).get("vername")); ((TextView) txtSamItem.findViewById(R.id.downloads)) .setText("(" + valuesRecommended.get(i).get("downloads") + " " + getString(R.string.downloads) + ")"); txtSamItem.setTag(valuesRecommended.get(i).get("_id")); txtSamItem.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, 100, 1)); // txtSamItem.setOnClickListener(featuredListener); txtSamItem.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, ApkInfo.class); long id = Long.parseLong((String) arg0.getTag()); i.putExtra("_id", id); i.putExtra("top", true); i.putExtra("category", Category.ITEMBASED.ordinal()); startActivity(i); } }); txtSamItem.measure(0, 0); if (i % 2 == 0) { ll.addView(llAlso); llAlso = new LinearLayout(MainActivity.this); llAlso.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, 100)); llAlso.setOrientation(LinearLayout.HORIZONTAL); llAlso.addView(txtSamItem); } else { llAlso.addView(txtSamItem); } } ll.addView(llAlso); } } }); } }).start(); }
From source file:com.aliyun.homeshell.Folder.java
public boolean onLongClick(View v) { // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return true; /*YUNOS BEGIN*/ //##module(homeshell) //##date:2013/12/06 ##author:jun.dongj@alibaba-inc.com##BugID:72676 //downloading item in folder can be drag /*if(mLauncher.getModel().isDownloadStatus()) { ToastManager.makeToast(ToastManager.NOT_ALLOW_EDIT_IN_DOWNING); return true;//from w w w. ja v a 2s . com }*/ /*YUNOS END*/ Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) tag; if (!v.isInTouchMode()) { return false; } /* YUNOS BEGIN */ // ##date:2014/06/03 ##author:yangshan.ys // batch operations to the icons in folder //prohibit the editfoldericon drag by longclick if (item.isEditFolderShortcut()) { return false; } /* YUNOS END */ mLauncher.dismissFolderCling(null); mLauncher.getWorkspace().onDragStartedWithItem(v); /*YUNOS BEGIN lxd */ //mLauncher.getWorkspace().beginDragShared(v, this); CellLayout.CellInfo cellInfo = new CellLayout.CellInfo(); cellInfo.cell = v; cellInfo.cellX = item.cellX; cellInfo.cellY = item.cellY; cellInfo.container = item.container; cellInfo.screen = item.screen; cellInfo.spanX = item.spanX; cellInfo.spanY = item.spanY; mLauncher.getWorkspace().startDrag(cellInfo, this); mIconDrawable = ((TextView) v).getCompoundDrawables()[1]; mCurrentDragInfo = item; mEmptyCell[0] = item.cellX; mEmptyCell[1] = item.cellY; mCurrentDragView = v; /*YUNOS BEGIN*/ //##date:2014/06/10 ##author:guoshuai.lgs ##BugID: //support the folder feature in mainmenu if (mInfo.isMainmenuFolder() && (LauncherApplication.isMainmenuMode())) { mLauncher.getAppsCustomize().closeFolder(this, false); // Go into spring loaded mode (must happen before we startDrag()) mLauncher.enterSpringLoadedDragMode(); } else { mContent.removeView(mCurrentDragView); mInfo.remove(mCurrentDragInfo); } /*YUNOS END*/ mDragInProgress = true; mItemAddedBackToSelfViaIcon = false; /* YUNOS BEGIN */ // ##date:2014/07/04 ##author:yangshan.ys##BugID:135044 // prevent the position of editfoldericon moving in folder if (mInfo.isEditFolderInContents()) { int screen = mInfo.getmEditFolderShortcutInfo().screen; int editFolderCellX = mInfo.getmEditFolderShortcutInfo().cellX; int editFolderCellY = mInfo.getmEditFolderShortcutInfo().cellY; mEditFolderTempView = mContentList.get(screen).getChildAt(editFolderCellX, editFolderCellY); mContent.removeView(mEditFolderTempView); mEditFolderHidden = true; } /* YUNOS END */ } return true; }
From source file:com.android.launcher3.CellLayout.java
public boolean animateChildToPosition(final View child, int cellX, int cellY, int duration, int delay, boolean permanent, boolean adjustOccupied) { ShortcutAndWidgetContainer clc = getShortcutsAndWidgets(); boolean[][] occupied = mOccupied; if (!permanent) { occupied = mTmpOccupied;//w w w .ja v a 2s. c om } if (clc.indexOfChild(child) != -1) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final ItemInfo info = (ItemInfo) child.getTag(); // We cancel any existing animations if (mReorderAnimators.containsKey(lp)) { mReorderAnimators.get(lp).cancel(); mReorderAnimators.remove(lp); } final int oldX = lp.x; final int oldY = lp.y; if (adjustOccupied) { occupied[lp.cellX][lp.cellY] = false; occupied[cellX][cellY] = true; } lp.isLockedToGrid = true; if (permanent) { lp.cellX = info.cellX = cellX; lp.cellY = info.cellY = cellY; } else { lp.tmpCellX = cellX; lp.tmpCellY = cellY; } clc.setupLp(lp); lp.isLockedToGrid = false; final int newX = lp.x; final int newY = lp.y; lp.x = oldX; lp.y = oldY; // Exit early if we're not actually moving the view if (oldX == newX && oldY == newY) { lp.isLockedToGrid = true; return true; } ValueAnimator va = LauncherAnimUtils.ofFloat(child, 0f, 1f); va.setDuration(duration); mReorderAnimators.put(lp, va); va.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float r = ((Float) animation.getAnimatedValue()).floatValue(); lp.x = (int) ((1 - r) * oldX + r * newX); lp.y = (int) ((1 - r) * oldY + r * newY); child.requestLayout(); } }); va.addListener(new AnimatorListenerAdapter() { boolean cancelled = false; public void onAnimationEnd(Animator animation) { // If the animation was cancelled, it means that another animation // has interrupted this one, and we don't want to lock the item into // place just yet. if (!cancelled) { lp.isLockedToGrid = true; child.requestLayout(); } if (mReorderAnimators.containsKey(lp)) { mReorderAnimators.remove(lp); } } public void onAnimationCancel(Animator animation) { cancelled = true; } }); va.setStartDelay(delay); va.start(); return true; } return false; }
From source file:com.android.leanlauncher.CellLayout.java
public boolean animateChildToPosition(final View child, int cellX, int cellY, int duration, int delay, boolean permanent, boolean adjustOccupied) { ShortcutAndWidgetContainer clc = getShortcutsAndWidgets(); boolean[][] occupied = mOccupied; if (!permanent) { occupied = mTmpOccupied;/* w w w .j a v a2 s . c om*/ } if (clc.indexOfChild(child) != -1) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final ItemInfo info = (ItemInfo) child.getTag(); // We cancel any existing animations if (mReorderAnimators.containsKey(lp)) { mReorderAnimators.get(lp).cancel(); mReorderAnimators.remove(lp); } final int oldX = lp.x; final int oldY = lp.y; if (adjustOccupied) { occupied[lp.cellX][lp.cellY] = false; occupied[cellX][cellY] = true; } lp.isLockedToGrid = true; if (permanent) { lp.cellX = info.cellX = cellX; lp.cellY = info.cellY = cellY; } else { lp.tmpCellX = cellX; lp.tmpCellY = cellY; } clc.setupLp(lp); lp.isLockedToGrid = false; final int newX = lp.x; final int newY = lp.y; lp.x = oldX; lp.y = oldY; // Exit early if we're not actually moving the view if (oldX == newX && oldY == newY) { lp.isLockedToGrid = true; return true; } ValueAnimator va = LauncherAnimUtils.ofFloat(child, 0f, 1f); va.setDuration(duration); mReorderAnimators.put(lp, va); va.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float r = (Float) animation.getAnimatedValue(); lp.x = (int) ((1 - r) * oldX + r * newX); lp.y = (int) ((1 - r) * oldY + r * newY); child.requestLayout(); } }); va.addListener(new AnimatorListenerAdapter() { boolean cancelled = false; public void onAnimationEnd(Animator animation) { // If the animation was cancelled, it means that another animation // has interrupted this one, and we don't want to lock the item into // place just yet. if (!cancelled) { lp.isLockedToGrid = true; child.requestLayout(); } if (mReorderAnimators.containsKey(lp)) { mReorderAnimators.remove(lp); } } public void onAnimationCancel(Animator animation) { cancelled = true; } }); va.setStartDelay(delay); va.start(); return true; } return false; }
From source file:com.android.leanlauncher.LauncherTransitionable.java
/** * Launches the intent referred by the clicked shortcut. * * @param v The view representing the clicked shortcut. *//* www. j a va 2 s. c o m*/ public void onClick(View v) { // Make sure that rogue clicks don't get through while allapps is launching, or after the // view has detached (it's possible for this to happen if the view is removed mid touch). if (v.getWindowToken() == null) { return; } if (!mWorkspace.isFinishedSwitchingState()) { return; } if (v instanceof CellLayout || v instanceof Workspace) { if (mWorkspace.isInOverviewMode()) { mWorkspace.exitOverviewMode(true); return; } } Object tag = v.getTag(); if (tag instanceof ShortcutInfo) { onClickAppShortcut(v); } else if (v == mAllAppsButton) { onClickAllAppsButton(v); } else if (tag instanceof AppInfo) { startAppShortcutOrInfoActivity(v); } else if (tag instanceof LauncherAppWidgetInfo) { if (v instanceof PendingAppWidgetHostView) { onClickPendingWidget((PendingAppWidgetHostView) v); } } }
From source file:com.android.leanlauncher.Workspace.java
/** * Adds the specified child in the specified screen. The position and dimension of * the child are defined by x, y, spanX and spanY. * * @param child The child to add in one of the workspace's screens. * @param x The X position of the child in the screen's grid. * @param y The Y position of the child in the screen's grid. * @param spanX The number of cells spanned horizontally by the child. * @param spanY The number of cells spanned vertically by the child. * @param insert When true, the child is inserted at the beginning of the children list. *///from w w w . ja va 2 s . co m void addInScreen(View child, long container, int x, int y, int spanX, int spanY, boolean insert) { if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) { if (getScreen() == null) { Log.e(TAG, "Skipping child, screen not found"); // DEBUGGING - Print out the stack trace to see where we are adding from new Throwable().printStackTrace(); return; } } final CellLayout layout; layout = getScreen(); child.setOnKeyListener(new IconKeyEventListener()); ViewGroup.LayoutParams genericLp = child.getLayoutParams(); CellLayout.LayoutParams lp; if (genericLp == null || !(genericLp instanceof CellLayout.LayoutParams)) { lp = new CellLayout.LayoutParams(x, y, spanX, spanY); } else { lp = (CellLayout.LayoutParams) genericLp; lp.cellX = x; lp.cellY = y; lp.cellHSpan = spanX; lp.cellVSpan = spanY; } if (spanX < 0 && spanY < 0) { lp.isLockedToGrid = false; } // Get the canonical child id to uniquely represent this view in this screen ItemInfo info = (ItemInfo) child.getTag(); int childId = LauncherAppState.getInstance().getViewIdForItem(info); if (!layout.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, true)) { // TODO: This branch occurs when the workspace is adding views // outside of the defined grid // maybe we should be deleting these items from the LauncherModel? Log.d(TAG, "Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout"); } child.setHapticFeedbackEnabled(false); child.setOnLongClickListener(mLauncher); if (child instanceof DropTarget) { mDragController.addDropTarget((DropTarget) child); } }