diff options
author | Tony Wickham <twickham@google.com> | 2017-03-20 17:12:24 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-03-30 15:48:53 -0700 |
commit | 50e5165b78c75ccb022f0954699f49c579547115 (patch) | |
tree | 754a3dfe45fbed74cb3b122312304cf406226ebf /src/com/android/launcher3/widget/WidgetsContainerView.java | |
parent | 8eb0de133154666cd20d0244953ee755b626b44a (diff) | |
download | android_packages_apps_Trebuchet-50e5165b78c75ccb022f0954699f49c579547115.tar.gz android_packages_apps_Trebuchet-50e5165b78c75ccb022f0954699f49c579547115.tar.bz2 android_packages_apps_Trebuchet-50e5165b78c75ccb022f0954699f49c579547115.zip |
Add WidgetsAndMore bottom sheet
- Contains two rows, one for widgets, and one for "configurable
shortcuts" that have customization activities
- Extends AbstractFloatingView and uses VerticalPullDetector for
touch interactions
- No way to show this currently; will add options to popup in followup
Bug: 34940468
Change-Id: Iab62c2cb89428f91119c9c86f9db886496c321fd
Diffstat (limited to 'src/com/android/launcher3/widget/WidgetsContainerView.java')
-rw-r--r-- | src/com/android/launcher3/widget/WidgetsContainerView.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java index b2321a7d3..ba6ed41f6 100644 --- a/src/com/android/launcher3/widget/WidgetsContainerView.java +++ b/src/com/android/launcher3/widget/WidgetsContainerView.java @@ -29,13 +29,10 @@ import com.android.launcher3.BaseContainerView; import com.android.launcher3.DeleteDropTarget; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.IconCache; import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.folder.Folder; import com.android.launcher3.model.PackageItemInfo; @@ -55,8 +52,6 @@ public class WidgetsContainerView extends BaseContainerView /* Global instances that are used inside this container. */ @Thunk Launcher mLauncher; - private DragController mDragController; - private IconCache mIconCache; /* Recycler view related member variables */ private WidgetsRecyclerView mRecyclerView; @@ -76,9 +71,7 @@ public class WidgetsContainerView extends BaseContainerView public WidgetsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mLauncher = Launcher.getLauncher(context); - mDragController = mLauncher.getDragController(); mAdapter = new WidgetsListAdapter(this, this, context); - mIconCache = LauncherAppState.getInstance(context).getIconCache(); if (LOGD) { Log.d(TAG, "WidgetsContainerView constructor"); } @@ -116,6 +109,10 @@ public class WidgetsContainerView extends BaseContainerView || mLauncher.getWorkspace().isSwitchingState() || !(v instanceof WidgetCell)) return; + handleClick(); + } + + public void handleClick() { // Let the user know that they have to long press to add a widget if (mWidgetInstructionToast != null) { mWidgetInstructionToast.cancel(); @@ -130,14 +127,19 @@ public class WidgetsContainerView extends BaseContainerView @Override public boolean onLongClick(View v) { + // When we have exited the widget tray, disregard long clicks + if (!mLauncher.isWidgetsViewVisible()) return false; + return handleLongClick(v); + } + + public boolean handleLongClick(View v) { if (LOGD) { Log.d(TAG, String.format("onLongClick [v=%s]", v)); } // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; - // When we have exited all apps or are in transition, disregard long clicks - if (!mLauncher.isWidgetsViewVisible() || - mLauncher.getWorkspace().isSwitchingState()) return false; + // When we are in transition, disregard long clicks + if (mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; |