Search in sources :

Example 41 with LayoutParams

use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by ArrowOS.

the class FloatingSurfaceView method updateIconLocation.

private void updateIconLocation() {
    if (mContract == null) {
        return;
    }
    View icon = mLauncher.getFirstMatchForAppClose(-1, mContract.componentName.getPackageName(), mContract.user);
    boolean iconChanged = mIcon != icon;
    if (iconChanged) {
        setCurrentIconVisible(true);
        mIcon = icon;
        setCurrentIconVisible(false);
    }
    if (icon != null && icon.isAttachedToWindow()) {
        getLocationBoundsForView(mLauncher, icon, false, mTmpPosition, mIconBounds);
        if (!mTmpPosition.equals(mIconPosition)) {
            mIconPosition.set(mTmpPosition);
            sendIconInfo();
            LayoutParams lp = (LayoutParams) mSurfaceView.getLayoutParams();
            lp.width = Math.round(mIconPosition.width());
            lp.height = Math.round(mIconPosition.height());
            lp.leftMargin = Math.round(mIconPosition.left);
            lp.topMargin = Math.round(mIconPosition.top);
        }
    }
    if (mIcon != null && iconChanged && !mIconBounds.isEmpty()) {
        // Record the icon display
        setCurrentIconVisible(true);
        Canvas c = mPicture.beginRecording(mIconBounds.width(), mIconBounds.height());
        c.translate(-mIconBounds.left, -mIconBounds.top);
        mIcon.draw(c);
        mPicture.endRecording();
        setCurrentIconVisible(false);
        drawOnSurface();
    }
}
Also used : Canvas(android.graphics.Canvas) SurfaceView(android.view.SurfaceView) FloatingIconView.getLocationBoundsForView(com.android.launcher3.views.FloatingIconView.getLocationBoundsForView) View(android.view.View) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Example 42 with LayoutParams

use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by ArrowOS.

the class DigitalWellBeingToast method setupAndAddBanner.

private void setupAndAddBanner() {
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mBanner.getLayoutParams();
    DeviceProfile deviceProfile = mActivity.getDeviceProfile();
    layoutParams.bottomMargin = ((ViewGroup.MarginLayoutParams) mTaskView.getThumbnail().getLayoutParams()).bottomMargin;
    PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler();
    Pair<Float, Float> translations = orientationHandler.setDwbLayoutParamsAndGetTranslations(mTaskView.getMeasuredWidth(), mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getThumbnails(), mTask.key.id, mBanner);
    mSplitOffsetTranslationX = translations.first;
    mSplitOffsetTranslationY = translations.second;
    updateTranslationY();
    updateTranslationX();
    mTaskView.addView(mBanner);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) ViewGroup(android.view.ViewGroup) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) FrameLayout(android.widget.FrameLayout)

Example 43 with LayoutParams

use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by ArrowOS.

the class Folder method getHeightFromBottom.

/**
 * Returns the height of the current folder's bottom edge from the bottom of the screen.
 */
private int getHeightFromBottom() {
    BaseDragLayer.LayoutParams layoutParams = (BaseDragLayer.LayoutParams) getLayoutParams();
    int folderBottomPx = layoutParams.y + layoutParams.height;
    int windowBottomPx = mActivityContext.getDeviceProfile().heightPx;
    return windowBottomPx - folderBottomPx;
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer) SuppressLint(android.annotation.SuppressLint)

Example 44 with LayoutParams

use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by ArrowOS.

the class TaskView method setOrientationState.

public void setOrientationState(RecentsOrientedState orientationState) {
    PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
    boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
    LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
    DeviceProfile deviceProfile = mActivity.getDeviceProfile();
    snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
    boolean isGridTask = isGridTask();
    int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
    int taskMargin = isGridTask ? deviceProfile.overviewTaskMarginGridPx : deviceProfile.overviewTaskMarginPx;
    int taskIconMargin = snapshotParams.topMargin - taskIconHeight - taskMargin;
    LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
    orientationHandler.setIconAndSnapshotParams(mIconView, taskIconMargin, taskIconHeight, snapshotParams, isRtl);
    mSnapshotView.setLayoutParams(snapshotParams);
    iconParams.width = iconParams.height = taskIconHeight;
    mIconView.setLayoutParams(iconParams);
    mIconView.setRotation(orientationHandler.getDegreesRotated());
    int iconDrawableSize = isGridTask ? deviceProfile.overviewTaskIconDrawableSizeGridPx : deviceProfile.overviewTaskIconDrawableSizePx;
    mIconView.setDrawableSize(iconDrawableSize, iconDrawableSize);
    snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
    mSnapshotView.setLayoutParams(snapshotParams);
    mSnapshotView.getTaskOverlay().updateOrientationState(orientationState);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 45 with LayoutParams

use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by ArrowOS.

the class CellLayout method copySolutionToTempState.

private void copySolutionToTempState(ItemConfiguration solution, View dragView) {
    mTmpOccupied.clear();
    int childCount = mShortcutsAndWidgets.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = mShortcutsAndWidgets.getChildAt(i);
        if (child == dragView)
            continue;
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        CellAndSpan c = solution.map.get(child);
        if (c != null) {
            lp.tmpCellX = c.cellX;
            lp.tmpCellY = c.cellY;
            lp.cellHSpan = c.spanX;
            lp.cellVSpan = c.spanY;
            mTmpOccupied.markCells(c, true);
        }
    }
    mTmpOccupied.markCells(solution, true);
}
Also used : CellAndSpan(com.android.launcher3.util.CellAndSpan) DraggableView(com.android.launcher3.dragndrop.DraggableView) View(android.view.View) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

View (android.view.View)79 SuppressLint (android.annotation.SuppressLint)61 Paint (android.graphics.Paint)59 Point (android.graphics.Point)58 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)49 DraggableView (com.android.launcher3.dragndrop.DraggableView)40 CellAndSpan (com.android.launcher3.util.CellAndSpan)35 Rect (android.graphics.Rect)23 BubbleTextView (com.android.launcher3.BubbleTextView)21 ItemInfo (com.android.launcher3.model.data.ItemInfo)17 Animator (android.animation.Animator)16 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)16 ObjectAnimator (android.animation.ObjectAnimator)15 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)15 FrameLayout (android.widget.FrameLayout)13 DeviceProfile (com.android.launcher3.DeviceProfile)13 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)10 ValueAnimator (android.animation.ValueAnimator)9 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)8 TimeInterpolator (android.animation.TimeInterpolator)7