From 343a77e609382bcb9b1d69ea235a9e6d779b719e Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 12 Apr 2017 18:31:09 -0700 Subject: [PATCH] Rename WidgetsAndMore to WidgetsBottomSheet (It only contains widgets now.) Bug: 35766387 Change-Id: I5864791a9741d1c56ac6df30125fe7a4a677b4bd --- ..._and_more.xml => widgets_bottom_sheet.xml} | 4 ++-- .../launcher3/AbstractFloatingView.java | 6 +++--- .../launcher3/dragndrop/DragLayer.java | 9 ++++---- .../launcher3/popup/SystemShortcut.java | 10 ++++----- ...tsAndMore.java => WidgetsBottomSheet.java} | 21 ++++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) rename res/layout/{widgets_and_more.xml => widgets_bottom_sheet.xml} (95%) rename src/com/android/launcher3/widget/{WidgetsAndMore.java => WidgetsBottomSheet.java} (93%) diff --git a/res/layout/widgets_and_more.xml b/res/layout/widgets_bottom_sheet.xml similarity index 95% rename from res/layout/widgets_and_more.xml rename to res/layout/widgets_bottom_sheet.xml index 6764aa7cbd..826235bfb1 100644 --- a/res/layout/widgets_and_more.xml +++ b/res/layout/widgets_bottom_sheet.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index 1f1203498b..597e937039 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -37,13 +37,13 @@ public abstract class AbstractFloatingView extends LinearLayout { @IntDef(flag = true, value = { TYPE_FOLDER, TYPE_POPUP_CONTAINER_WITH_ARROW, - TYPE_WIDGETS_AND_MORE + TYPE_WIDGETS_BOTTOM_SHEET }) @Retention(RetentionPolicy.SOURCE) public @interface FloatingViewType {} public static final int TYPE_FOLDER = 1 << 0; public static final int TYPE_POPUP_CONTAINER_WITH_ARROW = 1 << 1; - public static final int TYPE_WIDGETS_AND_MORE = 1 << 2; + public static final int TYPE_WIDGETS_BOTTOM_SHEET = 1 << 2; protected boolean mIsOpen; @@ -139,7 +139,7 @@ public abstract class AbstractFloatingView extends LinearLayout { public static AbstractFloatingView getTopOpenView(Launcher launcher) { return getOpenView(launcher, TYPE_FOLDER | TYPE_POPUP_CONTAINER_WITH_ARROW - | TYPE_WIDGETS_AND_MORE); + | TYPE_WIDGETS_BOTTOM_SHEET); } public abstract int getLogContainerType(); diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index b04d5b7476..14f4e6cb63 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -58,10 +58,9 @@ import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.logging.LoggerUtils; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.TouchController; -import com.android.launcher3.widget.WidgetsAndMore; +import com.android.launcher3.widget.WidgetsBottomSheet; import java.util.ArrayList; @@ -247,9 +246,9 @@ public class DragLayer extends InsettableFrameLayout { return true; } - WidgetsAndMore widgetsAndMore = WidgetsAndMore.getOpen(mLauncher); - if (widgetsAndMore != null && widgetsAndMore.onControllerInterceptTouchEvent(ev)) { - mActiveController = widgetsAndMore; + WidgetsBottomSheet widgetsBottomSheet = WidgetsBottomSheet.getOpen(mLauncher); + if (widgetsBottomSheet != null && widgetsBottomSheet.onControllerInterceptTouchEvent(ev)) { + mActiveController = widgetsBottomSheet; return true; } diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index fa70de911e..de884996ba 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -11,7 +11,7 @@ import com.android.launcher3.R; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.Themes; -import com.android.launcher3.widget.WidgetsAndMore; +import com.android.launcher3.widget.WidgetsBottomSheet; import java.util.List; @@ -62,10 +62,10 @@ public abstract class SystemShortcut { @Override public void onClick(View view) { PopupContainerWithArrow.getOpen(launcher).close(true); - WidgetsAndMore widgetsAndMore = - (WidgetsAndMore) launcher.getLayoutInflater().inflate( - R.layout.widgets_and_more, launcher.getDragLayer(), false); - widgetsAndMore.populateAndShow(itemInfo); + WidgetsBottomSheet widgetsBottomSheet = + (WidgetsBottomSheet) launcher.getLayoutInflater().inflate( + R.layout.widgets_bottom_sheet, launcher.getDragLayer(), false); + widgetsBottomSheet.populateAndShow(itemInfo); } }; } diff --git a/src/com/android/launcher3/widget/WidgetsAndMore.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java similarity index 93% rename from src/com/android/launcher3/widget/WidgetsAndMore.java rename to src/com/android/launcher3/widget/WidgetsBottomSheet.java index 401337b160..a423154f4f 100644 --- a/src/com/android/launcher3/widget/WidgetsAndMore.java +++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java @@ -53,9 +53,9 @@ import com.android.launcher3.util.TouchController; import java.util.List; /** - * Bottom sheet for the "Widgets & more" long-press option. + * Bottom sheet for the "Widgets" system shortcut in the long-press popup. */ -public class WidgetsAndMore extends AbstractFloatingView implements Insettable, TouchController, +public class WidgetsBottomSheet extends AbstractFloatingView implements Insettable, TouchController, VerticalPullDetector.Listener, View.OnClickListener, View.OnLongClickListener, DragController.DragListener { @@ -72,11 +72,11 @@ public class WidgetsAndMore extends AbstractFloatingView implements Insettable, private boolean mWasNavBarLight; private VerticalPullDetector mVerticalPullDetector; - public WidgetsAndMore(Context context, AttributeSet attrs) { + public WidgetsBottomSheet(Context context, AttributeSet attrs) { this(context, attrs, 0); } - public WidgetsAndMore(Context context, AttributeSet attrs, int defStyleAttr) { + public WidgetsBottomSheet(Context context, AttributeSet attrs, int defStyleAttr) { super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme), attrs, defStyleAttr); setWillNotDraw(false); mLauncher = Launcher.getLauncher(context); @@ -134,7 +134,8 @@ public class WidgetsAndMore extends AbstractFloatingView implements Insettable, } // If there is only one widget, we want to center it instead of left-align. - WidgetsAndMore.LayoutParams params = (WidgetsAndMore.LayoutParams) widgetRow.getLayoutParams(); + WidgetsBottomSheet.LayoutParams params = (WidgetsBottomSheet.LayoutParams) + widgetRow.getLayoutParams(); params.gravity = widgets.size() == 1 ? Gravity.CENTER_HORIZONTAL : Gravity.START; } @@ -200,7 +201,7 @@ public class WidgetsAndMore extends AbstractFloatingView implements Insettable, public void onAnimationEnd(Animator animation) { mIsOpen = false; mVerticalPullDetector.finishedScrolling(); - ((ViewGroup) getParent()).removeView(WidgetsAndMore.this); + ((ViewGroup) getParent()).removeView(WidgetsBottomSheet.this); setLightNavBar(mWasNavBarLight); } }); @@ -220,7 +221,7 @@ public class WidgetsAndMore extends AbstractFloatingView implements Insettable, @Override protected boolean isOfType(@FloatingViewType int type) { - return (type & TYPE_WIDGETS_AND_MORE) != 0; + return (type & TYPE_WIDGETS_BOTTOM_SHEET) != 0; } @Override @@ -229,10 +230,10 @@ public class WidgetsAndMore extends AbstractFloatingView implements Insettable, } /** - * Returns a WidgetsAndMore which is already open or null + * Returns a {@link WidgetsBottomSheet} which is already open or null */ - public static WidgetsAndMore getOpen(Launcher launcher) { - return getOpenView(launcher, TYPE_WIDGETS_AND_MORE); + public static WidgetsBottomSheet getOpen(Launcher launcher) { + return getOpenView(launcher, TYPE_WIDGETS_BOTTOM_SHEET); } @Override