Tweak spring-loaded workspace.
- No page indicators in spring-loaded mode - Don’t move workspace up as high - Scale workspace at 90% instead of 80% on phones - Increase speed of workspace -> spring-loaded -> workspace - Widgets were being scaled down twice when dragging from widget picker - Don't scale up icons when dragging (scaling other stuff down is enough) - Make scrim less dark and panels more transparent - Thin white border around page instead of highlight when hovering Change-Id: I963e91c20d4c0340480d165e0f3b8064783c0cb2
This commit is contained in:
parent
3c4906949f
commit
e0c3323656
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 2015, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="#3fffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="#3fffffff" />
|
||||
<stroke android:width="1dp" android:color="#fff" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</transition>
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
-->
|
||||
|
||||
<!-- TODO(twickham): Remove this file and the screenpanel drawables -->
|
||||
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item android:drawable="@drawable/screenpanel"/>
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
<!-- AllApps & Launcher transitions -->
|
||||
<!-- The alpha of the AppsCustomize bg in spring loaded mode -->
|
||||
<integer name="config_workspaceScrimAlpha">55</integer>
|
||||
<integer name="config_workspaceScrimAlpha">30</integer>
|
||||
<integer name="config_allAppsTransitionTime">100</integer>
|
||||
<integer name="config_overviewTransitionTime">250</integer>
|
||||
|
||||
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
|
||||
<integer name="config_workspaceSpringLoadShrinkPercentage">80</integer>
|
||||
<integer name="config_workspaceSpringLoadShrinkPercentage">90</integer>
|
||||
<!-- Out of 100, the percent to shrink the workspace during overview mode. -->
|
||||
<integer name="config_workspaceOverviewShrinkPercentage">70</integer>
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.graphics.Point;
|
|||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.TransitionDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Parcelable;
|
||||
|
@ -45,7 +46,6 @@ import android.view.ViewDebug;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler;
|
||||
import com.android.launcher3.FolderIcon.FolderRingAnimator;
|
||||
|
@ -53,6 +53,7 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
|||
import com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate;
|
||||
import com.android.launcher3.accessibility.FolderAccessibilityHelper;
|
||||
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.util.ParcelableSparseArray;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
@ -205,7 +206,9 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
|
|||
final Resources res = getResources();
|
||||
mHotseatScale = (float) grid.hotseatIconSizePx / grid.iconSizePx;
|
||||
|
||||
mBackground = (TransitionDrawable) res.getDrawable(R.drawable.bg_screenpanel);
|
||||
mBackground = (TransitionDrawable) res.getDrawable(
|
||||
FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND ? R.drawable.bg_screenpanel
|
||||
: R.drawable.bg_celllayout);
|
||||
mBackground.setCallback(this);
|
||||
mBackground.setAlpha((int) (mBackgroundAlpha * 255));
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ import android.view.ViewGroup.MarginLayoutParams;
|
|||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
|
||||
public class DeviceProfile {
|
||||
|
||||
public final InvariantDeviceProfile inv;
|
||||
|
@ -242,7 +244,8 @@ public class DeviceProfile {
|
|||
FontMetrics fm = textPaint.getFontMetrics();
|
||||
cellWidthPx = iconSizePx;
|
||||
cellHeightPx = iconSizePx + iconDrawablePaddingPx + (int) Math.ceil(fm.bottom - fm.top);
|
||||
final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
|
||||
final float scaleDps = !FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND ? 0f
|
||||
: res.getDimensionPixelSize(R.dimen.dragViewScale);
|
||||
dragViewScale = (iconSizePx + scaleDps) / iconSizePx;
|
||||
|
||||
// Hotseat
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.android.launcher3.FolderInfo.FolderListener;
|
|||
import com.android.launcher3.UninstallDropTarget.UninstallSource;
|
||||
import com.android.launcher3.Workspace.ItemOperator;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.AccessibilityDragSource;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
|
@ -291,7 +292,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
}
|
||||
|
||||
mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS :
|
||||
IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
mLauncher.getWorkspace().setAddNewPageOnDrag(!enable);
|
||||
}
|
||||
|
||||
|
@ -968,7 +969,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
|
||||
@Override
|
||||
public boolean supportsAppInfoDropTarget() {
|
||||
return Workspace.IS_SPRING_LOADED;
|
||||
return !FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,6 +101,7 @@ import com.android.launcher3.compat.LauncherActivityInfoCompat;
|
|||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
|
@ -3476,7 +3477,7 @@ public class Launcher extends Activity
|
|||
mState = State.APPS_SPRING_LOADED;
|
||||
} else if (isWidgetsViewVisible()) {
|
||||
mState = State.WIDGETS_SPRING_LOADED;
|
||||
} else if (Workspace.IS_SPRING_LOADED) {
|
||||
} else if (!FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) {
|
||||
mState = State.WORKSPACE_SPRING_LOADED;
|
||||
} else {
|
||||
mState = State.WORKSPACE;
|
||||
|
@ -3505,7 +3506,7 @@ public class Launcher extends Activity
|
|||
}, delay);
|
||||
}
|
||||
|
||||
private boolean isStateSpringLoaded() {
|
||||
boolean isStateSpringLoaded() {
|
||||
return mState == State.WORKSPACE_SPRING_LOADED || mState == State.APPS_SPRING_LOADED
|
||||
|| mState == State.WIDGETS_SPRING_LOADED;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.Accessi
|
|||
import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate;
|
||||
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
|
||||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.config.ProviderConfig;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
|
@ -90,7 +91,6 @@ public class Workspace extends PagedView
|
|||
Insettable, UninstallSource, AccessibilityDragSource, Stats.LaunchSourceProvider {
|
||||
private static final String TAG = "Launcher.Workspace";
|
||||
|
||||
public static final boolean IS_SPRING_LOADED = true;
|
||||
private static boolean ENFORCE_DRAG_EVENT_ORDER = false;
|
||||
|
||||
private static final int SNAP_OFF_EMPTY_SCREEN_DURATION = 400;
|
||||
|
@ -402,11 +402,6 @@ public class Workspace extends PagedView
|
|||
mLauncher.onInteractionEnd();
|
||||
}
|
||||
|
||||
/** Returns a scale factor to apply to workspace icons when dragging them from the workspace. */
|
||||
public float getDragShrinkFactor() {
|
||||
return IS_SPRING_LOADED ? mSpringLoadedShrinkFactor : 1f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes various states for this workspace.
|
||||
*/
|
||||
|
@ -1797,7 +1792,14 @@ public class Workspace extends PagedView
|
|||
}
|
||||
|
||||
int getSpringLoadedTranslationY() {
|
||||
return getOverviewModeTranslationY();
|
||||
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||
Rect workspacePadding = grid.getWorkspacePadding(Utilities.isRtl(getResources()));
|
||||
int scaledHeight = (int) (mSpringLoadedShrinkFactor * getNormalChildHeight());
|
||||
int workspaceTop = mInsets.top + workspacePadding.top;
|
||||
int workspaceBottom = getViewportHeight() - mInsets.bottom - workspacePadding.bottom;
|
||||
int workspaceHeight = workspaceBottom - workspaceTop;
|
||||
// Center the spring-loaded pages by translating it up by half of the reduced height.
|
||||
return -(workspaceHeight - scaledHeight) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2145,7 +2147,7 @@ public class Workspace extends PagedView
|
|||
|
||||
b.recycle();
|
||||
|
||||
if (IS_SPRING_LOADED) {
|
||||
if (!FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) {
|
||||
mLauncher.enterSpringLoadedDragMode();
|
||||
}
|
||||
}
|
||||
|
@ -2197,7 +2199,7 @@ public class Workspace extends PagedView
|
|||
// Recycle temporary bitmaps
|
||||
tmpB.recycle();
|
||||
|
||||
if (IS_SPRING_LOADED) {
|
||||
if (!FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) {
|
||||
mLauncher.enterSpringLoadedDragMode();
|
||||
}
|
||||
}
|
||||
|
@ -2639,7 +2641,7 @@ public class Workspace extends PagedView
|
|||
setCurrentDropLayout(layout);
|
||||
setCurrentDragOverlappingLayout(layout);
|
||||
|
||||
if (!workspaceInModalState() && !IS_SPRING_LOADED) {
|
||||
if (!workspaceInModalState() && FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) {
|
||||
mLauncher.getDragLayer().showPageHints();
|
||||
}
|
||||
}
|
||||
|
@ -3561,7 +3563,7 @@ public class Workspace extends PagedView
|
|||
|
||||
@Override
|
||||
public boolean supportsAppInfoDropTarget() {
|
||||
return IS_SPRING_LOADED;
|
||||
return !FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -198,6 +198,7 @@ public class WorkspaceStateTransitionAnimation {
|
|||
@Thunk int mAllAppsTransitionTime;
|
||||
@Thunk int mOverviewTransitionTime;
|
||||
@Thunk int mOverlayTransitionTime;
|
||||
@Thunk int mSpringLoadedTransitionTime;
|
||||
@Thunk boolean mWorkspaceFadeInAdjacentScreens;
|
||||
|
||||
public WorkspaceStateTransitionAnimation(Launcher launcher, Workspace workspace) {
|
||||
|
@ -209,6 +210,7 @@ public class WorkspaceStateTransitionAnimation {
|
|||
mAllAppsTransitionTime = res.getInteger(R.integer.config_allAppsTransitionTime);
|
||||
mOverviewTransitionTime = res.getInteger(R.integer.config_overviewTransitionTime);
|
||||
mOverlayTransitionTime = res.getInteger(R.integer.config_overlayTransitionTime);
|
||||
mSpringLoadedTransitionTime = mOverlayTransitionTime / 2;
|
||||
mSpringLoadedShrinkFactor =
|
||||
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100f;
|
||||
mOverviewModeShrinkFactor =
|
||||
|
@ -259,6 +261,9 @@ public class WorkspaceStateTransitionAnimation {
|
|||
return mAllAppsTransitionTime;
|
||||
} else if (states.workspaceToOverview || states.overviewToWorkspace) {
|
||||
return mOverviewTransitionTime;
|
||||
} else if (mLauncher.mState == Launcher.State.WORKSPACE_SPRING_LOADED
|
||||
|| states.oldStateIsNormal && states.stateIsSpringLoaded) {
|
||||
return mSpringLoadedTransitionTime;
|
||||
} else {
|
||||
return mOverlayTransitionTime;
|
||||
}
|
||||
|
@ -282,8 +287,8 @@ public class WorkspaceStateTransitionAnimation {
|
|||
// Update the workspace state
|
||||
float finalBackgroundAlpha = (states.stateIsSpringLoaded || states.stateIsOverview) ?
|
||||
1.0f : 0f;
|
||||
float finalHotseatAndPageIndicatorAlpha = (states.stateIsNormal || states.stateIsSpringLoaded) ?
|
||||
1f : 0f;
|
||||
float finalHotseatAlpha = (states.stateIsNormal || states.stateIsSpringLoaded) ? 1f : 0f;
|
||||
float finalPageIndicatorAlpha = states.stateIsNormal ? 1f : 0f;
|
||||
float finalOverviewPanelAlpha = states.stateIsOverview ? 1f : 0f;
|
||||
|
||||
float finalWorkspaceTranslationY = 0;
|
||||
|
@ -393,7 +398,7 @@ public class WorkspaceStateTransitionAnimation {
|
|||
Animator pageIndicatorAlpha;
|
||||
if (pageIndicator != null) {
|
||||
pageIndicatorAlpha = new LauncherViewPropertyAnimator(pageIndicator)
|
||||
.alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
|
||||
.alpha(finalPageIndicatorAlpha).withLayer();
|
||||
pageIndicatorAlpha.addListener(new AlphaUpdateListener(pageIndicator,
|
||||
accessibilityEnabled));
|
||||
} else {
|
||||
|
@ -402,7 +407,7 @@ public class WorkspaceStateTransitionAnimation {
|
|||
}
|
||||
|
||||
LauncherViewPropertyAnimator hotseatAlpha = new LauncherViewPropertyAnimator(hotseat)
|
||||
.alpha(finalHotseatAndPageIndicatorAlpha);
|
||||
.alpha(finalHotseatAlpha);
|
||||
hotseatAlpha.addListener(new AlphaUpdateListener(hotseat, accessibilityEnabled));
|
||||
|
||||
LauncherViewPropertyAnimator overviewPanelAlpha =
|
||||
|
@ -456,10 +461,10 @@ public class WorkspaceStateTransitionAnimation {
|
|||
} else {
|
||||
overviewPanel.setAlpha(finalOverviewPanelAlpha);
|
||||
AlphaUpdateListener.updateVisibility(overviewPanel, accessibilityEnabled);
|
||||
hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha);
|
||||
hotseat.setAlpha(finalHotseatAlpha);
|
||||
AlphaUpdateListener.updateVisibility(hotseat, accessibilityEnabled);
|
||||
if (pageIndicator != null) {
|
||||
pageIndicator.setAlpha(finalHotseatAndPageIndicatorAlpha);
|
||||
pageIndicator.setAlpha(finalPageIndicatorAlpha);
|
||||
AlphaUpdateListener.updateVisibility(pageIndicator, accessibilityEnabled);
|
||||
}
|
||||
mWorkspace.updateCustomContentVisibility();
|
||||
|
|
|
@ -24,7 +24,6 @@ package com.android.launcher3.config;
|
|||
* Use LAUNCHER3_ prefix for prevent namespace conflicts.
|
||||
*/
|
||||
public final class FeatureFlags {
|
||||
|
||||
private FeatureFlags() {}
|
||||
|
||||
public static boolean IS_DEV_BUILD = false;
|
||||
|
@ -33,5 +32,6 @@ public final class FeatureFlags {
|
|||
|
||||
// Custom flags go below this
|
||||
public static boolean LAUNCHER3_ICON_NORMALIZATION = false;
|
||||
|
||||
// As opposed to the new spring-loaded workspace.
|
||||
public static boolean LAUNCHER3_LEGACY_WORKSPACE_DND = false;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.android.launcher3.PagedView;
|
|||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
|
@ -245,10 +246,9 @@ public class DragController implements DragDriver.EventListener {
|
|||
|
||||
mDragObject = new DropTarget.DragObject();
|
||||
|
||||
float finalDragViewScale = mLauncher.getWorkspace().getDragShrinkFactor();
|
||||
final DragView dragView = mDragObject.dragView = new DragView(mLauncher, b, registrationX,
|
||||
registrationY, 0, 0, b.getWidth(), b.getHeight(),
|
||||
initialDragViewScale, finalDragViewScale);
|
||||
initialDragViewScale);
|
||||
|
||||
mDragObject.dragComplete = false;
|
||||
if (mIsAccessibleDrag) {
|
||||
|
@ -572,7 +572,7 @@ public class DragController implements DragDriver.EventListener {
|
|||
if (mScrollState == SCROLL_OUTSIDE_ZONE) {
|
||||
mScrollState = SCROLL_WAITING_IN_ZONE;
|
||||
if (mDragScroller.onEnterScrollArea(x, y, forwardDirection)) {
|
||||
dragLayer.onEnterScrollArea(forwardDirection);
|
||||
dragLayer.onEnterScrollArea();
|
||||
mScrollRunnable.setDirection(forwardDirection);
|
||||
mHandler.postDelayed(mScrollRunnable, delay);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ public class DragController implements DragDriver.EventListener {
|
|||
if (mScrollState == SCROLL_OUTSIDE_ZONE) {
|
||||
mScrollState = SCROLL_WAITING_IN_ZONE;
|
||||
if (mDragScroller.onEnterScrollArea(x, y, backwardsDirection)) {
|
||||
dragLayer.onEnterScrollArea(backwardsDirection);
|
||||
dragLayer.onEnterScrollArea();
|
||||
mScrollRunnable.setDirection(backwardsDirection);
|
||||
mHandler.postDelayed(mScrollRunnable, delay);
|
||||
}
|
||||
|
|
|
@ -897,7 +897,7 @@ public class DragLayer extends InsettableFrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
void onEnterScrollArea(int direction) {
|
||||
void onEnterScrollArea() {
|
||||
mInScrollArea = true;
|
||||
invalidate();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import android.view.animation.DecelerateInterpolator;
|
|||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
@ -84,15 +85,15 @@ public class DragView extends View {
|
|||
*/
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
|
||||
int left, int top, int width, int height, final float initialScale,
|
||||
float finalDragViewScale) {
|
||||
int left, int top, int width, int height, final float initialScale) {
|
||||
super(launcher);
|
||||
mDragLayer = launcher.getDragLayer();
|
||||
mDragController = launcher.getDragController();
|
||||
|
||||
final Resources res = getResources();
|
||||
final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
|
||||
final float scale = finalDragViewScale * (width + scaleDps) / width;
|
||||
final float scaleDps = !FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND ? 0f
|
||||
: res.getDimensionPixelSize(R.dimen.dragViewScale);
|
||||
final float scale = (width + scaleDps) / width;
|
||||
|
||||
// Set the initial scale to avoid any jumps
|
||||
setScaleX(initialScale);
|
||||
|
|
Loading…
Reference in New Issue