Search in sources :

Example 76 with DragLayer

use of com.android.launcher3.dragndrop.DragLayer in project android_packages_apps_404Launcher by P-404.

the class FloatingTaskView method getFloatingTaskView.

/**
 * Configures and returns a an instance of {@link FloatingTaskView} initially matching the
 * appearance of {@code originalView}.
 */
public static FloatingTaskView getFloatingTaskView(StatefulActivity launcher, TaskView originalView, RectF positionOut) {
    final BaseDragLayer dragLayer = launcher.getDragLayer();
    ViewGroup parent = (ViewGroup) dragLayer.getParent();
    final FloatingTaskView floatingView = (FloatingTaskView) launcher.getLayoutInflater().inflate(R.layout.floating_split_select_view, parent, false);
    floatingView.init(launcher, originalView, positionOut);
    parent.addView(floatingView);
    return floatingView;
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer) ViewGroup(android.view.ViewGroup)

Example 77 with DragLayer

use of com.android.launcher3.dragndrop.DragLayer in project android_packages_apps_404Launcher by P-404.

the class StatefulActivity method onStop.

@Override
protected void onStop() {
    BaseDragLayer dragLayer = getDragLayer();
    final boolean wasActive = isUserActive();
    final STATE_TYPE origState = getStateManager().getState();
    final int origDragLayerChildCount = dragLayer.getChildCount();
    super.onStop();
    if (!isChangingConfigurations()) {
        getStateManager().moveToRestState();
    }
    // Workaround for b/78520668, explicitly trim memory once UI is hidden
    onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
    if (wasActive) {
        // The expected condition is that this activity is stopped because the device goes to
        // sleep and the UI may have noticeable changes.
        dragLayer.post(() -> {
            if ((!getStateManager().isInStableState(origState) || // The drag layer may be animating (e.g. dismissing QSB).
            dragLayer.getAlpha() < 1 || // Maybe an ArrowPopup is closed.
            dragLayer.getChildCount() != origDragLayerChildCount)) {
                onUiChangedWhileSleeping();
            }
        });
    }
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer)

Example 78 with DragLayer

use of com.android.launcher3.dragndrop.DragLayer in project android_packages_apps_404Launcher by P-404.

the class AllAppsEduView method show.

/**
 * Shows the All Apps education view and plays the animation.
 */
public static void show(Launcher launcher) {
    final DragLayer dragLayer = launcher.getDragLayer();
    AllAppsEduView view = (AllAppsEduView) launcher.getLayoutInflater().inflate(R.layout.all_apps_edu_view, dragLayer, false);
    view.init(launcher);
    launcher.getDragLayer().addView(view);
    launcher.getStatsLogManager().logger().log(LAUNCHER_ALL_APPS_EDU_SHOWN);
    view.requestLayout();
    view.playAnimation();
}
Also used : DragLayer(com.android.launcher3.dragndrop.DragLayer)

Example 79 with DragLayer

use of com.android.launcher3.dragndrop.DragLayer in project android_packages_apps_404Launcher by P-404.

the class LauncherAppWidgetHostView method onInterceptTouchEvent.

public boolean onInterceptTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        DragLayer dragLayer = mLauncher.getDragLayer();
        if (mIsScrollable) {
            dragLayer.requestDisallowInterceptTouchEvent(true);
        }
        dragLayer.setTouchCompleteListener(this);
    }
    mLongPressHelper.onTouchEvent(ev);
    return mLongPressHelper.hasPerformedLongPress();
}
Also used : DragLayer(com.android.launcher3.dragndrop.DragLayer)

Example 80 with DragLayer

use of com.android.launcher3.dragndrop.DragLayer in project android_packages_apps_404Launcher by P-404.

the class Workspace method animateWidgetDrop.

public void animateWidgetDrop(ItemInfo info, CellLayout cellLayout, final DragView dragView, final Runnable onCompleteRunnable, int animationType, final View finalView, boolean external) {
    int[] finalPos = new int[2];
    float[] scaleXY = new float[2];
    boolean scalePreview = !(info instanceof PendingAddShortcutInfo);
    getFinalPositionForDropAnimation(finalPos, scaleXY, dragView, cellLayout, info, mTargetCell, scalePreview);
    Resources res = mLauncher.getResources();
    final int duration = res.getInteger(R.integer.config_dropAnimMaxDuration) - 200;
    boolean isWidget = info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
    if ((animationType == ANIMATE_INTO_POSITION_AND_RESIZE || external) && finalView != null && dragView.getContentView() != finalView) {
        Drawable crossFadeDrawable = createWidgetDrawable(info, finalView);
        dragView.crossFadeContent(crossFadeDrawable, (int) (duration * 0.8f));
    } else if (isWidget && external) {
        scaleXY[0] = scaleXY[1] = Math.min(scaleXY[0], scaleXY[1]);
    }
    DragLayer dragLayer = mLauncher.getDragLayer();
    if (animationType == CANCEL_TWO_STAGE_WIDGET_DROP_ANIMATION) {
        mLauncher.getDragLayer().animateViewIntoPosition(dragView, finalPos, 0f, 0.1f, 0.1f, DragLayer.ANIMATION_END_DISAPPEAR, onCompleteRunnable, duration);
    } else {
        int endStyle;
        if (animationType == ANIMATE_INTO_POSITION_AND_REMAIN) {
            endStyle = DragLayer.ANIMATION_END_REMAIN_VISIBLE;
        } else {
            endStyle = DragLayer.ANIMATION_END_DISAPPEAR;
        }
        Runnable onComplete = new Runnable() {

            @Override
            public void run() {
                if (finalView != null) {
                    finalView.setVisibility(VISIBLE);
                }
                if (onCompleteRunnable != null) {
                    onCompleteRunnable.run();
                }
            }
        };
        dragLayer.animateViewIntoPosition(dragView, finalPos[0], finalPos[1], 1, scaleXY[0], scaleXY[1], onComplete, endStyle, duration, this);
    }
}
Also used : DragLayer(com.android.launcher3.dragndrop.DragLayer) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Drawable(android.graphics.drawable.Drawable) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) Resources(android.content.res.Resources) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

DragLayer (com.android.launcher3.dragndrop.DragLayer)100 Rect (android.graphics.Rect)67 BaseDragLayer (com.android.launcher3.views.BaseDragLayer)33 ViewGroup (android.view.ViewGroup)23 Resources (android.content.res.Resources)22 AnimatorSet (android.animation.AnimatorSet)20 View (android.view.View)18 SuppressLint (android.annotation.SuppressLint)16 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)15 DeviceProfile (com.android.launcher3.DeviceProfile)15 Workspace (com.android.launcher3.Workspace)15 Animator (android.animation.Animator)14 ObjectAnimator (android.animation.ObjectAnimator)14 Point (android.graphics.Point)12 ItemInfo (com.android.launcher3.model.data.ItemInfo)12 CellLayout (com.android.launcher3.CellLayout)11 DragView (com.android.launcher3.dragndrop.DragView)11 ArrayList (java.util.ArrayList)11 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)10 Drawable (android.graphics.drawable.Drawable)10