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;
}
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();
}
});
}
}
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();
}
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();
}
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);
}
}
Aggregations