mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Rename WidgetsAndMore to WidgetsBottomSheet
(It only contains widgets now.) Bug: 35766387 Change-Id: I5864791a9741d1c56ac6df30125fe7a4a677b4bd
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<com.android.launcher3.widget.WidgetsAndMore
|
||||
<com.android.launcher3.widget.WidgetsBottomSheet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
@@ -51,4 +51,4 @@
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_marginBottom="40dp"/>
|
||||
|
||||
</com.android.launcher3.widget.WidgetsAndMore>
|
||||
</com.android.launcher3.widget.WidgetsBottomSheet>
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user