Moving drag-drop related code into a separate package.
This is per an earlier CR comment "we should probably move all this code to its own package (launcher3.dragndrop) in a separate cl". I'm not moving DragSource because it's referred from gsa code. Bug: 22609426 Change-Id: Ia7204dab99c0c395c66b77143a2d60411153f5f3
This commit is contained in:
parent
08efde7e24
commit
fedca43d39
|
@ -39,7 +39,7 @@
|
|||
public int getY();
|
||||
}
|
||||
|
||||
-keep class com.android.launcher3.DragLayer$LayoutParams {
|
||||
-keep class com.android.launcher3.dragndrop.DragLayer$LayoutParams {
|
||||
public void setWidth(int);
|
||||
public int getWidth();
|
||||
public void setHeight(int);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
<com.android.launcher3.dragndrop.DragLayer
|
||||
android:id="@+id/drag_layer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -68,7 +68,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible" />
|
||||
</com.android.launcher3.DragLayer>
|
||||
</com.android.launcher3.dragndrop.DragLayer>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/launcher_overlay_stub"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
<com.android.launcher3.dragndrop.DragLayer
|
||||
android:id="@+id/drag_layer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -78,7 +78,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible" />
|
||||
</com.android.launcher3.DragLayer>
|
||||
</com.android.launcher3.dragndrop.DragLayer>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/launcher_overlay_stub"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.android.launcher3.DragLayer
|
||||
<com.android.launcher3.dragndrop.DragLayer
|
||||
android:id="@+id/drag_layer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -76,7 +76,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible" />
|
||||
</com.android.launcher3.DragLayer>
|
||||
</com.android.launcher3.dragndrop.DragLayer>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/launcher_overlay_stub"
|
||||
|
|
|
@ -27,7 +27,7 @@ import android.graphics.Rect;
|
|||
public class AnotherWindowDropTarget implements DropTarget {
|
||||
final Launcher mLauncher;
|
||||
|
||||
AnotherWindowDropTarget (Context context) { mLauncher = (Launcher) context; }
|
||||
public AnotherWindowDropTarget (Context context) { mLauncher = (Launcher) context; }
|
||||
|
||||
@Override
|
||||
public boolean isDropEnabled() { return true; }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.android.launcher3;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
|
|
|
@ -38,6 +38,9 @@ import android.view.animation.DecelerateInterpolator;
|
|||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
/**
|
||||
|
|
|
@ -405,7 +405,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
|
|||
mIsDragTarget = false;
|
||||
}
|
||||
|
||||
boolean isDragTarget() {
|
||||
public boolean isDragTarget() {
|
||||
return mIsDragTarget;
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
|
|||
}
|
||||
}
|
||||
|
||||
boolean getIsDragOverlapping() {
|
||||
public boolean getIsDragOverlapping() {
|
||||
return mIsDragOverlapping;
|
||||
}
|
||||
|
||||
|
@ -2802,10 +2802,10 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
|
|||
|
||||
// X coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
int x;
|
||||
public int x;
|
||||
// Y coordinate of the view in the layout.
|
||||
@ViewDebug.ExportedProperty
|
||||
int y;
|
||||
public int y;
|
||||
|
||||
boolean dropped;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.util.AttributeSet;
|
|||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.util.FlingAnimation;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package com.android.launcher3;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
|
||||
|
|
|
@ -52,11 +52,13 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.CellLayout.CellInfo;
|
||||
import com.android.launcher3.DragController.DragListener;
|
||||
import com.android.launcher3.FolderInfo.FolderListener;
|
||||
import com.android.launcher3.UninstallDropTarget.UninstallSource;
|
||||
import com.android.launcher3.Workspace.ItemOperator;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.AccessibilityDragSource;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.UiThreadCircularReveal;
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ import android.widget.TextView;
|
|||
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.FolderInfo.FolderListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.view.animation.OvershootInterpolator;
|
|||
import com.android.launcher3.FocusHelper.PagedFolderKeyEventListener;
|
||||
import com.android.launcher3.PageIndicator.PageMarkerResources;
|
||||
import com.android.launcher3.Workspace.ItemOperator;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -103,6 +103,9 @@ import com.android.launcher3.compat.LauncherAppsCompat;
|
|||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.LongArrayMap;
|
||||
|
@ -131,7 +134,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
public class Launcher extends Activity
|
||||
implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks,
|
||||
View.OnTouchListener, PageSwitchListener, LauncherProviderChangeListener {
|
||||
static final String TAG = "Launcher";
|
||||
public static final String TAG = "Launcher";
|
||||
static final boolean LOGD = false;
|
||||
|
||||
static final boolean PROFILE_STARTUP = false;
|
||||
|
|
|
@ -26,7 +26,8 @@ import android.view.ViewConfiguration;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import com.android.launcher3.DragLayer.TouchCompleteListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragLayer.TouchCompleteListener;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||
// the min drag distance for a fling to register, to prevent random page shifts
|
||||
private static final int MIN_LENGTH_FOR_FLING = 25;
|
||||
|
||||
protected static final int PAGE_SNAP_ANIMATION_DURATION = 750;
|
||||
public static final int PAGE_SNAP_ANIMATION_DURATION = 750;
|
||||
protected static final int SLOW_PAGE_SNAP_ANIMATION_DURATION = 950;
|
||||
|
||||
private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
|
||||
|
@ -381,7 +381,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||
/**
|
||||
* Returns the index of page to be shown immediately afterwards.
|
||||
*/
|
||||
int getNextPage() {
|
||||
public int getNextPage() {
|
||||
return (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.view.accessibility.AccessibilityManager;
|
|||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
/*
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ShortcutInfo extends ItemInfo {
|
|||
/**
|
||||
* The intent used to start the application.
|
||||
*/
|
||||
Intent intent;
|
||||
public Intent intent;
|
||||
|
||||
/**
|
||||
* Indicates whether the icon comes from an application's resource (if false)
|
||||
|
|
|
@ -68,6 +68,11 @@ import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.Accessi
|
|||
import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate;
|
||||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragScroller;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.dragndrop.SpringLoadedDragController;
|
||||
import com.android.launcher3.util.LongArrayMap;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.WallpaperUtils;
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.view.accessibility.AccessibilityManager;
|
|||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -20,7 +20,6 @@ import com.android.launcher3.AppInfo;
|
|||
import com.android.launcher3.AppWidgetResizeFrame;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeleteDropTarget;
|
||||
import com.android.launcher3.DragController.DragListener;
|
||||
import com.android.launcher3.DragSource;
|
||||
import com.android.launcher3.Folder;
|
||||
import com.android.launcher3.FolderInfo;
|
||||
|
@ -36,6 +35,7 @@ import com.android.launcher3.R;
|
|||
import com.android.launcher3.ShortcutInfo;
|
||||
import com.android.launcher3.UninstallDropTarget;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
@ -35,8 +35,18 @@ import android.view.View;
|
|||
import android.view.ViewConfiguration;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.android.launcher3.DeleteDropTarget;
|
||||
import com.android.launcher3.DragSource;
|
||||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.PagedView;
|
||||
import com.android.launcher3.ShortcutInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
|
@ -60,9 +70,9 @@ public class DragController implements DragDriver.EventListener {
|
|||
private static final int SCROLL_OUTSIDE_ZONE = 0;
|
||||
private static final int SCROLL_WAITING_IN_ZONE = 1;
|
||||
|
||||
static final int SCROLL_NONE = -1;
|
||||
static final int SCROLL_LEFT = 0;
|
||||
static final int SCROLL_RIGHT = 1;
|
||||
public static final int SCROLL_NONE = -1;
|
||||
public static final int SCROLL_LEFT = 0;
|
||||
public static final int SCROLL_RIGHT = 1;
|
||||
|
||||
private static final float MAX_FLING_DEGREES = 35f;
|
||||
|
||||
|
@ -420,7 +430,7 @@ public class DragController implements DragDriver.EventListener {
|
|||
return mTmpPoint;
|
||||
}
|
||||
|
||||
long getLastGestureUpTime() {
|
||||
public long getLastGestureUpTime() {
|
||||
if (mDragDriver != null) {
|
||||
return System.currentTimeMillis();
|
||||
} else {
|
||||
|
@ -428,7 +438,7 @@ public class DragController implements DragDriver.EventListener {
|
|||
}
|
||||
}
|
||||
|
||||
void resetLastGestureUpTime() {
|
||||
public void resetLastGestureUpTime() {
|
||||
mLastTouchUpTime = -1;
|
||||
}
|
||||
|
||||
|
@ -536,7 +546,7 @@ public class DragController implements DragDriver.EventListener {
|
|||
/**
|
||||
* Sets the view that should handle move events.
|
||||
*/
|
||||
void setMoveTarget(View view) {
|
||||
public void setMoveTarget(View view) {
|
||||
mMoveTarget = view;
|
||||
}
|
||||
|
|
@ -14,7 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import com.android.launcher3.AnotherWindowDropTarget;
|
||||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.Intent;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
|
@ -40,9 +40,24 @@ import android.view.animation.Interpolator;
|
|||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.AppWidgetResizeFrame;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Folder;
|
||||
import com.android.launcher3.FolderIcon;
|
||||
import com.android.launcher3.InsettableFrameLayout;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherAppWidgetHostView;
|
||||
import com.android.launcher3.SearchDropTargetBar;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
@ -890,7 +905,7 @@ public class DragLayer extends InsettableFrameLayout {
|
|||
invalidate();
|
||||
}
|
||||
|
||||
void showPageHints() {
|
||||
public void showPageHints() {
|
||||
mShowPageHints = true;
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
getDescendantRectRelativeToSelf(workspace.getChildAt(workspace.numCustomPages()),
|
||||
|
@ -898,7 +913,7 @@ public class DragLayer extends InsettableFrameLayout {
|
|||
invalidate();
|
||||
}
|
||||
|
||||
void hidePageHints() {
|
||||
public void hidePageHints() {
|
||||
mShowPageHints = false;
|
||||
invalidate();
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
/**
|
||||
* Handles scrolling while dragging
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
|
@ -35,7 +35,14 @@ import android.graphics.Rect;
|
|||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class DragView extends View {
|
|
@ -14,7 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
package com.android.launcher3.dragndrop;
|
||||
|
||||
import com.android.launcher3.Alarm;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.OnAlarmListener;
|
||||
import com.android.launcher3.Workspace;
|
||||
|
||||
public class SpringLoadedDragController implements OnAlarmListener {
|
||||
// how long the user must hover over a mini-screen before it unshrinks
|
|
@ -7,9 +7,9 @@ import android.graphics.PointF;
|
|||
import android.graphics.Rect;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import com.android.launcher3.DragLayer;
|
||||
import com.android.launcher3.DragView;
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.dragndrop.DragView;
|
||||
|
||||
public class FlingAnimation implements AnimatorUpdateListener {
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ import android.os.Handler;
|
|||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.AppWidgetResizeFrame;
|
||||
import com.android.launcher3.DragController.DragListener;
|
||||
import com.android.launcher3.DragLayer;
|
||||
import com.android.launcher3.DragSource;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.compat.AppWidgetManagerCompat;
|
||||
import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
public class WidgetHostViewLoader implements DragListener {
|
||||
|
|
|
@ -32,7 +32,6 @@ import com.android.launcher3.BaseContainerView;
|
|||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeleteDropTarget;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DragController;
|
||||
import com.android.launcher3.DragSource;
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.Folder;
|
||||
|
@ -45,6 +44,7 @@ import com.android.launcher3.R;
|
|||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.WidgetPreviewLoader;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
|
|
Loading…
Reference in New Issue