Separing the overview states for normal and quickstep builds
In QuickStep, adding a placeholder ScrollView and changing the state logic
appropriately to handle that
Change-Id: I10223c0692788d6e5dbf8c408c01cafb4e39bd2c
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 8aaad13..6030e08 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -65,12 +65,6 @@
private static final float TALL_DEVICE_ASPECT_RATIO_THRESHOLD = 2.0f;
- // Overview mode
- private final int overviewModeMinIconZoneHeightPx;
- private final int overviewModeMaxIconZoneHeightPx;
- private final int overviewModeBarItemWidthPx;
- private final int overviewModeBarSpacerWidthPx;
- private final float overviewModeIconZoneRatio;
// Workspace
private final int desiredWorkspaceLeftRightMarginPx;
@@ -196,16 +190,6 @@
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
topWorkspacePadding =
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_top_padding);
- overviewModeMinIconZoneHeightPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height);
- overviewModeMaxIconZoneHeightPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_max_icon_zone_height);
- overviewModeBarItemWidthPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_item_width);
- overviewModeBarSpacerWidthPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_spacer_width);
- overviewModeIconZoneRatio =
- res.getInteger(R.integer.config_dynamic_grid_overview_icon_zone_percentage) / 100f;
iconDrawablePaddingOriginalPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
@@ -570,13 +554,6 @@
}
}
- public int getOverviewModeButtonBarHeight() {
- int zoneHeight = (int) (overviewModeIconZoneRatio * availableHeightPx);
- return Utilities.boundToRange(zoneHeight,
- overviewModeMinIconZoneHeightPx,
- overviewModeMaxIconZoneHeightPx);
- }
-
public static int calculateCellWidth(int width, int countX) {
return width / countX;
}
@@ -597,16 +574,6 @@
return isVerticalBarLayout() || isLargeTablet;
}
- private int getVisibleChildCount(ViewGroup parent) {
- int visibleChildren = 0;
- for (int i = 0; i < parent.getChildCount(); i++) {
- if (parent.getChildAt(i).getVisibility() != View.GONE) {
- visibleChildren++;
- }
- }
- return visibleChildren;
- }
-
public void layout(Launcher launcher, boolean notifyListeners) {
FrameLayout.LayoutParams lp;
boolean hasVerticalBarLayout = isVerticalBarLayout();
@@ -701,20 +668,6 @@
pageIndicator.setLayoutParams(lp);
}
- // Layout the Overview Mode
- ViewGroup overviewMode = launcher.getOverviewPanel();
- if (overviewMode != null) {
- int visibleChildCount = getVisibleChildCount(overviewMode);
- int totalItemWidth = visibleChildCount * overviewModeBarItemWidthPx;
- int maxWidth = totalItemWidth + (visibleChildCount - 1) * overviewModeBarSpacerWidthPx;
-
- lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
- lp.width = Math.min(availableWidthPx, maxWidth);
- lp.height = getOverviewModeButtonBarHeight();
- lp.bottomMargin = mInsets.bottom;
- overviewMode.setLayoutParams(lp);
- }
-
// Layout the AllAppsRecyclerView
View view = launcher.findViewById(R.id.apps_list_view);
int paddingLeftRight = desiredWorkspaceLeftRightMarginPx + cellLayoutPaddingLeftRightPx;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 67c0578..75968ae 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -88,7 +88,6 @@
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
import android.view.animation.OvershootInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
@@ -910,7 +909,7 @@
}
}
- protected boolean hasSettings() {
+ public boolean hasSettings() {
if (mLauncherCallbacks != null) {
return mLauncherCallbacks.hasSettings();
} else {
@@ -976,32 +975,6 @@
return handled;
}
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_MENU) {
- // Ignore the menu key if we are currently dragging or are on the custom content screen
- if (!mDragController.isDragging()) {
- // Close any open floating view
- AbstractFloatingView.closeAllOpenViews(this);
-
- // Show the overview mode if we are on the workspace
- if (isInState(NORMAL) && !mWorkspace.isSwitchingState()) {
- mStateManager.goToState(OVERVIEW, true /* animate */, new Runnable() {
- @Override
- public void run() {
- // Hitting the menu button when in touch mode does not trigger touch
- // mode to be disabled, so if requested, force focus on one of the
- // overview panel buttons.
- mOverviewPanel.requestFocusFromTouch();
- }
- });
- }
- }
- return true;
- }
- return super.onKeyUp(keyCode, event);
- }
-
private String getTypedText() {
return mDefaultKeySsb.toString();
}
@@ -1056,6 +1029,7 @@
mFocusHandler = mDragLayer.getFocusIndicatorHelper();
mWorkspace = mDragLayer.findViewById(R.id.workspace);
mWorkspace.initParentViews(mDragLayer);
+ mOverviewPanel = findViewById(R.id.overview_panel);
mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
@@ -1070,9 +1044,6 @@
mHotseat.setOnLongClickListener(this);
}
- // Setup the overview panel
- setupOverviewPanel();
-
// Setup the workspace
mWorkspace.setHapticFeedbackEnabled(false);
mWorkspace.setOnLongClickListener(this);
@@ -1097,43 +1068,6 @@
mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
}
- private void setupOverviewPanel() {
- mOverviewPanel = findViewById(R.id.overview_panel);
-
- // Bind wallpaper button actions
- View wallpaperButton = findViewById(R.id.wallpaper_button);
- new OverviewButtonClickListener(ControlType.WALLPAPER_BUTTON) {
- @Override
- public void handleViewClick(View view) {
- onClickWallpaperPicker(view);
- }
- }.attachTo(wallpaperButton);
-
- // Bind widget button actions
- new OverviewButtonClickListener(ControlType.WIDGETS_BUTTON) {
- @Override
- public void handleViewClick(View view) {
- onClickAddWidgetButton(view);
- }
- }.attachTo(findViewById(R.id.widget_button));
-
- // Bind settings actions
- View settingsButton = findViewById(R.id.settings_button);
- boolean hasSettings = hasSettings();
- if (hasSettings) {
- new OverviewButtonClickListener(ControlType.SETTINGS_BUTTON) {
- @Override
- public void handleViewClick(View view) {
- onClickSettingsButton(view);
- }
- }.attachTo(settingsButton);
- } else {
- settingsButton.setVisibility(View.GONE);
- }
-
- mOverviewPanel.setAlpha(0f);
- }
-
/**
* Sets the all apps button. This method is called from {@link Hotseat}.
* TODO: Get rid of this.
@@ -2119,19 +2053,6 @@
}
/**
- * Event handler for the (Add) Widgets button that appears after a long press
- * on the home screen.
- */
- public void onClickAddWidgetButton(View view) {
- if (LOGD) Log.d(TAG, "onClickAddWidgetButton");
- if (mIsSafeModeEnabled) {
- Toast.makeText(this, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
- } else {
- WidgetsFullSheet.show(this, true /* animated */);
- }
- }
-
- /**
* Event handler for the wallpaper picker button that appears after a long press
* on the home screen.
*/
@@ -2164,19 +2085,6 @@
}
}
- /**
- * Event handler for a click on the settings button that appears after a long press
- * on the home screen.
- */
- public void onClickSettingsButton(View v) {
- if (LOGD) Log.d(TAG, "onClickSettingsButton");
- Intent intent = new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
- .setPackage(getPackageName());
- intent.setSourceBounds(getViewBounds(v));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent, getActivityLaunchOptions(v));
- }
-
private void startShortcutIntentSafely(Intent intent, Bundle optsBundle, ItemInfo info) {
try {
StrictMode.VmPolicy oldPolicy = StrictMode.getVmPolicy();
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 32f96df..daa9bd0 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -61,7 +61,6 @@
import com.android.launcher3.LauncherAppWidgetHost.ProviderChangedListener;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
-import com.android.launcher3.accessibility.OverviewAccessibilityDelegate;
import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate;
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
import com.android.launcher3.anim.AnimationLayerSet;
@@ -82,6 +81,7 @@
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
import com.android.launcher3.uioverrides.OverviewState;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
@@ -454,7 +454,7 @@
@Override
public void initParentViews(View parent) {
super.initParentViews(parent);
- mPageIndicator.setAccessibilityDelegate(new OverviewAccessibilityDelegate());
+ mPageIndicator.setAccessibilityDelegate(UiFactory.newPageIndicatorAccessibilityDelegate());
}
private void setupLayoutTransition() {
diff --git a/src/com/android/launcher3/accessibility/OverviewAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/OverviewAccessibilityDelegate.java
deleted file mode 100644
index 771353e..0000000
--- a/src/com/android/launcher3/accessibility/OverviewAccessibilityDelegate.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher3.accessibility;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.AccessibilityDelegate;
-import android.view.accessibility.AccessibilityNodeInfo;
-import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
-
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
-
-/**
- * Accessibility delegate with actions pointing to various Overview entry points.
- */
-public class OverviewAccessibilityDelegate extends AccessibilityDelegate {
-
- private static final int OVERVIEW = R.string.accessibility_action_overview;
- private static final int WALLPAPERS = R.string.wallpaper_button_text;
- private static final int WIDGETS = R.string.widget_button_text;
- private static final int SETTINGS = R.string.settings_button_text;
-
- @Override
- public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(host, info);
-
- Context context = host.getContext();
- info.addAction(new AccessibilityAction(OVERVIEW, context.getText(OVERVIEW)));
-
- if (Utilities.isWallpaperAllowed(context)) {
- info.addAction(new AccessibilityAction(WALLPAPERS, context.getText(WALLPAPERS)));
- }
- info.addAction(new AccessibilityAction(WIDGETS, context.getText(WIDGETS)));
- info.addAction(new AccessibilityAction(SETTINGS, context.getText(SETTINGS)));
- }
-
- @Override
- public boolean performAccessibilityAction(View host, int action, Bundle args) {
- Launcher launcher = Launcher.getLauncher(host.getContext());
- if (action == OVERVIEW) {
- launcher.getStateManager().goToState(LauncherState.OVERVIEW);
- return true;
- } else if (action == WALLPAPERS) {
- launcher.onClickWallpaperPicker(host);
- return true;
- } else if (action == WIDGETS) {
- launcher.onClickAddWidgetButton(host);
- return true;
- } else if (action == SETTINGS) {
- launcher.onClickSettingsButton(host);
- return true;
- }
- return super.performAccessibilityAction(host, action, args);
- }
-}