Search in sources :

Example 11 with R

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);
    }
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer) Rect(android.graphics.Rect)

Example 12 with R

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);
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) GridOccupancy(com.android.launcher3.util.GridOccupancy)

Example 13 with R

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);
}
Also used : Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher)

Example 14 with 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;
}
Also used : Rect(android.graphics.Rect) ContentWriter(com.android.launcher3.util.ContentWriter) Intent(android.content.Intent) GridOccupancy(com.android.launcher3.util.GridOccupancy) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo)

Example 15 with R

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);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) DragLayer(com.android.launcher3.dragndrop.DragLayer) GradientDrawable(android.graphics.drawable.GradientDrawable)

Aggregations

View (android.view.View)6 Point (android.graphics.Point)5 Rect (android.graphics.Rect)5 Animator (android.animation.Animator)3 ValueAnimator (android.animation.ValueAnimator)3 Paint (android.graphics.Paint)3 GridOccupancy (com.android.launcher3.util.GridOccupancy)3 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)2 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)2 FolderRingAnimator (com.android.launcher3.FolderIcon.FolderRingAnimator)2 ItemInfo (com.android.launcher3.model.data.ItemInfo)2 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)2 ArrowTipView (com.android.launcher3.views.ArrowTipView)2 ObjectAnimator (android.animation.ObjectAnimator)1 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1