use of com.android.launcher3.tapl.Folder in project Neo-Launcher by NeoApplications.
the class FolderIcon method drawLeaveBehindIfExists.
public void drawLeaveBehindIfExists() {
if (isInAppDrawer()) {
return;
}
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
// While the folder is open, the position of the icon cannot change.
lp.canReorder = false;
if (mInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
CellLayout cl = (CellLayout) getParent().getParent();
cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
}
}
use of com.android.launcher3.tapl.Folder in project Neo-Launcher by NeoApplications.
the class PreviewItemManager method setDrawable.
private void setDrawable(PreviewItemDrawingParams p, WorkspaceItemInfo item) {
if (item.hasPromiseIconUi()) {
PreloadIconDrawable drawable = mDrawableFactory.newPendingIcon(mContext, item);
drawable.setLevel(item.getInstallProgress());
p.drawable = drawable;
} else {
p.drawable = mDrawableFactory.newIcon(mContext, item);
}
p.drawable.setBounds(0, 0, mIconSize, mIconSize);
p.item = item;
// Set the callback to FolderIcon as it is responsible to drawing the icon. The
// callback will be released when the folder is opened.
p.drawable.setCallback(mIcon);
}
use of com.android.launcher3.tapl.Folder in project Neo-Launcher by NeoApplications.
the class GridSizeMigrationTask method loadHotseatEntries.
private ArrayList<DbEntry> loadHotseatEntries() {
Cursor c = queryWorkspace(new String[] { // 0
Favorites._ID, // 1
Favorites.ITEM_TYPE, // 2
Favorites.INTENT, // 3
Favorites.SCREEN }, Favorites.CONTAINER + " = " + Favorites.CONTAINER_HOTSEAT);
final int indexId = c.getColumnIndexOrThrow(Favorites._ID);
final int indexItemType = c.getColumnIndexOrThrow(Favorites.ITEM_TYPE);
final int indexIntent = c.getColumnIndexOrThrow(Favorites.INTENT);
final int indexScreen = c.getColumnIndexOrThrow(Favorites.SCREEN);
ArrayList<DbEntry> entries = new ArrayList<>();
while (c.moveToNext()) {
DbEntry entry = new DbEntry();
entry.id = c.getInt(indexId);
entry.itemType = c.getInt(indexItemType);
entry.screenId = c.getInt(indexScreen);
if (entry.screenId >= mSrcHotseatSize) {
mEntryToRemove.add(entry.id);
continue;
}
try {
// calculate weight
switch(entry.itemType) {
case Favorites.ITEM_TYPE_SHORTCUT:
case Favorites.ITEM_TYPE_DEEP_SHORTCUT:
case Favorites.ITEM_TYPE_APPLICATION:
{
verifyIntent(c.getString(indexIntent));
entry.weight = entry.itemType == Favorites.ITEM_TYPE_APPLICATION ? WT_APPLICATION : WT_SHORTCUT;
break;
}
case Favorites.ITEM_TYPE_FOLDER:
{
int total = getFolderItemsCount(entry.id);
if (total == 0) {
throw new Exception("Folder is empty");
}
entry.weight = WT_FOLDER_FACTOR * total;
break;
}
default:
throw new Exception("Invalid item type");
}
} catch (Exception e) {
if (DEBUG) {
Log.d(TAG, "Removing item " + entry.id, e);
}
mEntryToRemove.add(entry.id);
continue;
}
entries.add(entry);
}
c.close();
return entries;
}
use of com.android.launcher3.tapl.Folder in project Neo-Launcher by NeoApplications.
the class GridSizeMigrationTask method getFolderItemsCount.
/**
* @return the number of valid items in the folder.
*/
private int getFolderItemsCount(int folderId) {
Cursor c = queryWorkspace(new String[] { Favorites._ID, Favorites.INTENT }, Favorites.CONTAINER + " = " + folderId);
int total = 0;
while (c.moveToNext()) {
try {
verifyIntent(c.getString(1));
total++;
} catch (Exception e) {
mEntryToRemove.add(c.getInt(0));
}
}
c.close();
return total;
}
use of com.android.launcher3.tapl.Folder in project Neo-Launcher by NeoApplications.
the class PopupContainerWithArrow method onLongClick.
@Override
public boolean onLongClick(View v) {
if (!ItemLongClickListener.canStartDrag(mLauncher))
return false;
// Return early if not the correct view
if (!(v.getParent() instanceof DeepShortcutView))
return false;
// Long clicked on a shortcut.
DeepShortcutView sv = (DeepShortcutView) v.getParent();
sv.setWillDrawIcon(false);
// Move the icon to align with the center-top of the touch point
Point iconShift = new Point();
iconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
iconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx;
DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(), this, sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), iconShift), new DragOptions());
dv.animateShift(-iconShift.x, -iconShift.y);
// TODO: support dragging from within folder without having to close it
AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_FOLDER);
return false;
}
Aggregations