diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-08-02 03:37:39 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-09-08 14:06:30 -0700 |
commit | 7ce471bdf6d77c9d5778810d9ea033313c579067 (patch) | |
tree | 26567ed32b78611f33f9823f7514fbb1f8de821c /src/com/android/launcher3 | |
parent | 17e780794bd10e08405350af8fa1f2fffff79829 (diff) | |
download | android_packages_apps_Trebuchet-7ce471bdf6d77c9d5778810d9ea033313c579067.tar.gz android_packages_apps_Trebuchet-7ce471bdf6d77c9d5778810d9ea033313c579067.tar.bz2 android_packages_apps_Trebuchet-7ce471bdf6d77c9d5778810d9ea033313c579067.zip |
Removing support for CustomContent screen
The supported way to customize Launcher and add a "-1 page" is by
using LauncherOverlays. Custom content screen is no longer supported.
Change-Id: I3f8a2734c287d1a69ae0c038ec1de1d45fa1b464
Diffstat (limited to 'src/com/android/launcher3')
12 files changed, 66 insertions, 642 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 3ebccda9e..f83574808 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -89,8 +89,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { private int mCountY; private boolean mDropPending = false; - private boolean mIsDragTarget = true; - private boolean mJailContent = true; // These are temporary variables to prevent having to allocate a new object just to // return an (x, y) value from helper functions. Do NOT use them to maintain other state. @@ -404,14 +402,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { } } - void disableDragTarget() { - mIsDragTarget = false; - } - - public boolean isDragTarget() { - return mIsDragTarget; - } - void setIsDragOverlapping(boolean isDragOverlapping) { if (mIsDragOverlapping != isDragOverlapping) { mIsDragOverlapping = isDragOverlapping; @@ -421,26 +411,22 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { } } - public void disableJailContent() { - mJailContent = false; - } - @Override protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) { - if (mJailContent) { - ParcelableSparseArray jail = getJailedArray(container); - super.dispatchSaveInstanceState(jail); - container.put(R.id.cell_layout_jail_id, jail); - } else { - super.dispatchSaveInstanceState(container); - } + ParcelableSparseArray jail = getJailedArray(container); + super.dispatchSaveInstanceState(jail); + container.put(R.id.cell_layout_jail_id, jail); } @Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) { - super.dispatchRestoreInstanceState(mJailContent ? getJailedArray(container) : container); + super.dispatchRestoreInstanceState(getJailedArray(container)); } + /** + * Wrap the SparseArray in another Parcelable so that the item ids do not conflict with our + * our internal resource ids + */ private ParcelableSparseArray getJailedArray(SparseArray<Parcelable> container) { final Parcelable parcelable = container.get(R.id.cell_layout_jail_id); return parcelable instanceof ParcelableSparseArray ? @@ -453,10 +439,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { @Override protected void onDraw(Canvas canvas) { - if (!mIsDragTarget) { - return; - } - // When we're large, we are either drawn in a "hover" state (ie when dragging an item to // a neighboring page) or with just a normal background (if backgroundAlpha > 0.0f) // When we're small, we are either drawn normally or in the "accepts drops" state (during @@ -838,16 +820,10 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - boolean isFullscreen = mShortcutsAndWidgets.getChildCount() > 0 && - ((LayoutParams) mShortcutsAndWidgets.getChildAt(0).getLayoutParams()).isFullscreen; int left = getPaddingLeft(); - if (!isFullscreen) { - left += (int) Math.ceil(getUnusedHorizontalSpace() / 2f); - } + left += (int) Math.ceil(getUnusedHorizontalSpace() / 2f); int right = r - l - getPaddingRight(); - if (!isFullscreen) { - right -= (int) Math.ceil(getUnusedHorizontalSpace() / 2f); - } + right -= (int) Math.ceil(getUnusedHorizontalSpace() / 2f); int top = getPaddingTop(); int bottom = b - t - getPaddingBottom(); @@ -888,7 +864,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { @Override protected boolean verifyDrawable(Drawable who) { - return super.verifyDrawable(who) || (mIsDragTarget && who == mBackground); + return super.verifyDrawable(who) || (who == mBackground); } public void setShortcutAndWidgetAlpha(float alpha) { @@ -2654,11 +2630,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { public boolean isLockedToGrid = true; /** - * Indicates that this item should use the full extents of its parent. - */ - public boolean isFullscreen = false; - - /** * Indicates whether this item can be reordered. Always true except in the case of the * the AllApps button and QSB place holder. */ diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index fe7acda17..1f18ea1ac 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -288,25 +288,11 @@ public class FocusHelper { case FocusLogic.PREVIOUS_PAGE_RIGHT_COLUMN: // Go to the previous page but keep the focus on the same hotseat icon. workspace.snapToPage(pageIndex - 1); - // If the page we are going to is fullscreen, have it take the focus from hotseat. - CellLayout prevPage = (CellLayout) workspace.getPageAt(pageIndex - 1); - boolean isPrevPageFullscreen = ((CellLayout.LayoutParams) prevPage - .getShortcutsAndWidgets().getChildAt(0).getLayoutParams()).isFullscreen; - if (isPrevPageFullscreen) { - workspace.getPageAt(pageIndex - 1).requestFocus(); - } break; case FocusLogic.NEXT_PAGE_LEFT_COLUMN: case FocusLogic.NEXT_PAGE_RIGHT_COLUMN: // Go to the next page but keep the focus on the same hotseat icon. workspace.snapToPage(pageIndex + 1); - // If the page we are going to is fullscreen, have it take the focus from hotseat. - CellLayout nextPage = (CellLayout) workspace.getPageAt(pageIndex + 1); - boolean isNextPageFullscreen = ((CellLayout.LayoutParams) nextPage - .getShortcutsAndWidgets().getChildAt(0).getLayoutParams()).isFullscreen; - if (isNextPageFullscreen) { - workspace.getPageAt(pageIndex + 1).requestFocus(); - } break; } if (parent == iconParent && newIconIndex >= iconParent.getChildCount()) { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 60d2e81f3..c22a04aa9 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -291,8 +291,6 @@ public class Launcher extends BaseActivity // it from the context. private SharedPreferences mSharedPrefs; - private boolean mMoveToDefaultScreenFromNewIntent; - // This is set to the view that launched the activity that navigated the user away from // launcher. Since there is no callback for when the activity has finished launching, enable // the press state and keep this reference to reset the press state when we return to launcher. @@ -420,8 +418,6 @@ public class Launcher extends BaseActivity ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE)) .addAccessibilityStateChangeListener(this); - lockAllApps(); - restoreState(savedInstanceState); if (LauncherAppState.PROFILE_STARTUP) { @@ -508,10 +504,6 @@ public class Launcher extends BaseActivity mExtractedColors.notifyChange(); } - public ExtractedColors getExtractedColors() { - return mExtractedColors; - } - @Override public void onAppWidgetHostReset() { if (mAppWidgetHost != null) { @@ -564,44 +556,6 @@ public class Launcher extends BaseActivity } } - /** To be overridden by subclasses to hint to Launcher that we have custom content */ - protected boolean hasCustomContentToLeft() { - if (mLauncherCallbacks != null) { - return mLauncherCallbacks.hasCustomContentToLeft(); - } - return false; - } - - /** - * To be overridden by subclasses to populate the custom content container and call - * {@link #addToCustomContentPage}. This will only be invoked if - * {@link #hasCustomContentToLeft()} is {@code true}. - */ - protected void populateCustomContentContainer() { - if (mLauncherCallbacks != null) { - mLauncherCallbacks.populateCustomContentContainer(); - } - } - - /** - * Invoked by subclasses to signal a change to the {@link #addToCustomContentPage} value to - * ensure the custom content page is added or removed if necessary. - */ - protected void invalidateHasCustomContentToLeft() { - if (mWorkspace == null || mWorkspace.getScreenOrder().isEmpty()) { - // Not bound yet, wait for bindScreens to be called. - return; - } - - if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) { - // Create the custom content page and call the subclass to populate it. - mWorkspace.createCustomContentContainer(); - populateCustomContentContainer(); - } else if (mWorkspace.hasCustomContent() && !hasCustomContentToLeft()) { - mWorkspace.removeCustomContentPage(); - } - } - public boolean isDraggingEnabled() { // We prevent dragging when we are loading the workspace as it is possible to pick up a view // that is subsequently removed from the workspace in startBinding(). @@ -801,7 +755,7 @@ public class Launcher extends BaseActivity } } - /** @Override for MNC */ + @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { PendingRequestArgs pendingArgs = mPendingRequestArgs; @@ -1017,21 +971,6 @@ public class Launcher extends BaseActivity Log.d(TAG, "Time spent in onResume: " + (System.currentTimeMillis() - startTime)); } - // We want to suppress callbacks about CustomContent being shown if we have just received - // onNewIntent while the user was present within launcher. In that case, we post a call - // to move the user to the main screen (which will occur after onResume). We don't want to - // have onHide (from onPause), then onShow, then onHide again, which we get if we don't - // suppress here. - if (mWorkspace.getCustomContentCallbacks() != null - && !mMoveToDefaultScreenFromNewIntent) { - // If we are resuming and the custom content is the current page, we call onShow(). - // It is also possible that onShow will instead be called slightly after first layout - // if PagedView#setRestorePage was set to the custom content page in onCreate(). - if (mWorkspace.isOnOrMovingToCustomContent()) { - mWorkspace.getCustomContentCallbacks().onShow(true); - } - } - mMoveToDefaultScreenFromNewIntent = false; updateInteraction(Workspace.State.NORMAL, mWorkspace.getState()); mWorkspace.onResume(); @@ -1061,32 +1000,11 @@ public class Launcher extends BaseActivity mDragController.cancelDrag(); mDragController.resetLastGestureUpTime(); - // We call onHide() aggressively. The custom content callbacks should be able to - // debounce excess onHide calls. - if (mWorkspace.getCustomContentCallbacks() != null) { - mWorkspace.getCustomContentCallbacks().onHide(); - } - if (mLauncherCallbacks != null) { mLauncherCallbacks.onPause(); } } - public interface CustomContentCallbacks { - // Custom content is completely shown. {@code fromResume} indicates whether this was caused - // by a onResume or by scrolling otherwise. - void onShow(boolean fromResume); - - // Custom content is completely hidden - void onHide(); - - // Custom content scroll progress changed. From 0 (not showing) to 1 (fully showing). - void onScrollProgressChanged(float progress); - - // Indicates whether the user is allowed to scroll away from the custom content. - boolean isScrollingAllowed(); - } - public interface LauncherOverlay { /** @@ -1136,16 +1054,6 @@ public class Launcher extends BaseActivity } } - public void addToCustomContentPage(View customContent, - CustomContentCallbacks callbacks, String description) { - mWorkspace.addToCustomContentPage(customContent, callbacks, description); - } - - // The custom content needs to offset its content to account for the QSB - public int getTopOffsetForCustomContent() { - return mWorkspace.getPaddingTop(); - } - @Override public Object onRetainNonConfigurationInstance() { // Flag the loader to stop early before switching @@ -1205,7 +1113,7 @@ public class Launcher extends BaseActivity 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 (!isOnCustomContent() && !mDragController.isDragging()) { + if (!mDragController.isDragging()) { // Close any open floating view AbstractFloatingView.closeAllOpenViews(this); @@ -1765,14 +1673,11 @@ public class Launcher extends BaseActivity if (shouldMoveToDefaultScreen && !mWorkspace.isTouchActive() && callbackAllowsMoveToDefaultScreen) { - // We use this flag to suppress noisy callbacks above custom content state - // from onResume. - mMoveToDefaultScreenFromNewIntent = true; mWorkspace.post(new Runnable() { @Override public void run() { if (mWorkspace != null) { - mWorkspace.moveToDefaultScreen(true); + mWorkspace.moveToDefaultScreen(); } } }); @@ -1795,8 +1700,7 @@ public class Launcher extends BaseActivity @Override protected void onSaveInstanceState(Bundle outState) { if (mWorkspace.getChildCount() > 0) { - outState.putInt(RUNTIME_STATE_CURRENT_SCREEN, - mWorkspace.getCurrentPageOffsetFromCustomContent()); + outState.putInt(RUNTIME_STATE_CURRENT_SCREEN, mWorkspace.getNextPage()); } super.onSaveInstanceState(outState); @@ -1952,10 +1856,6 @@ public class Launcher extends BaseActivity } } - public boolean isOnCustomContent() { - return mWorkspace.isOnOrMovingToCustomContent(); - } - @Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); @@ -2028,12 +1928,6 @@ public class Launcher extends BaseActivity } } - protected void moveToCustomContentScreen(boolean animate) { - // Close any folders that may be open. - AbstractFloatingView.closeAllOpenViews(this, animate); - mWorkspace.moveToCustomContentScreen(animate); - } - public void addPendingItem(PendingAddItemInfo info, long container, long screenId, int[] cell, int spanX, int spanY) { info.container = container; @@ -2554,14 +2448,6 @@ public class Launcher extends BaseActivity mDragLayer.onAccessibilityStateChanged(enabled); } - public void onDragStarted() { - if (isOnCustomContent()) { - // Custom content screen doesn't participate in drag and drop. If on custom - // content screen, move to default. - moveWorkspaceToDefaultScreen(); - } - } - /** * Called when the user stops interacting with the launcher. * This implies that the user is now on the homescreen and is not doing housekeeping. @@ -3072,14 +2958,6 @@ public class Launcher extends BaseActivity } } - void lockAllApps() { - // TODO - } - - void unlockAllApps() { - // TODO - } - @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { final boolean result = super.dispatchPopulateAccessibilityEvent(event); @@ -3219,13 +3097,6 @@ public class Launcher extends BaseActivity } bindAddScreens(orderedScreenIds); - // Create the custom content page (this call updates mDefaultScreen which calls - // setCurrentPage() so ensure that all pages are added before calling this). - if (hasCustomContentToLeft()) { - mWorkspace.createCustomContentContainer(); - populateCustomContentContainer(); - } - // After we have added all the screens, if the wallpaper was locked to the default state, // then notify to indicate that it can be released and a proper wallpaper offset can be // computed before the next layout @@ -3650,13 +3521,6 @@ public class Launcher extends BaseActivity return mDeviceProfile.isVerticalBarLayout(); } - public int getSearchBarHeight() { - if (mLauncherCallbacks != null) { - return mLauncherCallbacks.getSearchBarHeight(); - } - return LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL; - } - /** * Add the icons for all apps. * @@ -3910,10 +3774,6 @@ public class Launcher extends BaseActivity return mState == State.WORKSPACE && !mSharedPrefs.getBoolean(APPS_VIEW_SHOWN, false); } - protected void moveWorkspaceToDefaultScreen() { - mWorkspace.moveToDefaultScreen(false); - } - /** * $ adb shell dumpsys activity com.android.launcher3.Launcher [--all] */ @@ -3923,7 +3783,7 @@ public class Launcher extends BaseActivity if (args.length > 0 && TextUtils.equals(args[0], "--all")) { writer.println(prefix + "Workspace Items"); - for (int i = mWorkspace.numCustomPages(); i < mWorkspace.getPageCount(); i++) { + for (int i = 0; i < mWorkspace.getPageCount(); i++) { writer.println(prefix + " Homescreen " + i); ViewGroup layout = ((CellLayout) mWorkspace.getPageAt(i)).getShortcutsAndWidgets(); diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java index 66da046ef..d1e2b621a 100644 --- a/src/com/android/launcher3/LauncherCallbacks.java +++ b/src/com/android/launcher3/LauncherCallbacks.java @@ -81,10 +81,6 @@ public interface LauncherCallbacks { */ boolean startSearch( String initialQuery, boolean selectInitialQuery, Bundle appSearchData); - boolean hasCustomContentToLeft(); - void populateCustomContentContainer(); - View getQsbBar(); - Bundle getAdditionalSearchWidgetOptions(); /* * Extensions points for adding / replacing some other aspects of the Launcher experience. @@ -92,7 +88,4 @@ public interface LauncherCallbacks { boolean shouldMoveToDefaultScreenOnHomeIntent(); boolean hasSettings(); List<ComponentKeyMapper<AppInfo>> getPredictedApps(); - int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1; - /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */ - int getSearchBarHeight(); } diff --git a/src/com/android/launcher3/PinchToOverviewListener.java b/src/com/android/launcher3/PinchToOverviewListener.java index 42515d1fc..2a5899c31 100644 --- a/src/com/android/launcher3/PinchToOverviewListener.java +++ b/src/com/android/launcher3/PinchToOverviewListener.java @@ -80,7 +80,7 @@ public class PinchToOverviewListener extends ScaleGestureDetector.SimpleOnScaleG @Override public boolean onScaleBegin(ScaleGestureDetector detector) { - if (mLauncher.mState != Launcher.State.WORKSPACE || mLauncher.isOnCustomContent()) { + if (mLauncher.mState != Launcher.State.WORKSPACE) { // Don't listen for the pinch gesture if on all apps, widget picker, -1, etc. return false; } diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index a7e68ff14..841c0cd57 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -108,28 +108,21 @@ public class ShortcutAndWidgetContainer extends ViewGroup { public void measureChild(View child) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); - if (!lp.isFullscreen) { - final DeviceProfile profile = mLauncher.getDeviceProfile(); - - if (child instanceof LauncherAppWidgetHostView) { - lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, - profile.appWidgetScale.x, profile.appWidgetScale.y); - // Widgets have their own padding - } else { - lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX); - // Center the icon/folder - int cHeight = getCellContentHeight(); - int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); - int cellPaddingX = mContainerType == CellLayout.WORKSPACE - ? profile.workspaceCellPaddingXPx - : (int) (profile.edgeMarginPx / 2f); - child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0); - } + final DeviceProfile profile = mLauncher.getDeviceProfile(); + + if (child instanceof LauncherAppWidgetHostView) { + lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, + profile.appWidgetScale.x, profile.appWidgetScale.y); + // Widgets have their own padding } else { - lp.x = 0; - lp.y = 0; - lp.width = getMeasuredWidth(); - lp.height = getMeasuredHeight(); + lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX); + // Center the icon/folder + int cHeight = getCellContentHeight(); + int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); + int cellPaddingX = mContainerType == CellLayout.WORKSPACE + ? profile.workspaceCellPaddingXPx + : (int) (profile.edgeMarginPx / 2f); + child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0); } int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index bdeed4c97..d7f709932 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -53,7 +53,6 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.Toast; -import com.android.launcher3.Launcher.CustomContentCallbacks; import com.android.launcher3.Launcher.LauncherOverlay; import com.android.launcher3.LauncherAppWidgetHost.ProviderChangedListener; import com.android.launcher3.UninstallDropTarget.DropTargetSource; @@ -118,6 +117,8 @@ public class Workspace extends PagedView private static final int ADJACENT_SCREEN_DROP_DURATION = 300; + private static final int DEFAULT_PAGE = 0; + private static final boolean MAP_NO_RECURSE = false; private static final boolean MAP_RECURSE = true; @@ -126,12 +127,6 @@ public class Workspace extends PagedView // The is the first screen. It is always present, even if its empty. public static final long FIRST_SCREEN_ID = 0; - private final static long CUSTOM_CONTENT_SCREEN_ID = -301; - - private static final long CUSTOM_CONTENT_GESTURE_DELAY = 200; - private long mTouchDownTime = -1; - private long mCustomContentShowTime = -1; - private LayoutTransition mLayoutTransition; @Thunk final WallpaperManager mWallpaperManager; @@ -155,11 +150,6 @@ public class Workspace extends PagedView private int mDragOverX = -1; private int mDragOverY = -1; - CustomContentCallbacks mCustomContentCallbacks; - boolean mCustomContentShowing; - private float mLastCustomContentScrollProgress = -1f; - private String mCustomContentDescription = ""; - /** * The CellLayout that is currently being dragged over */ @@ -250,7 +240,6 @@ public class Workspace extends PagedView private boolean mUnlockWallpaperFromDefaultPageOnLayout; @Thunk Runnable mDelayedResizeRunnable; - private Runnable mDelayedSnapToPageRunnable; // Variables relating to the creation of user folders by hovering shortcuts over shortcuts private static final int FOLDER_CREATION_TIMEOUT = 0; @@ -357,14 +346,6 @@ public class Workspace extends PagedView @Override public void setInsets(Rect insets) { mInsets.set(insets); - - CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID); - if (customScreen != null) { - View customContent = customScreen.getShortcutsAndWidgets().getChildAt(0); - if (customContent instanceof Insettable) { - ((Insettable) customContent).setInsets(mInsets); - } - } } /** @@ -378,8 +359,8 @@ public class Workspace extends PagedView float shrinkFactor = mLauncher.getDeviceProfile().workspaceSpringLoadShrinkFactor; int[] size = new int[2]; if (getChildCount() > 0) { - // Use the first non-custom page to estimate the child position - CellLayout cl = (CellLayout) getChildAt(numCustomPages()); + // Use the first page to estimate the child position + CellLayout cl = (CellLayout) getChildAt(0); boolean isWidget = itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; Rect r = estimateItemPosition(cl, 0, 0, itemInfo.spanX, itemInfo.spanY); @@ -432,7 +413,6 @@ public class Workspace extends PagedView } updateChildrenLayersEnabled(false); - mLauncher.onDragStarted(); mLauncher.lockScreenOrientation(); mLauncher.onInteractionBegin(); // Prevent any Un/InstallShortcutReceivers from updating the db while we are dragging @@ -502,7 +482,7 @@ public class Workspace extends PagedView * Initializes various states for this workspace. */ protected void initWorkspace() { - mCurrentPage = getDefaultPage(); + mCurrentPage = DEFAULT_PAGE; DeviceProfile grid = mLauncher.getDeviceProfile(); setWillNotDraw(false); setClipChildren(false); @@ -523,10 +503,6 @@ public class Workspace extends PagedView mPageIndicator.setAccessibilityDelegate(new OverviewAccessibilityDelegate()); } - private int getDefaultPage() { - return numCustomPages(); - } - private void setupLayoutTransition() { // We want to show layout transitions when pages are deleted, to close the gap. mLayoutTransition = new LayoutTransition(); @@ -587,16 +563,9 @@ public class Workspace extends PagedView public void removeAllWorkspaceScreens() { // Disable all layout transitions before removing all pages to ensure that we don't get the - // transition animations competing with us changing the scroll when we add pages or the - // custom content screen + // transition animations competing with us changing the scroll when we add pages disableLayoutTransitions(); - // Since we increment the current page when we call addCustomContentPage via bindScreens - // (and other places), we need to adjust the current page back when we clear the pages - if (hasCustomContent()) { - removeCustomContentPage(); - } - // Recycle the QSB widget View qsb = findViewById(R.id.search_container_workspace); if (qsb != null) { @@ -657,78 +626,6 @@ public class Workspace extends PagedView return newScreen; } - public void createCustomContentContainer() { - CellLayout customScreen = (CellLayout) - LayoutInflater.from(getContext()).inflate(R.layout.workspace_screen, this, false); - customScreen.disableDragTarget(); - customScreen.disableJailContent(); - - mWorkspaceScreens.put(CUSTOM_CONTENT_SCREEN_ID, customScreen); - mScreenOrder.add(0, CUSTOM_CONTENT_SCREEN_ID); - - // We want no padding on the custom content - customScreen.setPadding(0, 0, 0, 0); - - addFullScreenPage(customScreen); - - // Update the custom content hint - setCurrentPage(getCurrentPage() + 1); - } - - public void removeCustomContentPage() { - CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID); - if (customScreen == null) { - throw new RuntimeException("Expected custom content screen to exist"); - } - - mWorkspaceScreens.remove(CUSTOM_CONTENT_SCREEN_ID); - mScreenOrder.remove(CUSTOM_CONTENT_SCREEN_ID); - removeView(customScreen); - - if (mCustomContentCallbacks != null) { - mCustomContentCallbacks.onScrollProgressChanged(0); - mCustomContentCallbacks.onHide(); - } - - mCustomContentCallbacks = null; - - // Update the custom content hint - setCurrentPage(getCurrentPage() - 1); - } - - public void addToCustomContentPage(View customContent, CustomContentCallbacks callbacks, - String description) { - if (getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID) < 0) { - throw new RuntimeException("Expected custom content screen to exist"); - } - - // Add the custom content to the full screen custom page - CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID); - int spanX = customScreen.getCountX(); - int spanY = customScreen.getCountY(); - CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY); - lp.canReorder = false; - lp.isFullscreen = true; - if (customContent instanceof Insettable) { - ((Insettable)customContent).setInsets(mInsets); - } - - // Verify that the child is removed from any existing parent. - if (customContent.getParent() instanceof ViewGroup) { - ViewGroup parent = (ViewGroup) customContent.getParent(); - parent.removeView(customContent); - } - customScreen.removeAllViews(); - customContent.setFocusable(true); - customContent.setOnKeyListener(new FullscreenKeyEventListener()); - customContent.setOnFocusChangeListener(mLauncher.mFocusHandler - .getHideIndicatorOnFocusListener()); - customScreen.addViewToCellLayout(customContent, 0, 0, lp, true); - mCustomContentDescription = description; - - mCustomContentCallbacks = callbacks; - } - public void addExtraEmptyScreenOnDrag() { boolean lastChildOnScreen = false; boolean childOnFinalScreen = false; @@ -772,7 +669,6 @@ public class Workspace extends PagedView if (hasExtraEmptyScreen() || mScreenOrder.size() == 0) return; long finalScreenId = mScreenOrder.get(mScreenOrder.size() - 1); - if (finalScreenId == CUSTOM_CONTENT_SCREEN_ID) return; CellLayout finalScreen = mWorkspaceScreens.get(finalScreenId); // If the final screen is empty, convert it to the extra empty screen @@ -781,7 +677,7 @@ public class Workspace extends PagedView mWorkspaceScreens.remove(finalScreenId); mScreenOrder.remove(finalScreenId); - // if this is the last non-custom content screen, convert it to the empty screen + // if this is the last screen, convert it to the empty screen mWorkspaceScreens.put(EXTRA_EMPTY_SCREEN_ID, finalScreen); mScreenOrder.add(EXTRA_EMPTY_SCREEN_ID); @@ -877,9 +773,7 @@ public class Workspace extends PagedView } public boolean hasExtraEmptyScreen() { - int nScreens = getChildCount(); - nScreens = nScreens - numCustomPages(); - return mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_ID) && nScreens > 1; + return mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_ID) && getChildCount() > 1; } public long commitExtraEmptyScreen() { @@ -960,7 +854,7 @@ public class Workspace extends PagedView // We enforce at least one page to add new items to. In the case that we remove the last // such screen, we convert the last screen to the empty screen - int minScreens = 1 + numCustomPages(); + int minScreens = 1; int pageShift = 0; for (Long id: removeScreens) { @@ -979,7 +873,7 @@ public class Workspace extends PagedView removeView(cl); } else { - // if this is the last non-custom content screen, convert it to the empty screen + // if this is the last screen, convert it to the empty screen mRemoveEmptyScreenRunnable = null; mWorkspaceScreens.put(EXTRA_EMPTY_SCREEN_ID, cl); mScreenOrder.add(EXTRA_EMPTY_SCREEN_ID); @@ -1147,7 +1041,6 @@ public class Workspace extends PagedView case MotionEvent.ACTION_DOWN: mXDown = ev.getX(); mYDown = ev.getY(); - mTouchDownTime = System.currentTimeMillis(); break; case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_UP: @@ -1161,17 +1054,6 @@ public class Workspace extends PagedView return super.onInterceptTouchEvent(ev); } - @Override - public boolean onGenericMotionEvent(MotionEvent event) { - // Ignore pointer scroll events if the custom content doesn't allow scrolling. - if ((getScreenIdForPageIndex(getCurrentPage()) == CUSTOM_CONTENT_SCREEN_ID) - && (mCustomContentCallbacks != null) - && !mCustomContentCallbacks.isScrollingAllowed()) { - return false; - } - return super.onGenericMotionEvent(event); - } - protected void reinflateWidgetsIfNecessary() { final int clCount = getChildCount(); for (int i = 0; i < clCount; i++) { @@ -1213,24 +1095,6 @@ public class Workspace extends PagedView cancelCurrentPageLongPress(); } - boolean passRightSwipesToCustomContent = - (mTouchDownTime - mCustomContentShowTime) > CUSTOM_CONTENT_GESTURE_DELAY; - - boolean swipeInIgnoreDirection = mIsRtl ? deltaX < 0 : deltaX > 0; - boolean onCustomContentScreen = - getScreenIdForPageIndex(getCurrentPage()) == CUSTOM_CONTENT_SCREEN_ID; - if (swipeInIgnoreDirection && onCustomContentScreen && passRightSwipesToCustomContent) { - // Pass swipes to the right to the custom content page. - return; - } - - if (onCustomContentScreen && (mCustomContentCallbacks != null) - && !mCustomContentCallbacks.isScrollingAllowed()) { - // Don't allow workspace scrolling if the current custom content screen doesn't allow - // scrolling. - return; - } - if (theta > MAX_SWIPE_ANGLE) { // Above MAX_SWIPE_ANGLE, we don't want to ever start scrolling the workspace return; @@ -1271,10 +1135,6 @@ public class Workspace extends PagedView mDelayedResizeRunnable = null; } - if (mDelayedSnapToPageRunnable != null) { - mDelayedSnapToPageRunnable.run(); - mDelayedSnapToPageRunnable = null; - } if (mStripScreensOnPageStopMoving) { stripEmptyScreens(); mStripScreensOnPageStopMoving = false; @@ -1336,7 +1196,6 @@ public class Workspace extends PagedView } updatePageAlphaValues(); - updateStateForCustomContent(); enableHwLayersOnVisiblePages(); } @@ -1348,9 +1207,6 @@ public class Workspace extends PagedView @Override protected void overScroll(float amount) { - boolean shouldOverScroll = (amount <= 0 && (!hasCustomContent() || mIsRtl)) || - (amount >= 0 && (!hasCustomContent() || !mIsRtl)); - boolean shouldScrollOverlay = mLauncherOverlay != null && ((amount <= 0 && !mIsRtl) || (amount >= 0 && mIsRtl)); @@ -1365,7 +1221,7 @@ public class Workspace extends PagedView mLastOverlayScroll = Math.abs(amount / getViewportWidth()); mLauncherOverlay.onScrollChange(mLastOverlayScroll, mIsRtl); - } else if (shouldOverScroll) { + } else { dampedOverScroll(amount); } @@ -1518,22 +1374,6 @@ public class Workspace extends PagedView mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, swipeDirection, ContainerType.WORKSPACE, prevPage); } - if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) { - mCustomContentShowing = true; - if (mCustomContentCallbacks != null) { - mCustomContentCallbacks.onShow(false); - mCustomContentShowTime = System.currentTimeMillis(); - } - } else if (hasCustomContent() && getNextPage() != 0 && mCustomContentShowing) { - mCustomContentShowing = false; - if (mCustomContentCallbacks != null) { - mCustomContentCallbacks.onHide(); - } - } - } - - protected CustomContentCallbacks getCustomContentCallbacks() { - return mCustomContentCallbacks; } protected void setWallpaperDimension() { @@ -1560,26 +1400,6 @@ public class Workspace extends PagedView } } - protected void snapToPage(int whichPage, Runnable r) { - snapToPage(whichPage, SLOW_PAGE_SNAP_ANIMATION_DURATION, r); - } - - protected void snapToPage(int whichPage, int duration, Runnable r) { - if (mDelayedSnapToPageRunnable != null) { - mDelayedSnapToPageRunnable.run(); - } - mDelayedSnapToPageRunnable = r; - snapToPage(whichPage, duration); - } - - public void snapToScreenId(long screenId) { - snapToScreenId(screenId, null); - } - - protected void snapToScreenId(long screenId, Runnable r) { - snapToPage(getPageIndexForScreenId(screenId), r); - } - @Override public void computeScroll() { super.computeScroll(); @@ -1614,7 +1434,7 @@ public class Workspace extends PagedView private void updatePageAlphaValues() { if (!workspaceInModalState() && !mIsSwitchingState) { int screenCenter = getScrollX() + getViewportWidth() / 2; - for (int i = numCustomPages(); i < getChildCount(); i++) { + for (int i = 0; i < getChildCount(); i++) { CellLayout child = (CellLayout) getChildAt(i); if (child != null) { float scrollProgress = getScrollProgress(screenCenter, child, i); @@ -1632,66 +1452,6 @@ public class Workspace extends PagedView } } - public boolean hasCustomContent() { - return (mScreenOrder.size() > 0 && mScreenOrder.get(0) == CUSTOM_CONTENT_SCREEN_ID); - } - - public int numCustomPages() { - return hasCustomContent() ? 1 : 0; - } - - public boolean isOnOrMovingToCustomContent() { - return hasCustomContent() && getNextPage() == 0; - } - - private void updateStateForCustomContent() { - float translationX = 0; - float progress = 0; - if (hasCustomContent()) { - int index = mScreenOrder.indexOf(CUSTOM_CONTENT_SCREEN_ID); - - int scrollDelta = getScrollX() - getScrollForPage(index) - - getLayoutTransitionOffsetForPage(index); - float scrollRange = getScrollForPage(index + 1) - getScrollForPage(index); - translationX = scrollRange - scrollDelta; - progress = (scrollRange - scrollDelta) / scrollRange; - - if (mIsRtl) { - translationX = Math.min(0, translationX); - } else { - translationX = Math.max(0, translationX); - } - progress = Math.max(0, progress); - } - - if (Float.compare(progress, mLastCustomContentScrollProgress) == 0) return; - - CellLayout cc = mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID); - if (progress > 0 && cc.getVisibility() != VISIBLE && !workspaceInModalState()) { - cc.setVisibility(VISIBLE); - } - - mLastCustomContentScrollProgress = progress; - - // We should only update the drag layer background alpha if we are not in all apps or the - // widgets tray - if (mState == State.NORMAL) { - mLauncher.getDragLayer().setBackgroundAlpha(progress == 1 ? 0 : progress * 0.8f); - } - - if (mLauncher.getHotseat() != null) { - mLauncher.getHotseat().setTranslationX(translationX); - } - - if (mPageIndicator != null) { - mPageIndicator.setTranslationX(translationX); - } - - if (mCustomContentCallbacks != null) { - mCustomContentCallbacks.onScrollProgressChanged(progress); - } - } - protected void onAttachedToWindow() { super.onAttachedToWindow(); IBinder windowToken = getWindowToken(); @@ -1772,7 +1532,7 @@ public class Workspace extends PagedView int leftScreen = -1; int rightScreen = -1; - for (int i = numCustomPages(); i < screenCount; i++) { + for (int i = 0; i < screenCount; i++) { final View child = getPageAt(i); float left = child.getLeft() + child.getTranslationX() - getScrollX(); @@ -1785,8 +1545,7 @@ public class Workspace extends PagedView } if (mForceDrawAdjacentPages) { // In overview mode, make sure that the two side pages are visible. - leftScreen = Utilities.boundToRange(getCurrentPage() - 1, - numCustomPages(), rightScreen); + leftScreen = Utilities.boundToRange(getCurrentPage() - 1, 0, rightScreen); rightScreen = Utilities.boundToRange(getCurrentPage() + 1, leftScreen, getPageCount() - 1); } @@ -1800,7 +1559,7 @@ public class Workspace extends PagedView } } - for (int i = numCustomPages(); i < screenCount; i++) { + for (int i = 0; i < screenCount; i++) { final CellLayout layout = (CellLayout) getPageAt(i); // enable layers between left and right screen inclusive. boolean enableLayer = leftScreen <= i && i <= rightScreen; @@ -1845,19 +1604,6 @@ public class Workspace extends PagedView dragLayer.clearResizeFrame(); } - @Override - protected void getFreeScrollPageRange(int[] range) { - getOverviewModePages(range); - } - - private void getOverviewModePages(int[] range) { - int start = numCustomPages(); - int end = getChildCount() - 1; - - range[0] = Math.max(0, Math.min(start, getChildCount() - 1)); - range[1] = Math.max(0, end); - } - public void onStartReordering() { super.onStartReordering(); // Reordering handles its own animations, disable the automatic ones. @@ -1990,7 +1736,7 @@ public class Workspace extends PagedView // TODO: Update the accessibility flags appropriately when dragging. if (!mLauncher.getAccessibilityDelegate().isInAccessibleDrag()) { int total = getPageCount(); - for (int i = numCustomPages(); i < total; i++) { + for (int i = 0; i < total; i++) { updateAccessibilityFlags((CellLayout) getPageAt(i), i); } setImportantForAccessibility((mState == State.NORMAL || mState == State.OVERVIEW) @@ -2034,44 +1780,15 @@ public class Workspace extends PagedView invalidate(); // This will call dispatchDraw(), which calls getVisiblePages(). updateChildrenLayersEnabled(false); - hideCustomContentIfNecessary(); } public void onEndStateTransition() { mIsSwitchingState = false; updateChildrenLayersEnabled(false); - showCustomContentIfNecessary(); mForceDrawAdjacentPages = false; mTransitionProgress = 1; } - void updateCustomContentVisibility() { - int visibility = mState == Workspace.State.NORMAL ? VISIBLE : INVISIBLE; - setCustomContentVisibility(visibility); - } - - void setCustomContentVisibility(int visibility) { - if (hasCustomContent()) { - mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID).setVisibility(visibility); - } - } - - void showCustomContentIfNecessary() { - boolean show = mState == Workspace.State.NORMAL; - if (show && hasCustomContent()) { - mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID).setVisibility(VISIBLE); - } - } - - void hideCustomContentIfNecessary() { - boolean hide = mState != Workspace.State.NORMAL; - if (hide && hasCustomContent()) { - disableLayoutTransitions(); - mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID).setVisibility(INVISIBLE); - enableLayoutTransitions(); - } - } - public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) { View child = cellInfo.cell; @@ -2810,17 +2527,6 @@ public class Workspace extends PagedView xy[1] = mTempXY[1]; } - /* - * - * Convert the 2D coordinate xy from this CellLayout's coordinate space to - * the parent View's coordinate space. The argument xy is modified with the return result. - * - */ - void mapPointFromChildToSelf(View v, float[] xy) { - xy[0] += v.getLeft(); - xy[1] += v.getTop(); - } - private boolean isDragWidget(DragObject d) { return (d.dragInfo instanceof LauncherAppWidgetInfo || d.dragInfo instanceof PendingAddWidgetInfo); @@ -2949,7 +2655,7 @@ public class Workspace extends PagedView } // Always pick the current page. - if (layout == null && nextPage >= numCustomPages() && nextPage < getPageCount()) { + if (layout == null && nextPage >= 0 && nextPage < getPageCount()) { layout = (CellLayout) getChildAt(nextPage); } if (layout != mDragTargetLayout) { @@ -2964,7 +2670,7 @@ public class Workspace extends PagedView * Returns the child CellLayout if the point is inside the page coordinates, null otherwise. */ private CellLayout verifyInsidePage(int pageNo, float[] touchXy) { - if (pageNo >= numCustomPages() && pageNo < getPageCount()) { + if (pageNo >= 0 && pageNo < getPageCount()) { CellLayout cl = (CellLayout) getChildAt(pageNo); mapPointFromSelfToChild(cl, touchXy); if (touchXy[0] >= 0 && touchXy[0] <= cl.getWidth() && @@ -3142,7 +2848,7 @@ public class Workspace extends PagedView if (!mLauncher.isHotseatLayout(cellLayout) && screenId != getScreenIdForPageIndex(mCurrentPage) && mState != State.SPRING_LOADED) { - snapToScreenId(screenId, null); + snapToPage(getPageIndexForScreenId(screenId)); } if (info instanceof PendingAddItemInfo) { @@ -3434,10 +3140,6 @@ public class Workspace extends PagedView return mDragInfo; } - public int getCurrentPageOffsetFromCustomContent() { - return getNextPage() - numCustomPages(); - } - /** * Calculate the nearest cell where the given object would be dropped. * @@ -3964,14 +3666,10 @@ public class Workspace extends PagedView } } - void moveToDefaultScreen(boolean animate) { - int page = getDefaultPage(); + void moveToDefaultScreen() { + int page = DEFAULT_PAGE; if (!workspaceInModalState() && getNextPage() != page) { - if (animate) { - snapToPage(page); - } else { - setCurrentPage(page); - } + snapToPage(page); } View child = getChildAt(page); if (child != null) { @@ -3979,22 +3677,6 @@ public class Workspace extends PagedView } } - void moveToCustomContentScreen(boolean animate) { - if (hasCustomContent()) { - int ccIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID); - if (animate) { - snapToPage(ccIndex); - } else { - setCurrentPage(ccIndex); - } - View child = getChildAt(ccIndex); - if (child != null) { - child.requestFocus(); - } - } - exitWidgetResizeMode(); - } - @Override protected String getPageIndicatorDescription() { return getResources().getString(R.string.all_apps_button_label); @@ -4002,16 +3684,12 @@ public class Workspace extends PagedView @Override protected String getCurrentPageDescription() { - if (hasCustomContent() && getNextPage() == 0) { - return mCustomContentDescription; - } int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage; return getPageDescription(page); } private String getPageDescription(int page) { - int delta = numCustomPages(); - int nScreens = getChildCount() - delta; + int nScreens = getChildCount(); int extraScreenId = mScreenOrder.indexOf(EXTRA_EMPTY_SCREEN_ID); if (extraScreenId >= 0 && nScreens > 1) { if (page == extraScreenId) { @@ -4023,8 +3701,7 @@ public class Workspace extends PagedView // When the workspace is not loaded, we do not know how many screen will be bound. return getContext().getString(R.string.all_apps_home_button_label); } - return getContext().getString(R.string.workspace_scroll_format, - page + 1 - delta, nScreens); + return getContext().getString(R.string.workspace_scroll_format, page + 1, nScreens); } @Override diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java index a105a7303..e84d3b4e6 100644 --- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java +++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java @@ -274,7 +274,6 @@ public class WorkspaceStateTransitionAnimation { 1.0f : 0f; float finalHotseatAlpha = (states.stateIsNormal || states.stateIsSpringLoaded || states.stateIsNormalHidden) ? 1f : 0f; - float finalQsbAlpha = (states.stateIsNormal || states.stateIsNormalHidden) ? 1f : 0f; float finalWorkspaceTranslationY = 0; if (states.stateIsOverview || states.stateIsOverviewHidden) { @@ -284,7 +283,6 @@ public class WorkspaceStateTransitionAnimation { } final int childCount = mWorkspace.getChildCount(); - final int customPageCount = mWorkspace.numCustomPages(); mNewScale = 1.0f; @@ -313,7 +311,7 @@ public class WorkspaceStateTransitionAnimation { } else if(states.stateIsNormalHidden) { finalAlpha = (i == mWorkspace.getNextPage()) ? 1 : 0; } else if (states.stateIsNormal && mWorkspaceFadeInAdjacentScreens) { - finalAlpha = (i == toPage || i < customPageCount) ? 1f : 0f; + finalAlpha = (i == toPage) ? 1f : 0f; } else { finalAlpha = 1f; } @@ -426,7 +424,6 @@ public class WorkspaceStateTransitionAnimation { mWorkspace.getPageIndicator().setShouldAutoHide(!states.stateIsSpringLoaded); mWorkspace.createHotseatAlphaAnimator(finalHotseatAlpha).end(); - mWorkspace.updateCustomContentVisibility(); mWorkspace.setScaleX(mNewScale); mWorkspace.setScaleY(mNewScale); mWorkspace.setTranslationY(finalWorkspaceTranslationY); diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java index a0ad07aeb..c695758b2 100644 --- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java +++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java @@ -411,7 +411,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme CellLayout layout = (CellLayout) workspace.getPageAt(screenIndex); boolean found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY); - screenIndex = workspace.hasCustomContent() ? 1 : 0; + screenIndex = 0; while (!found && screenIndex < workspaceScreens.size()) { screenId = workspaceScreens.get(screenIndex); layout = (CellLayout) workspace.getPageAt(screenIndex); diff --git a/src/com/android/launcher3/accessibility/OverviewScreenAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/OverviewScreenAccessibilityDelegate.java index edb0b168d..f9eb2eda6 100644 --- a/src/com/android/launcher3/accessibility/OverviewScreenAccessibilityDelegate.java +++ b/src/com/android/launcher3/accessibility/OverviewScreenAccessibilityDelegate.java @@ -88,7 +88,7 @@ public class OverviewScreenAccessibilityDelegate extends AccessibilityDelegate { info.addAction(mActions.get(MOVE_FORWARD)); } - int startIndex = mWorkspace.numCustomPages() + (FeatureFlags.QSB_ON_FIRST_SCREEN ? 1 : 0); + int startIndex = FeatureFlags.QSB_ON_FIRST_SCREEN ? 1 : 0; if (index > startIndex) { info.addAction(mActions.get(MOVE_BACKWARD)); } diff --git a/src/com/android/launcher3/testing/LauncherExtension.java b/src/com/android/launcher3/testing/LauncherExtension.java index 5cb8c4c7d..355963bfe 100644 --- a/src/com/android/launcher3/testing/LauncherExtension.java +++ b/src/com/android/launcher3/testing/LauncherExtension.java @@ -1,11 +1,8 @@ package com.android.launcher3.testing; import android.content.Intent; -import android.graphics.Color; import android.os.Bundle; import android.view.Menu; -import android.view.View; -import android.widget.FrameLayout; import com.android.launcher3.AppInfo; import com.android.launcher3.Launcher; @@ -142,51 +139,6 @@ public class LauncherExtension extends Launcher { return false; } - CustomContentCallbacks mCustomContentCallbacks = new CustomContentCallbacks() { - - // Custom content is completely shown. {@code fromResume} indicates whether this was caused - // by a onResume or by scrolling otherwise. - public void onShow(boolean fromResume) { - } - - // Custom content is completely hidden - public void onHide() { - } - - // Custom content scroll progress changed. From 0 (not showing) to 1 (fully showing). - public void onScrollProgressChanged(float progress) { - - } - - // Indicates whether the user is allowed to scroll away from the custom content. - public boolean isScrollingAllowed() { - return true; - } - - }; - - @Override - public boolean hasCustomContentToLeft() { - return true; - } - - @Override - public void populateCustomContentContainer() { - FrameLayout customContent = new FrameLayout(LauncherExtension.this); - customContent.setBackgroundColor(Color.GRAY); - addToCustomContentPage(customContent, mCustomContentCallbacks, ""); - } - - @Override - public View getQsbBar() { - return null; - } - - @Override - public Bundle getAdditionalSearchWidgetOptions() { - return new Bundle(); - } - @Override public boolean shouldMoveToDefaultScreenOnHomeIntent() { return true; @@ -204,11 +156,6 @@ public class LauncherExtension extends Launcher { } @Override - public int getSearchBarHeight() { - return SEARCH_BAR_HEIGHT_NORMAL; - } - - @Override public void onAttachedToWindow() { } diff --git a/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java b/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java index 392697458..f99efcec9 100644 --- a/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java +++ b/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java @@ -108,7 +108,7 @@ public class WallpaperOffsetInterpolator implements Choreographer.FrameCallback public float wallpaperOffsetForScroll(int scroll) { // To match the default wallpaper behavior in the system, we default to either the left // or right edge on initialization - int numScrollingPages = getNumScreensExcludingEmptyAndCustom(); + int numScrollingPages = getNumScreensExcludingEmpty(); if (mLockedToDefaultPage || numScrollingPages <= 1) { return mIsRtl ? 1f : 0f; } @@ -125,10 +125,10 @@ public class WallpaperOffsetInterpolator implements Choreographer.FrameCallback int leftPageIndex; int rightPageIndex; if (mIsRtl) { - rightPageIndex = mWorkspace.numCustomPages(); + rightPageIndex = 0; leftPageIndex = rightPageIndex + numScrollingPages - 1; } else { - leftPageIndex = mWorkspace.numCustomPages(); + leftPageIndex = 0; rightPageIndex = leftPageIndex + numScrollingPages - 1; } @@ -163,7 +163,7 @@ public class WallpaperOffsetInterpolator implements Choreographer.FrameCallback } private int numEmptyScreensToIgnore() { - int numScrollingPages = mWorkspace.getChildCount() - mWorkspace.numCustomPages(); + int numScrollingPages = mWorkspace.getChildCount(); if (numScrollingPages >= MIN_PARALLAX_PAGE_SPAN && mWorkspace.hasExtraEmptyScreen()) { return 1; } else { @@ -171,8 +171,8 @@ public class WallpaperOffsetInterpolator implements Choreographer.FrameCallback } } - private int getNumScreensExcludingEmptyAndCustom() { - return mWorkspace.getChildCount() - numEmptyScreensToIgnore() - mWorkspace.numCustomPages(); + private int getNumScreensExcludingEmpty() { + return mWorkspace.getChildCount() - numEmptyScreensToIgnore(); } public void syncWithScroll() { @@ -207,13 +207,13 @@ public class WallpaperOffsetInterpolator implements Choreographer.FrameCallback public void setFinalX(float x) { scheduleUpdate(); mFinalOffset = Math.max(0f, Math.min(x, 1f)); - if (getNumScreensExcludingEmptyAndCustom() != mNumScreens) { + if (getNumScreensExcludingEmpty() != mNumScreens) { if (mNumScreens > 0 && Float.compare(mCurrentOffset, mFinalOffset) != 0) { // Don't animate if we're going from 0 screens, or if the final offset is the same // as the current offset animateToFinal(); } - mNumScreens = getNumScreensExcludingEmptyAndCustom(); + mNumScreens = getNumScreensExcludingEmpty(); } } |