use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.
the class ArrowPopup method onLayout.
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
// enforce contained is within screen
BaseDragLayer dragLayer = getPopupContainer();
Rect insets = dragLayer.getInsets();
if (getTranslationX() + l < insets.left || getTranslationX() + r > dragLayer.getWidth() - insets.right) {
// If we are still off screen, center horizontally too.
mGravity |= Gravity.CENTER_HORIZONTAL;
}
if (Gravity.isHorizontal(mGravity)) {
setX(dragLayer.getWidth() / 2 - getMeasuredWidth() / 2);
mArrow.setVisibility(INVISIBLE);
}
if (Gravity.isVertical(mGravity)) {
setY(dragLayer.getHeight() / 2 - getMeasuredHeight() / 2);
}
}
use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.
the class AddWorkspaceItemsTask method findNextAvailableIconSpaceInScreen.
private boolean findNextAvailableIconSpaceInScreen(LauncherAppState app, ArrayList<ItemInfo> occupiedPos, int[] xy, int spanX, int spanY) {
InvariantDeviceProfile profile = app.getInvariantDeviceProfile();
GridOccupancy occupied = new GridOccupancy(profile.numColumns, profile.numRows);
if (occupiedPos != null) {
for (ItemInfo r : occupiedPos) {
occupied.markCells(r, true);
}
}
return occupied.findVacantCell(xy, spanX, spanY);
}
use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherActivityInterface method setOnDeferredActivityLaunchCallback.
@Override
public void setOnDeferredActivityLaunchCallback(Runnable r) {
Launcher launcher = getCreatedActivity();
if (launcher == null) {
return;
}
launcher.setOnDeferredActivityLaunchCallback(r);
}
use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.
the class AddWorkspaceItemsTaskTest method writeWorkspaceWithHoles.
private int writeWorkspaceWithHoles(BgDataModel bgDataModel, int startId, int screenId, Rect... holes) {
GridOccupancy occupancy = new GridOccupancy(mIdp.numColumns, mIdp.numRows);
occupancy.markCells(0, 0, mIdp.numColumns, mIdp.numRows, true);
for (Rect r : holes) {
occupancy.markCells(r, false);
}
mExistingScreens.add(screenId);
mScreenOccupancy.append(screenId, occupancy);
for (int x = 0; x < mIdp.numColumns; x++) {
for (int y = 0; y < mIdp.numRows; y++) {
if (!occupancy.cells[x][y]) {
continue;
}
WorkspaceItemInfo info = new WorkspaceItemInfo();
info.intent = new Intent().setComponent(mComponent1);
info.id = startId++;
info.screenId = screenId;
info.cellX = x;
info.cellY = y;
info.container = LauncherSettings.Favorites.CONTAINER_DESKTOP;
bgDataModel.addItem(mTargetContext, info, false);
ContentWriter writer = new ContentWriter(mTargetContext);
info.writeToValues(writer);
writer.put(Favorites._ID, info.id);
mTargetContext.getContentResolver().insert(Favorites.CONTENT_URI, writer.getValues(mTargetContext));
}
}
return startId;
}
use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.
the class AllAppsEduView method init.
private void init(Launcher launcher) {
mLauncher = launcher;
mTouchController = new AllAppsEduTouchController(mLauncher);
int accentColor = Themes.getColorAccent(launcher);
mGradient = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, Themes.getAttrBoolean(launcher, R.attr.isMainColorDark) ? new int[] { 0xB3FFFFFF, 0x00FFFFFF } : new int[] { ColorUtils.setAlphaComponent(accentColor, 127), ColorUtils.setAlphaComponent(accentColor, 0) });
float r = mWidthPx / 2f;
mGradient.setCornerRadii(new float[] { r, r, r, r, 0, 0, 0, 0 });
int top = mMaxHeightPx - mCircleSizePx + mPaddingPx;
mCircle.setBounds(mPaddingPx, top, mPaddingPx + mCircleSizePx, top + mCircleSizePx);
mGradient.setBounds(0, mMaxHeightPx - mCircleSizePx, mWidthPx, mMaxHeightPx);
DeviceProfile grid = launcher.getDeviceProfile();
DragLayer.LayoutParams lp = new DragLayer.LayoutParams(mWidthPx, mMaxHeightPx);
lp.ignoreInsets = true;
lp.leftMargin = (grid.widthPx - mWidthPx) / 2;
lp.topMargin = grid.heightPx - grid.hotseatBarSizePx - mMaxHeightPx;
setLayoutParams(lp);
}
Aggregations