Search in sources :

Example 16 with R

use of com.android.launcher3.R in project android_packages_apps_Launcher3 by crdroidandroid.

the class BaseWidgetSheet method beginDraggingWidget.

private boolean beginDraggingWidget(WidgetCell v) {
    // Get the widget preview as the drag representation
    WidgetImageView image = v.getWidgetView();
    // we abort the drag.
    if (image.getDrawable() == null && v.getAppWidgetHostViewPreview() == null) {
        return false;
    }
    PendingItemDragHelper dragHelper = new PendingItemDragHelper(v);
    dragHelper.setRemoteViewsPreview(v.getRemoteViewsPreview());
    dragHelper.setAppWidgetHostViewPreview(v.getAppWidgetHostViewPreview());
    if (image.getDrawable() != null) {
        int[] loc = new int[2];
        getPopupContainer().getLocationInDragLayer(image, loc);
        dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(), image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
    } else {
        View preview = v.getAppWidgetHostViewPreview();
        int[] loc = new int[2];
        getPopupContainer().getLocationInDragLayer(preview, loc);
        Rect r = new Rect(0, 0, preview.getWidth(), preview.getHeight());
        dragHelper.startDrag(r, preview.getMeasuredWidth(), preview.getMeasuredWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
    }
    close(true);
    return true;
}
Also used : DragOptions(com.android.launcher3.dragndrop.DragOptions) Rect(android.graphics.Rect) Point(android.graphics.Point) View(android.view.View) AbstractSlideInView(com.android.launcher3.views.AbstractSlideInView) ArrowTipView(com.android.launcher3.views.ArrowTipView)

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