Snap for 7269597 from ddbf785d68 to tm-release
Change-Id: I069f4f0c6099bcc1218bfb64cccbfafac58ecb96
This commit is contained in:
commit
83a69ac83c
50 files changed
+406
-831
No files matched your search
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
<com.android.quickstep.views.AllAppsScrimView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scrim_view" />
|
||||
@@ -18,12 +18,9 @@ package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.graphics.OverviewScrim.SCRIM_MULTIPLIER;
|
||||
import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
@@ -40,7 +37,6 @@ import androidx.annotation.NonNull;
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
@@ -70,9 +66,6 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f);
|
||||
|
||||
getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0);
|
||||
OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
|
||||
SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher));
|
||||
SCRIM_MULTIPLIER.set(scrim, 1f);
|
||||
getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
|
||||
RECENTS_GRID_PROGRESS.set(mRecentsView,
|
||||
state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f);
|
||||
@@ -111,16 +104,6 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
|
||||
setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0,
|
||||
config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
|
||||
OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
|
||||
setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher),
|
||||
config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
|
||||
setter.setFloat(scrim, SCRIM_MULTIPLIER, 1f,
|
||||
config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
|
||||
if (toState.areElementsVisible(mLauncher, LauncherState.SPLIT_PLACHOLDER_VIEW)) {
|
||||
scrim.updateStableScrimmedView(mLauncher.getSplitPlaceholderView());
|
||||
} else {
|
||||
scrim.updateStableScrimmedView(mLauncher.getOverviewPanel());
|
||||
}
|
||||
|
||||
setter.setFloat(
|
||||
mRecentsView, getTaskModalnessProperty(),
|
||||
|
||||
@@ -90,4 +90,9 @@ public class AllAppsState extends LauncherState {
|
||||
public LauncherState getHistoryForState(LauncherState previousState) {
|
||||
return previousState == OVERVIEW ? OVERVIEW : NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class OverviewState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOverviewScrimAlpha(Launcher launcher) {
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -44,7 +44,6 @@ import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.SingleAxisSwipeDetector;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
@@ -141,10 +140,6 @@ public class NavBarToHomeTouchController implements TouchController,
|
||||
AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher,
|
||||
builder);
|
||||
|
||||
builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(),
|
||||
OverviewScrim.SCRIM_MULTIPLIER, OVERVIEW_TO_HOME_SCRIM_MULTIPLIER,
|
||||
PULLBACK_INTERPOLATOR);
|
||||
|
||||
if (LIVE_TILE.get()) {
|
||||
builder.addOnFrameCallback(recentsView::redrawLiveTile);
|
||||
}
|
||||
|
||||
+5
-5
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.uioverrides.touchcontrollers;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.HINT_STATE;
|
||||
@@ -45,7 +46,6 @@ import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.util.VibratorWrapper;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -128,10 +128,10 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
|
||||
|
||||
if (mFromState == NORMAL && mToState == HINT_STATE) {
|
||||
mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat(
|
||||
mLauncher.getDragLayer().getOverviewScrim(),
|
||||
OverviewScrim.SCRIM_PROGRESS,
|
||||
mFromState.getOverviewScrimAlpha(mLauncher),
|
||||
mToState.getOverviewScrimAlpha(mLauncher));
|
||||
mLauncher.getScrimView(),
|
||||
VIEW_ALPHA,
|
||||
mFromState.getWorkspaceScrimAlpha(mLauncher),
|
||||
mToState.getWorkspaceScrimAlpha(mLauncher));
|
||||
}
|
||||
mStartedOverview = false;
|
||||
mReachedOverview = false;
|
||||
|
||||
+3
-3
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.uioverrides.touchcontrollers;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
@@ -59,7 +60,6 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.BaseSwipeDetector;
|
||||
import com.android.launcher3.touch.BothAxesSwipeDetector;
|
||||
@@ -231,8 +231,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
||||
// - OverviewScrim
|
||||
PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2));
|
||||
xAnim.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], LINEAR);
|
||||
xAnim.setFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS,
|
||||
toState.getOverviewScrimAlpha(mLauncher), LINEAR);
|
||||
xAnim.setFloat(mLauncher.getScrimView(), VIEW_ALPHA,
|
||||
toState.getWorkspaceScrimAlpha(mLauncher), LINEAR);
|
||||
mXOverviewAnim = xAnim.createPlaybackController();
|
||||
mXOverviewAnim.dispatchOnStart();
|
||||
|
||||
|
||||
@@ -180,10 +180,9 @@ public final class TaskViewUtils {
|
||||
int taskIndex = recentsView.indexOfChild(v);
|
||||
Context context = v.getContext();
|
||||
DeviceProfile dp = BaseActivity.fromContext(context).getDeviceProfile();
|
||||
boolean showAsGrid = dp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get();
|
||||
boolean parallaxCenterAndAdjacentTask =
|
||||
taskIndex != recentsView.getCurrentPage() && !(dp.isTablet
|
||||
&& FeatureFlags.ENABLE_OVERVIEW_GRID.get());
|
||||
float gridProgress = recentsView.getGridProgress();
|
||||
taskIndex != recentsView.getCurrentPage() && !showAsGrid;
|
||||
float gridTranslationSecondary = recentsView.getGridTranslationSecondary(taskIndex);
|
||||
int startScroll = recentsView.getScrollOffset(taskIndex);
|
||||
|
||||
@@ -201,7 +200,9 @@ public final class TaskViewUtils {
|
||||
tsv.setPreview(targets.apps[targets.apps.length - 1]);
|
||||
tsv.fullScreenProgress.value = 0;
|
||||
tsv.recentsViewScale.value = 1;
|
||||
tsv.taskSecondaryTranslation.value = gridTranslationSecondary;
|
||||
if (showAsGrid) {
|
||||
tsv.taskSecondaryTranslation.value = gridTranslationSecondary;
|
||||
}
|
||||
tsv.setScroll(startScroll);
|
||||
|
||||
// Fade in the task during the initial 20% of the animation
|
||||
@@ -214,9 +215,12 @@ public final class TaskViewUtils {
|
||||
AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR);
|
||||
out.setFloat(tsv.recentsViewScale,
|
||||
AnimatedFloat.VALUE, tsv.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR);
|
||||
out.setFloat(tsv.taskSecondaryTranslation, AnimatedFloat.VALUE, 0,
|
||||
TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL);
|
||||
out.setInt(tsv, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR);
|
||||
if (showAsGrid) {
|
||||
out.setFloat(tsv.taskSecondaryTranslation, AnimatedFloat.VALUE, 0,
|
||||
TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL);
|
||||
}
|
||||
out.setFloat(tsv.recentsViewScroll, AnimatedFloat.VALUE, 0,
|
||||
TOUCH_RESPONSE_INTERPOLATOR);
|
||||
|
||||
TaskViewSimulator finalTsv = tsv;
|
||||
TransformParams finalParams = params;
|
||||
@@ -374,7 +378,8 @@ public final class TaskViewUtils {
|
||||
AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR);
|
||||
out.setFloat(tvs.recentsViewScale,
|
||||
AnimatedFloat.VALUE, tvs.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR);
|
||||
out.setInt(tvs, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR);
|
||||
out.setFloat(tvs.recentsViewScroll,
|
||||
AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR);
|
||||
|
||||
TaskViewSimulator finalTsv = tvs;
|
||||
TransformParams finalParams = params;
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.quickstep.util;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
|
||||
@@ -42,9 +41,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.anim.SpringAnimationBuilder;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.util.DynamicResource;
|
||||
@@ -134,7 +131,8 @@ public class StaggeredWorkspaceAnim {
|
||||
|
||||
if (animateOverviewScrim) {
|
||||
PendingAnimation pendingAnimation = new PendingAnimation(DURATION_MS);
|
||||
addScrimAnimationForState(launcher, NORMAL, pendingAnimation);
|
||||
launcher.getWorkspace().getStateTransitionAnimation()
|
||||
.setScrim(pendingAnimation, NORMAL, new StateAnimationConfig());
|
||||
mAnimators.play(pendingAnimation.buildAnim());
|
||||
}
|
||||
|
||||
@@ -192,7 +190,8 @@ public class StaggeredWorkspaceAnim {
|
||||
launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
|
||||
|
||||
if (animateOverviewScrim) {
|
||||
addScrimAnimationForState(launcher, BACKGROUND_APP, NO_ANIM_PROPERTY_SETTER);
|
||||
launcher.getWorkspace().getStateTransitionAnimation()
|
||||
.setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,16 +262,6 @@ public class StaggeredWorkspaceAnim {
|
||||
mAnimators.play(alpha);
|
||||
}
|
||||
|
||||
private void addScrimAnimationForState(Launcher launcher, LauncherState state,
|
||||
PropertySetter setter) {
|
||||
launcher.getWorkspace().getStateTransitionAnimation().setScrim(setter, state);
|
||||
setter.setFloat(
|
||||
launcher.getDragLayer().getOverviewScrim(),
|
||||
OverviewScrim.SCRIM_PROGRESS,
|
||||
state.getOverviewScrimAlpha(launcher),
|
||||
ACCEL_DEACCEL);
|
||||
}
|
||||
|
||||
private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
|
||||
if (!(launcher instanceof BaseQuickstepLauncher)) {
|
||||
return;
|
||||
|
||||
@@ -30,17 +30,14 @@ import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.util.IntProperty;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
import com.android.quickstep.views.RecentsView.ScrollState;
|
||||
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
|
||||
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
@@ -52,19 +49,6 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.
|
||||
*/
|
||||
public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
|
||||
public static final IntProperty<TaskViewSimulator> SCROLL =
|
||||
new IntProperty<TaskViewSimulator>("scroll") {
|
||||
@Override
|
||||
public void setValue(TaskViewSimulator simulator, int scroll) {
|
||||
simulator.setScroll(scroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(TaskViewSimulator simulator) {
|
||||
return simulator.mScrollState.scroll;
|
||||
}
|
||||
};
|
||||
|
||||
private final Rect mTmpCropRect = new Rect();
|
||||
private final RectF mTempRectF = new RectF();
|
||||
private final float[] mTempPoint = new float[2];
|
||||
@@ -101,11 +85,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
public final AnimatedFloat fullScreenProgress = new AnimatedFloat();
|
||||
public final AnimatedFloat recentsViewSecondaryTranslation = new AnimatedFloat();
|
||||
public final AnimatedFloat recentsViewPrimaryTranslation = new AnimatedFloat();
|
||||
private final ScrollState mScrollState = new ScrollState();
|
||||
public final AnimatedFloat recentsViewScroll = new AnimatedFloat();
|
||||
|
||||
// Cached calculations
|
||||
private boolean mLayoutValid = false;
|
||||
private boolean mScrollValid = false;
|
||||
private int mOrientationStateId;
|
||||
|
||||
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
|
||||
@@ -172,11 +155,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
/**
|
||||
* Updates the scroll for RecentsView
|
||||
*/
|
||||
public void setScroll(int scroll) {
|
||||
if (mScrollState.scroll != scroll) {
|
||||
mScrollState.scroll = scroll;
|
||||
mScrollValid = false;
|
||||
}
|
||||
public void setScroll(float scroll) {
|
||||
recentsViewScroll.value = scroll;
|
||||
}
|
||||
|
||||
public void setDrawsBelowRecents(boolean drawsBelowRecents) {
|
||||
@@ -268,20 +248,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
mTaskRect.width(), mTaskRect.height(),
|
||||
mDp, mOrientationState.getRecentsActivityRotation(), isRtlEnabled);
|
||||
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
|
||||
|
||||
PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
|
||||
mScrollState.halfPageSize =
|
||||
poh.getPrimaryValue(mTaskRect.width(), mTaskRect.height()) / 2;
|
||||
mScrollState.halfScreenSize = poh.getPrimaryValue(mDp.widthPx, mDp.heightPx) / 2;
|
||||
mScrollValid = false;
|
||||
}
|
||||
|
||||
if (!mScrollValid) {
|
||||
mScrollValid = true;
|
||||
int start = mOrientationState.getOrientationHandler()
|
||||
.getPrimaryValue(mTaskRect.left, mTaskRect.top);
|
||||
mScrollState.screenCenter = start + mScrollState.scroll + mScrollState.halfPageSize;
|
||||
mScrollState.updateInterpolation(mDp, start);
|
||||
}
|
||||
|
||||
float fullScreenProgress = Utilities.boundToRange(this.fullScreenProgress.value, 0, 1);
|
||||
@@ -306,7 +272,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
taskSecondaryTranslation.value);
|
||||
mOrientationState.getOrientationHandler().set(
|
||||
mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);
|
||||
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
|
||||
|
||||
// Apply RecentsView matrix
|
||||
mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.quickstep.views;
|
||||
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ScrimView;
|
||||
|
||||
/**
|
||||
* Scrim used for all-apps background. uses interpolator to coordinate fade in with
|
||||
* all-apps contents
|
||||
*
|
||||
* Note: ranges are inverted because progress goes from 1 to 0 for NORMAL->AllAPPS
|
||||
*/
|
||||
public class AllAppsScrimView extends ScrimView<BaseQuickstepLauncher> {
|
||||
|
||||
private static final float TINT_DECAY_MULTIPLIER = .5f;
|
||||
|
||||
//min progress for scrim to become visible
|
||||
private static final float SCRIM_VISIBLE_THRESHOLD = .9f;
|
||||
//max progress where scrim alpha animates.
|
||||
private static final float SCRIM_SOLID_THRESHOLD = .5f;
|
||||
private final Interpolator mScrimInterpolator = Interpolators.clampToProgress(ACCEL,
|
||||
SCRIM_SOLID_THRESHOLD,
|
||||
SCRIM_VISIBLE_THRESHOLD);
|
||||
|
||||
// In transposed layout, we simply draw a flat color.
|
||||
private boolean mDrawingFlatColor;
|
||||
|
||||
private final int mEndAlpha;
|
||||
private final Paint mPaint;
|
||||
|
||||
private int mCurrentScrimColor;
|
||||
private final int mTintColor;
|
||||
|
||||
public AllAppsScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mMaxScrimAlpha = Math.round(OVERVIEW.getOverviewScrimAlpha(mLauncher) * 255);
|
||||
mTintColor = Themes.getColorAccent(mContext);
|
||||
|
||||
|
||||
mEndAlpha = Color.alpha(mEndScrim);
|
||||
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
// Just assume the easiest UI for now, until we have the proper layout information.
|
||||
mDrawingFlatColor = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reInitUi() {
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
mDrawingFlatColor = dp.isVerticalBarLayout();
|
||||
updateColors();
|
||||
updateSysUiColors();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateColors() {
|
||||
super.updateColors();
|
||||
if (mDrawingFlatColor) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProgress >= 1) {
|
||||
mCurrentScrimColor = 0;
|
||||
} else {
|
||||
float interpolationProgress = mScrimInterpolator.getInterpolation(mProgress);
|
||||
// Note that these ranges and interpolators are inverted because progress goes 1 to 0.
|
||||
int alpha = Math.round(Utilities.mapRange(interpolationProgress, mEndAlpha, 0));
|
||||
int color = ColorUtils.blendARGB(mEndScrim, mTintColor,
|
||||
mProgress * TINT_DECAY_MULTIPLIER);
|
||||
mCurrentScrimColor = setColorAlphaBound(color, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mDrawingFlatColor) {
|
||||
if (mCurrentFlatColor != 0) {
|
||||
canvas.drawColor(mCurrentFlatColor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Color.alpha(mCurrentScrimColor) == 0) {
|
||||
return;
|
||||
} else if (mProgress <= 0) {
|
||||
canvas.drawColor(mCurrentScrimColor);
|
||||
return;
|
||||
}
|
||||
|
||||
mPaint.setColor(mCurrentScrimColor);
|
||||
canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,8 @@ import android.widget.Button;
|
||||
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.quickstep.views.RecentsView.PageCallbacks;
|
||||
import com.android.quickstep.views.RecentsView.ScrollState;
|
||||
|
||||
public class ClearAllButton extends Button implements PageCallbacks {
|
||||
public class ClearAllButton extends Button {
|
||||
|
||||
public static final FloatProperty<ClearAllButton> VISIBILITY_ALPHA =
|
||||
new FloatProperty<ClearAllButton>("visibilityAlpha") {
|
||||
@@ -99,8 +97,7 @@ public class ClearAllButton extends Button implements PageCallbacks {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScroll(ScrollState scrollState, boolean gridEnabled) {
|
||||
public void onRecentsViewScroll(int scrollFromEdge, boolean gridEnabled) {
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (recentsView == null) {
|
||||
return;
|
||||
@@ -113,7 +110,7 @@ public class ClearAllButton extends Button implements PageCallbacks {
|
||||
}
|
||||
|
||||
int leftEdgeScroll = recentsView.getLeftMostChildScroll();
|
||||
float adjustedScrollFromEdge = scrollState.scrollFromEdge - leftEdgeScroll;
|
||||
int adjustedScrollFromEdge = scrollFromEdge - leftEdgeScroll;
|
||||
float shift = Math.min(adjustedScrollFromEdge, orientationSize);
|
||||
mNormalTranslationPrimary = mIsRtl ? -shift : shift;
|
||||
if (!gridEnabled) {
|
||||
|
||||
@@ -72,7 +72,6 @@ public final class DigitalWellBeingToast {
|
||||
private View mBanner;
|
||||
private ViewOutlineProvider mOldBannerOutlineProvider;
|
||||
private float mBannerOffsetPercentage;
|
||||
private float mBannerAlpha = 1f;
|
||||
private float mVerticalOffset = 0f;
|
||||
|
||||
public DigitalWellBeingToast(BaseDraggingActivity activity, TaskView taskView) {
|
||||
@@ -99,10 +98,6 @@ public final class DigitalWellBeingToast {
|
||||
|
||||
mTaskView.setContentDescription(
|
||||
getContentDescriptionForTask(mTask, appUsageLimitTimeMs, appRemainingTimeMs));
|
||||
RecentsView rv = mTaskView.getRecentsView();
|
||||
if (rv != null) {
|
||||
rv.onDigitalWellbeingToastShown();
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
@@ -263,7 +258,6 @@ public final class DigitalWellBeingToast {
|
||||
layoutParams.bottomMargin = ((ViewGroup.MarginLayoutParams)
|
||||
mTaskView.getThumbnail().getLayoutParams()).bottomMargin;
|
||||
mBanner.setTranslationY(mBannerOffsetPercentage * mBanner.getHeight());
|
||||
mBanner.setAlpha(mBannerAlpha);
|
||||
mTaskView.addView(mBanner);
|
||||
}
|
||||
|
||||
@@ -288,18 +282,11 @@ public final class DigitalWellBeingToast {
|
||||
}
|
||||
}
|
||||
|
||||
void updateBannerAlpha(float alpha) {
|
||||
if (mBanner != null && mBannerAlpha != alpha) {
|
||||
mBannerAlpha = alpha;
|
||||
mBanner.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
void setBannerColorTint(int color, float amount) {
|
||||
if (mBanner == null) {
|
||||
return;
|
||||
}
|
||||
if (mBannerAlpha == 0 || amount == 0) {
|
||||
if (amount == 0) {
|
||||
mBanner.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
}
|
||||
Paint layerPaint = new Paint();
|
||||
|
||||
@@ -149,9 +149,10 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldStealTouchFromSiblingsBelow(MotionEvent ev) {
|
||||
return mActivity.getStateManager().getState().overviewUi
|
||||
&& super.shouldStealTouchFromSiblingsBelow(ev);
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
boolean result = super.onTouchEvent(ev);
|
||||
// Do not let touch escape to siblings below this view.
|
||||
return result || mActivity.getStateManager().getState().overviewUi;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import android.widget.FrameLayout;
|
||||
/**
|
||||
* Empty view to house recents overview extra card
|
||||
*/
|
||||
public class RecentsExtraViewContainer extends FrameLayout implements RecentsView.PageCallbacks {
|
||||
public class RecentsExtraViewContainer extends FrameLayout {
|
||||
|
||||
private boolean mScrollable = false;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import static android.view.Surface.ROTATION_0;
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.makeMeasureSpec;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
|
||||
import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS;
|
||||
@@ -114,7 +116,6 @@ import com.android.launcher3.statemanager.BaseState;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties;
|
||||
import com.android.launcher3.util.DynamicResource;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
@@ -167,8 +168,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
InvariantDeviceProfile.OnIDPChangeListener, TaskVisualsChangeListener,
|
||||
SplitScreenBounds.OnChangeListener {
|
||||
|
||||
private static final String TAG = RecentsView.class.getSimpleName();
|
||||
|
||||
public static final FloatProperty<RecentsView> CONTENT_ALPHA =
|
||||
new FloatProperty<RecentsView>("contentAlpha") {
|
||||
@Override
|
||||
@@ -332,7 +331,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
*/
|
||||
private boolean mGestureActive;
|
||||
|
||||
private final ScrollState mScrollState = new ScrollState();
|
||||
// Keeps track of the previously known visible tasks for purposes of loading/unloading task data
|
||||
private final SparseBooleanArray mHasVisibleTaskData = new SparseBooleanArray();
|
||||
|
||||
@@ -342,7 +340,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
private final TaskOverlayFactory mTaskOverlayFactory;
|
||||
|
||||
private boolean mDwbToastShown;
|
||||
protected boolean mDisallowScrollToClearAll;
|
||||
private boolean mOverlayEnabled;
|
||||
protected boolean mFreezeViewVisibility;
|
||||
@@ -787,8 +784,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
private void cleanUp(boolean canceled) {
|
||||
if (mRecentsAnimationController != null) {
|
||||
mRecentsAnimationController.finish(false /* toRecents */,
|
||||
null /* onFinishComplete */);
|
||||
finishRecentsAnimation(false /* toRecents */, null /* onFinishComplete */);
|
||||
if (canceled) {
|
||||
mRecentsAnimationController = null;
|
||||
} else {
|
||||
@@ -865,12 +861,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
public void onDigitalWellbeingToastShown() {
|
||||
if (!mDwbToastShown) {
|
||||
mDwbToastShown = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Clear All button is hidden or fully visible. Used to determine if center
|
||||
* displayed page is a task or the Clear All button.
|
||||
@@ -963,9 +953,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Do not let touch escape to siblings below this view.
|
||||
return isHandlingTouch() || shouldStealTouchFromSiblingsBelow(ev);
|
||||
return isHandlingTouch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -980,9 +968,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
super.determineScrollingStart(ev, touchSlopScale);
|
||||
}
|
||||
}
|
||||
protected boolean shouldStealTouchFromSiblingsBelow(MotionEvent ev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void applyLoadPlan(ArrayList<Task> tasks) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
@@ -1243,11 +1228,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mClearAllButton.setFullscreenTranslationPrimary(
|
||||
accumulatedTranslationX - fullscreenTranslations[firstNonHomeTaskIndex]);
|
||||
|
||||
// Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
|
||||
// TaskViews.
|
||||
int clearAllWidthDiff = mTaskWidth - mClearAllButton.getWidth();
|
||||
mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
|
||||
|
||||
updateGridProperties(false);
|
||||
}
|
||||
|
||||
@@ -1334,17 +1314,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
if (getPageCount() == 0 || getPageAt(0).getMeasuredWidth() == 0) {
|
||||
return;
|
||||
}
|
||||
mOrientationHandler.getCurveProperties(this, mInsets, mScrollState);
|
||||
mScrollState.scrollFromEdge =
|
||||
mIsRtl ? mScrollState.scroll : (mMaxScroll - mScrollState.scroll);
|
||||
|
||||
final int pageCount = getPageCount();
|
||||
for (int i = 0; i < pageCount; i++) {
|
||||
View page = getPageAt(i);
|
||||
mScrollState.updateInterpolation(mActivity.getDeviceProfile(),
|
||||
mOrientationHandler.getChildStartWithTranslation(page));
|
||||
((PageCallbacks) page).onPageScroll(mScrollState, mOverviewGridEnabled);
|
||||
}
|
||||
int scroll = mOrientationHandler.getPrimaryScroll(this);
|
||||
int scrollFromEdge = mIsRtl ? scroll : (mMaxScroll - scroll);
|
||||
mClearAllButton.onRecentsViewScroll(scrollFromEdge, mOverviewGridEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1485,7 +1457,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
|
||||
setCurrentPage(0);
|
||||
mDwbToastShown = false;
|
||||
mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
|
||||
LayoutUtils.setViewEnabled(mActionsView, true);
|
||||
if (mOrientationState.setGestureActive(false)) {
|
||||
@@ -1600,6 +1571,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
getTaskViewAt(i).setOrientationState(mOrientationState);
|
||||
}
|
||||
TaskMenuView tv = (TaskMenuView) getTopOpenViewWithType(mActivity, TYPE_TASK_MENU);
|
||||
if (tv != null) {
|
||||
tv.onRotationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1952,7 +1927,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// When the unpinned task is added, snap to first page and disable transitions
|
||||
if (view instanceof TaskView) {
|
||||
snapToPage(0);
|
||||
disableLayoutTransitions();
|
||||
setLayoutTransition(null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1961,10 +1936,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
setLayoutTransition(mLayoutTransition);
|
||||
}
|
||||
|
||||
private void disableLayoutTransitions() {
|
||||
setLayoutTransition(null);
|
||||
}
|
||||
|
||||
public void setSwipeDownShouldLaunchApp(boolean swipeDownShouldLaunchApp) {
|
||||
mSwipeDownShouldLaunchApp = swipeDownShouldLaunchApp;
|
||||
}
|
||||
@@ -1973,44 +1944,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
return mSwipeDownShouldLaunchApp;
|
||||
}
|
||||
|
||||
public interface PageCallbacks {
|
||||
|
||||
/**
|
||||
* Updates the page UI based on scroll params.
|
||||
*
|
||||
* @param gridEnabled whether Overveiw is currently showing as 2 rows grid
|
||||
*/
|
||||
default void onPageScroll(ScrollState scrollState, boolean gridEnabled) {}
|
||||
}
|
||||
|
||||
public static class ScrollState extends CurveProperties {
|
||||
|
||||
/**
|
||||
* The progress from 0 to 1, where 0 is the center
|
||||
* of the screen and 1 is the edge of the screen.
|
||||
*/
|
||||
public float linearInterpolation;
|
||||
|
||||
/**
|
||||
* The amount by which all the content is scrolled relative to the end of the list.
|
||||
*/
|
||||
public float scrollFromEdge;
|
||||
|
||||
/**
|
||||
* Updates linearInterpolation for the provided child position
|
||||
*/
|
||||
public void updateInterpolation(DeviceProfile deviceProfile, float childStart) {
|
||||
float pageCenter = childStart + halfPageSize;
|
||||
float distanceFromScreenCenter = screenCenter - pageCenter;
|
||||
// How far the page has to move from the center to be offscreen, taking into account
|
||||
// the EDGE_SCALE_DOWN_FACTOR that will be applied at that position.
|
||||
float distanceToReachEdge = halfScreenSize
|
||||
+ halfPageSize * (1 - TaskView.getEdgeScaleDownFactor(deviceProfile));
|
||||
linearInterpolation = Math.min(1,
|
||||
Math.abs(distanceFromScreenCenter) / distanceToReachEdge);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIgnoreResetTask(int taskId) {
|
||||
mIgnoreResetTaskId = taskId;
|
||||
}
|
||||
@@ -2547,9 +2480,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mTempRectF.set(mLastComputedTaskSize);
|
||||
RectF taskPosition = mTempRectF;
|
||||
float desiredLeft = getWidth();
|
||||
float distanceToOffscreen = desiredLeft - taskPosition.left;
|
||||
// Used to calculate the scale of the task view based on its new offset.
|
||||
float centerToOffscreenProgress = Math.abs(offsetProgress);
|
||||
if (midpointIndex > -1) {
|
||||
// When there is a midpoint reference task, adjacent tasks have less distance to travel
|
||||
// to reach offscreen. Offset the task position to the task's starting point.
|
||||
@@ -2559,10 +2490,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
- mOrientationHandler.getChildStart(midpointChild)
|
||||
+ getDisplacementFromScreenCenter(midpointIndex));
|
||||
taskPosition.offset(distanceFromMidpoint, 0);
|
||||
centerToOffscreenProgress = Utilities.mapRange(centerToOffscreenProgress,
|
||||
distanceFromMidpoint / distanceToOffscreen, 1);
|
||||
}
|
||||
distanceToOffscreen = desiredLeft - taskPosition.left;
|
||||
float distanceToOffscreen = desiredLeft - taskPosition.left;
|
||||
// Finally, we need to account for RecentsView scale, because it moves tasks based on its
|
||||
// pivot. To do this, we move the task position to where it would be offscreen at scale = 1
|
||||
// (computed above), then we apply the scale via getMatrix() to determine how much that
|
||||
@@ -3010,6 +2939,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
public void finishRecentsAnimation(boolean toRecents, Runnable onFinishComplete) {
|
||||
if (!toRecents && LIVE_TILE.get()) {
|
||||
// Reset the minimized state since we force-toggled the minimized state when entering
|
||||
// overview, but never actually finished the recents animation. This is a catch all for
|
||||
// cases where we haven't already reset it.
|
||||
SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
|
||||
if (p != null) {
|
||||
p.setSplitScreenMinimized(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (mRecentsAnimationController == null) {
|
||||
if (onFinishComplete != null) {
|
||||
onFinishComplete.run();
|
||||
@@ -3076,6 +3015,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
|
||||
scrollLogic);
|
||||
|
||||
// Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
|
||||
// TaskViews. This must be called after laying out ClearAllButton.
|
||||
if (layoutChildren) {
|
||||
int clearAllWidthDiff = mTaskWidth - mClearAllButton.getWidth();
|
||||
mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
|
||||
}
|
||||
|
||||
final int childCount = getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = getChildAt(i);
|
||||
@@ -3169,15 +3115,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
taskView.getGridTranslationY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the progress of forming a grid from carousel.
|
||||
*
|
||||
* @return A float from 0 to 1 where 0 is a carousel and 1 is a 2 row grid.
|
||||
*/
|
||||
public float getGridProgress() {
|
||||
return mGridProgress;
|
||||
}
|
||||
|
||||
public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {
|
||||
float degreesRotated;
|
||||
if (navbarRotation == 0) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -51,7 +52,7 @@ import com.android.quickstep.util.TaskCornerRadius;
|
||||
/**
|
||||
* Contains options for a recent task when long-pressing its icon.
|
||||
*/
|
||||
public class TaskMenuView extends AbstractFloatingView {
|
||||
public class TaskMenuView extends AbstractFloatingView implements OnScrollChangedListener {
|
||||
|
||||
private static final Rect sTempRect = new Rect();
|
||||
|
||||
@@ -120,7 +121,8 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
};
|
||||
}
|
||||
|
||||
public void setPosition(float x, float y, PagedOrientationHandler pagedOrientationHandler) {
|
||||
private void setPosition(float x, float y) {
|
||||
PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
|
||||
int taskTopMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
float adjustedY = y + taskTopMargin;
|
||||
// Changing pivot to make computations easier
|
||||
@@ -150,11 +152,11 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
}
|
||||
}
|
||||
|
||||
public static TaskMenuView showForTask(TaskView taskView) {
|
||||
public static boolean showForTask(TaskView taskView) {
|
||||
BaseDraggingActivity activity = BaseDraggingActivity.fromContext(taskView.getContext());
|
||||
final TaskMenuView taskMenuView = (TaskMenuView) activity.getLayoutInflater().inflate(
|
||||
R.layout.task_menu, activity.getDragLayer(), false);
|
||||
return taskMenuView.populateAndShowForTask(taskView) ? taskMenuView : null;
|
||||
return taskMenuView.populateAndShowForTask(taskView);
|
||||
}
|
||||
|
||||
private boolean populateAndShowForTask(TaskView taskView) {
|
||||
@@ -167,9 +169,16 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
return false;
|
||||
}
|
||||
post(this::animateOpen);
|
||||
mActivity.getRootView().getViewTreeObserver().addOnScrollChangedListener(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
RecentsView rv = mTaskView.getRecentsView();
|
||||
setPosition(mTaskView.getX() - rv.getScrollX(), mTaskView.getY() - rv.getScrollY());
|
||||
}
|
||||
|
||||
/** @return true if successfully able to populate task view menu, false otherwise */
|
||||
private boolean populateAndLayoutMenu() {
|
||||
if (mTaskView.getTask().icon == null) {
|
||||
@@ -227,8 +236,7 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
.mOrientationState.isRecentsActivityRotationAllowed();
|
||||
mOptionLayout.setOrientation(orientationHandler
|
||||
.getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
|
||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
|
||||
taskView.getPagedOrientationHandler());
|
||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top);
|
||||
}
|
||||
|
||||
private void animateOpen() {
|
||||
@@ -274,6 +282,7 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
private void closeComplete() {
|
||||
mIsOpen = false;
|
||||
mActivity.getDragLayer().removeView(this);
|
||||
mActivity.getRootView().getViewTreeObserver().removeOnScrollChangedListener(this);
|
||||
}
|
||||
|
||||
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import static android.view.Surface.ROTATION_270;
|
||||
import static android.view.Surface.ROTATION_90;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
|
||||
import static com.android.launcher3.Utilities.comp;
|
||||
@@ -72,6 +73,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
@@ -94,6 +96,7 @@ import com.android.launcher3.util.TransformingTouchDelegate;
|
||||
import com.android.launcher3.util.ViewPool.Reusable;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.RemoteAnimationTargets;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskIconCache;
|
||||
import com.android.quickstep.TaskOverlayFactory;
|
||||
import com.android.quickstep.TaskThumbnailCache;
|
||||
@@ -102,8 +105,6 @@ import com.android.quickstep.TaskViewUtils;
|
||||
import com.android.quickstep.util.CancellableTask;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.TaskCornerRadius;
|
||||
import com.android.quickstep.views.RecentsView.PageCallbacks;
|
||||
import com.android.quickstep.views.RecentsView.ScrollState;
|
||||
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
@@ -118,7 +119,7 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* A task in the Recents view.
|
||||
*/
|
||||
public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
public class TaskView extends FrameLayout implements Reusable {
|
||||
|
||||
private static final String TAG = TaskView.class.getSimpleName();
|
||||
|
||||
@@ -265,26 +266,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
}
|
||||
};
|
||||
|
||||
private final OnAttachStateChangeListener mTaskMenuStateListener =
|
||||
new OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
if (mMenuView != null) {
|
||||
mMenuView.removeOnAttachStateChangeListener(this);
|
||||
mMenuView = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final TaskOutlineProvider mOutlineProvider;
|
||||
|
||||
private Task mTask;
|
||||
private TaskThumbnailView mSnapshotView;
|
||||
private TaskMenuView mMenuView;
|
||||
private IconView mIconView;
|
||||
private final DigitalWellBeingToast mDigitalWellBeingToast;
|
||||
private float mFullscreenProgress;
|
||||
@@ -343,47 +328,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mActivity = StatefulActivity.fromContext(context);
|
||||
setOnClickListener((view) -> {
|
||||
if (getTask() == null) {
|
||||
return;
|
||||
}
|
||||
if (LIVE_TILE.get() && isRunningTask()) {
|
||||
if (!mIsClickableAsLiveTile) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsClickableAsLiveTile = false;
|
||||
RecentsView recentsView = getRecentsView();
|
||||
RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet();
|
||||
recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(false);
|
||||
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
TaskViewUtils.composeRecentsLaunchAnimator(
|
||||
anim, this, targets.apps,
|
||||
targets.wallpapers, true /* launcherClosing */,
|
||||
mActivity.getStateManager(), recentsView,
|
||||
recentsView.getDepthController());
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(true);
|
||||
recentsView.finishRecentsAnimation(false, null);
|
||||
mIsClickableAsLiveTile = true;
|
||||
}
|
||||
});
|
||||
anim.start();
|
||||
} else {
|
||||
if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
|
||||
// User tapped to select second split screen app
|
||||
getRecentsView().confirmSplitSelect(this);
|
||||
} else {
|
||||
launchTaskAnimated();
|
||||
}
|
||||
}
|
||||
mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
|
||||
.log(LAUNCHER_TASK_LAUNCH_TAP);
|
||||
});
|
||||
setOnClickListener(this::onClick);
|
||||
|
||||
mCurrentFullscreenParams = new FullscreenDrawParams(context);
|
||||
mDigitalWellBeingToast = new DigitalWellBeingToast(mActivity, this);
|
||||
@@ -487,10 +432,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
+ mCurrentFullscreenParams.mCurrentDrawnInsets.bottom);
|
||||
}
|
||||
|
||||
public TaskMenuView getMenuView() {
|
||||
return mMenuView;
|
||||
}
|
||||
|
||||
public DigitalWellBeingToast getDigitalWellBeingToast() {
|
||||
return mDigitalWellBeingToast;
|
||||
}
|
||||
@@ -524,10 +465,52 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
public AnimatorPlaybackController createLaunchAnimationForRunningTask() {
|
||||
return getRecentsView().createTaskLaunchAnimation(
|
||||
this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR)
|
||||
.createPlaybackController();
|
||||
private void onClick(View view) {
|
||||
if (getTask() == null) {
|
||||
return;
|
||||
}
|
||||
if (LIVE_TILE.get() && isRunningTask()) {
|
||||
if (!mIsClickableAsLiveTile) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset the minimized state since we force-toggled the minimized state when entering
|
||||
// overview, but never actually finished the recents animation
|
||||
SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
|
||||
if (p != null) {
|
||||
p.setSplitScreenMinimized(false);
|
||||
}
|
||||
|
||||
mIsClickableAsLiveTile = false;
|
||||
RecentsView recentsView = getRecentsView();
|
||||
RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet();
|
||||
recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(false);
|
||||
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
TaskViewUtils.composeRecentsLaunchAnimator(
|
||||
anim, this, targets.apps,
|
||||
targets.wallpapers, true /* launcherClosing */,
|
||||
mActivity.getStateManager(), recentsView,
|
||||
recentsView.getDepthController());
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(true);
|
||||
recentsView.finishRecentsAnimation(false, null);
|
||||
mIsClickableAsLiveTile = true;
|
||||
}
|
||||
});
|
||||
anim.start();
|
||||
} else {
|
||||
if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
|
||||
// User tapped to select second split screen app
|
||||
getRecentsView().confirmSplitSelect(this);
|
||||
} else {
|
||||
launchTaskAnimated();
|
||||
}
|
||||
}
|
||||
mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
|
||||
.log(LAUNCHER_TASK_LAUNCH_TAP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,15 +645,12 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
|
||||
if (!getRecentsView().isClearAllHidden()) {
|
||||
getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
|
||||
return false;
|
||||
} else {
|
||||
mMenuView = TaskMenuView.showForTask(this);
|
||||
mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
|
||||
.log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS);
|
||||
if (mMenuView != null) {
|
||||
mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener);
|
||||
}
|
||||
return TaskMenuView.showForTask(this);
|
||||
}
|
||||
return mMenuView != null;
|
||||
}
|
||||
|
||||
private void setIcon(Drawable icon) {
|
||||
@@ -729,10 +709,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
mIconView.setRotation(orientationHandler.getDegreesRotated());
|
||||
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
mSnapshotView.setLayoutParams(snapshotParams);
|
||||
|
||||
if (mMenuView != null) {
|
||||
mMenuView.onRotationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void setIconAndDimTransitionProgress(float progress, boolean invert) {
|
||||
@@ -817,27 +793,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
onTaskListVisibilityChanged(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScroll(ScrollState scrollState, boolean gridEnabled) {
|
||||
// Don't do anything if it's modal.
|
||||
if (mModalness > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float dwbBannerAlpha = Utilities.boundToRange(1.0f - 2 * scrollState.linearInterpolation,
|
||||
0f, 1f);
|
||||
mDigitalWellBeingToast.updateBannerAlpha(dwbBannerAlpha);
|
||||
|
||||
if (mMenuView != null) {
|
||||
PagedOrientationHandler pagedOrientationHandler = getPagedOrientationHandler();
|
||||
RecentsView recentsView = getRecentsView();
|
||||
mMenuView.setPosition(getX() - recentsView.getScrollX(),
|
||||
getY() - recentsView.getScrollY(), pagedOrientationHandler);
|
||||
mMenuView.setScaleX(getScaleX());
|
||||
mMenuView.setScaleY(getScaleY());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the contextual chip.
|
||||
*
|
||||
@@ -1337,9 +1292,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
}
|
||||
|
||||
public void initiateSplitSelect(SplitPositionOption splitPositionOption) {
|
||||
RecentsView rv = getRecentsView();
|
||||
getMenuView().close(false);
|
||||
rv.initiateSplitSelect(this, splitPositionOption);
|
||||
AbstractFloatingView.closeOpenViews(mActivity, false, TYPE_TASK_MENU);
|
||||
getRecentsView().initiateSplitSelect(this, splitPositionOption);
|
||||
}
|
||||
|
||||
private void setColorTint(float amount) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<include layout="@layout/floating_header_content" />
|
||||
|
||||
<include layout="@layout/personal_work_tabs" />
|
||||
<include layout="@layout/all_apps_personal_work_tabs" />
|
||||
</com.android.launcher3.allapps.FloatingHeaderView>
|
||||
|
||||
<include
|
||||
|
||||
File renamed without changes.
@@ -62,9 +62,12 @@
|
||||
android:id="@+id/drop_target_bar"
|
||||
layout="@layout/drop_target_bar" />
|
||||
|
||||
<include
|
||||
<com.android.launcher3.views.ScrimView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scrim_view"
|
||||
layout="@layout/scrim_view" />
|
||||
android:background="?attr/allAppsScrimColor"
|
||||
android:alpha="0" />
|
||||
|
||||
<include
|
||||
android:id="@+id/apps_view"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
<com.android.launcher3.views.ScrimView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scrim_view" />
|
||||
@@ -17,16 +17,31 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- The image of the widget. This view does not support padding. Any placement adjustment
|
||||
should be done using margins. Width & height are set at runtime after scaling the preview
|
||||
image. -->
|
||||
<com.android.launcher3.widget.WidgetImageView
|
||||
android:id="@+id/widget_preview"
|
||||
<com.android.launcher3.widget.WidgetCellPreview
|
||||
android:id="@+id/widget_preview_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_marginVertical="8dp" />
|
||||
android:layout_marginVertical="8dp">
|
||||
<!-- The image of the widget. This view does not support padding. Any placement adjustment
|
||||
should be done using margins. Width & height are set at runtime after scaling the
|
||||
preview image. -->
|
||||
<com.android.launcher3.widget.WidgetImageView
|
||||
android:id="@+id/widget_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_gravity="fill"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_badge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/profile_badge_margin"/>
|
||||
</com.android.launcher3.widget.WidgetCellPreview>
|
||||
|
||||
<!-- The name of the widget. -->
|
||||
<TextView
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
</com.android.launcher3.workprofile.PersonalWorkPagedView>
|
||||
|
||||
<include layout="@layout/personal_work_tabs"
|
||||
<include layout="@layout/widgets_personal_work_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
|
||||
<com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/all_apps_header_tab_height"
|
||||
android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
|
||||
android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
|
||||
android:orientation="horizontal"
|
||||
android:elevation="2dp"
|
||||
style="@style/TextHeadline">
|
||||
|
||||
<Button
|
||||
android:id="@+id/tab_personal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/widgets_full_sheet_personal_tab"
|
||||
android:textColor="@color/all_apps_tab_text"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tab_work"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/widgets_full_sheet_work_tab"
|
||||
android:textColor="@color/all_apps_tab_text"
|
||||
android:textSize="14sp" />
|
||||
</com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
|
||||
@@ -162,6 +162,8 @@
|
||||
<!-- landscapeIconSize defaults to iconSize, if not specified -->
|
||||
<attr name="landscapeIconSize" format="float" />
|
||||
<attr name="iconTextSize" format="float" />
|
||||
<!-- landscapeIconTextSize defaults to iconTextSize, if not specified -->
|
||||
<attr name="landscapeIconTextSize" format="float" />
|
||||
<!-- If true, this display option is used to determine the default grid -->
|
||||
<attr name="canBeDefault" format="boolean" />
|
||||
|
||||
|
||||
@@ -90,6 +90,10 @@
|
||||
<!-- Text shown when there are no matching widget search results for user's search query.
|
||||
[CHAR_LIMIT=none] -->
|
||||
<string name="no_search_results">No search results</string>
|
||||
<!-- Tab label. A user can tap this tab to access their personal widgets. [CHAR_LIMIT=25] -->
|
||||
<string name="widgets_full_sheet_personal_tab">Personal</string>
|
||||
<!-- Tab label. A user can tap this tab to access their work widgets. [CHAR_LIMIT=25] -->
|
||||
<string name="widgets_full_sheet_work_tab">Work</string>
|
||||
|
||||
<!-- All Apps -->
|
||||
<!-- Search bar text in the apps view. [CHAR_LIMIT=50] -->
|
||||
|
||||
@@ -506,9 +506,10 @@ public class DeviceProfile {
|
||||
|
||||
// Workspace
|
||||
final boolean isVerticalLayout = isVerticalBarLayout();
|
||||
float invIconSizeDp = isVerticalLayout ? inv.landscapeIconSize : inv.iconSize;
|
||||
float invIconSizeDp = isLandscape ? inv.landscapeIconSize : inv.iconSize;
|
||||
iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mInfo.metrics, scale));
|
||||
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, mInfo.metrics) * scale);
|
||||
float invIconTextSizeSp = isLandscape ? inv.landscapeIconTextSize : inv.iconTextSize;
|
||||
iconTextSizePx = (int) (Utilities.pxFromSp(invIconTextSizeSp, mInfo.metrics) * scale);
|
||||
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
|
||||
|
||||
setCellLayoutBorderSpacing((int) (cellLayoutBorderSpacingOriginalPx * scale));
|
||||
|
||||
@@ -106,6 +106,7 @@ public class InvariantDeviceProfile {
|
||||
public float iconSize;
|
||||
public String iconShapePath;
|
||||
public float landscapeIconSize;
|
||||
public float landscapeIconTextSize;
|
||||
public int iconBitmapSize;
|
||||
public int fillResIconDpi;
|
||||
public float iconTextSize;
|
||||
@@ -163,6 +164,7 @@ public class InvariantDeviceProfile {
|
||||
landscapeIconSize = p.landscapeIconSize;
|
||||
iconBitmapSize = p.iconBitmapSize;
|
||||
iconTextSize = p.iconTextSize;
|
||||
landscapeIconTextSize = p.landscapeIconTextSize;
|
||||
numHotseatIcons = p.numHotseatIcons;
|
||||
numAllAppsColumns = p.numAllAppsColumns;
|
||||
isScalable = p.isScalable;
|
||||
@@ -293,6 +295,7 @@ public class InvariantDeviceProfile {
|
||||
landscapeIconSize = displayOption.landscapeIconSize;
|
||||
iconBitmapSize = ResourceUtils.pxFromDp(iconSize, displayInfo.metrics);
|
||||
iconTextSize = displayOption.iconTextSize;
|
||||
landscapeIconTextSize = displayOption.landscapeIconTextSize;
|
||||
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
|
||||
|
||||
minCellHeight = displayOption.minCellHeight;
|
||||
@@ -678,6 +681,7 @@ public class InvariantDeviceProfile {
|
||||
private float iconSize;
|
||||
private float iconTextSize;
|
||||
private float landscapeIconSize;
|
||||
private float landscapeIconTextSize;
|
||||
private float allAppsIconSize;
|
||||
private float allAppsIconTextSize;
|
||||
|
||||
@@ -702,6 +706,8 @@ public class InvariantDeviceProfile {
|
||||
landscapeIconSize = a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconSize,
|
||||
iconSize);
|
||||
iconTextSize = a.getFloat(R.styleable.ProfileDisplayOption_iconTextSize, 0);
|
||||
landscapeIconTextSize = a.getFloat(
|
||||
R.styleable.ProfileDisplayOption_landscapeIconTextSize, iconTextSize);
|
||||
|
||||
allAppsIconSize = a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconSize,
|
||||
iconSize);
|
||||
@@ -731,6 +737,7 @@ public class InvariantDeviceProfile {
|
||||
landscapeIconSize *= w;
|
||||
allAppsIconSize *= w;
|
||||
iconTextSize *= w;
|
||||
landscapeIconTextSize *= w;
|
||||
allAppsIconTextSize *= w;
|
||||
minCellHeight *= w;
|
||||
minCellWidth *= w;
|
||||
@@ -744,6 +751,7 @@ public class InvariantDeviceProfile {
|
||||
landscapeIconSize += p.landscapeIconSize;
|
||||
allAppsIconSize += p.allAppsIconSize;
|
||||
iconTextSize += p.iconTextSize;
|
||||
landscapeIconTextSize += p.landscapeIconTextSize;
|
||||
allAppsIconTextSize += p.allAppsIconTextSize;
|
||||
minCellHeight += p.minCellHeight;
|
||||
minCellWidth += p.minCellWidth;
|
||||
|
||||
@@ -1191,8 +1191,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
|
||||
// Setup the drag controller (drop targets have to be added in reverse order in priority)
|
||||
mDropTargetBar.setup(mDragController);
|
||||
|
||||
mAllAppsController.setupViews(mAppsView, mScrimView);
|
||||
mAllAppsController.setupViews(mAppsView);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -209,11 +209,11 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
public float getWorkspaceBackgroundAlpha(Launcher launcher) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getOverviewScrimAlpha(Launcher launcher) {
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCA
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
@@ -150,7 +151,7 @@ public class WorkspaceStateTransitionAnimation {
|
||||
propertySetter.setFloat(mWorkspace.getPageIndicator(), VIEW_TRANSLATE_Y,
|
||||
hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
|
||||
|
||||
setScrim(propertySetter, state);
|
||||
setScrim(propertySetter, state, config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,14 +166,19 @@ public class WorkspaceStateTransitionAnimation {
|
||||
- sibling.getLeft() - sibling.getTranslationX());
|
||||
}
|
||||
|
||||
public void setScrim(PropertySetter propertySetter, LauncherState state) {
|
||||
public void setScrim(PropertySetter propertySetter, LauncherState state,
|
||||
StateAnimationConfig config) {
|
||||
WorkspaceDragScrim workspaceDragScrim = mLauncher.getDragLayer().getWorkspaceDragScrim();
|
||||
propertySetter.setFloat(workspaceDragScrim, SCRIM_PROGRESS,
|
||||
state.getWorkspaceScrimAlpha(mLauncher), LINEAR);
|
||||
state.getWorkspaceBackgroundAlpha(mLauncher), LINEAR);
|
||||
|
||||
SysUiScrim sysUiScrim = mLauncher.getDragLayer().getSysUiScrim();
|
||||
propertySetter.setFloat(sysUiScrim, SYSUI_PROGRESS,
|
||||
state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
|
||||
|
||||
propertySetter.setViewAlpha(mLauncher.getScrimView(),
|
||||
state.getWorkspaceScrimAlpha(mLauncher),
|
||||
config.getInterpolator(ANIM_WORKSPACE_SCRIM_FADE, LINEAR));
|
||||
}
|
||||
|
||||
public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.views.ScrimView;
|
||||
|
||||
/**
|
||||
* Handles AllApps view transition.
|
||||
@@ -72,10 +71,7 @@ public class AllAppsTransitionController
|
||||
}
|
||||
};
|
||||
|
||||
private static final int APPS_VIEW_ALPHA_CHANNEL_INDEX = 0;
|
||||
|
||||
private AllAppsContainerView mAppsView;
|
||||
private ScrimView mScrimView;
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private boolean mIsVerticalLayout;
|
||||
@@ -125,8 +121,6 @@ public class AllAppsTransitionController
|
||||
*/
|
||||
public void setProgress(float progress) {
|
||||
mProgress = progress;
|
||||
|
||||
mScrimView.setProgress(progress);
|
||||
mAppsView.setTranslationY(mProgress * mShiftRange);
|
||||
}
|
||||
|
||||
@@ -191,9 +185,8 @@ public class AllAppsTransitionController
|
||||
return AnimationSuccessListener.forRunnable(this::onProgressAnimationEnd);
|
||||
}
|
||||
|
||||
public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
|
||||
public void setupViews(AllAppsContainerView appsView) {
|
||||
mAppsView = appsView;
|
||||
mScrimView = scrimView;
|
||||
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && Utilities.ATLEAST_R) {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
@@ -207,10 +200,6 @@ public class AllAppsTransitionController
|
||||
void setScrollRangeDelta(float delta) {
|
||||
mScrollRangeDelta = delta;
|
||||
mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta;
|
||||
|
||||
if (mScrimView != null) {
|
||||
mScrimView.reInitUi();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,12 +17,8 @@ package com.android.launcher3.dragndrop;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||
@@ -36,38 +32,15 @@ public final class AppWidgetHostViewDrawable extends Drawable {
|
||||
|
||||
private final LauncherAppWidgetHostView mAppWidgetHostView;
|
||||
private Paint mPaint = new Paint();
|
||||
private final Path mClipPath;
|
||||
private final boolean mWasAttached;
|
||||
|
||||
public AppWidgetHostViewDrawable(LauncherAppWidgetHostView appWidgetHostView) {
|
||||
mAppWidgetHostView = appWidgetHostView;
|
||||
mWasAttached = appWidgetHostView.isAttachedToWindow();
|
||||
Path clipPath = null;
|
||||
if (appWidgetHostView.getClipToOutline()) {
|
||||
Outline outline = new Outline();
|
||||
mAppWidgetHostView.getOutlineProvider().getOutline(mAppWidgetHostView, outline);
|
||||
Rect rect = new Rect();
|
||||
if (outline.getRect(rect)) {
|
||||
float radius = outline.getRadius();
|
||||
clipPath = new Path();
|
||||
clipPath.addRoundRect(new RectF(rect), radius, radius, Path.Direction.CCW);
|
||||
}
|
||||
}
|
||||
mClipPath = clipPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
int saveCount = canvas.saveLayer(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), mPaint);
|
||||
if (mClipPath != null) {
|
||||
canvas.clipPath(mClipPath);
|
||||
}
|
||||
// If the view was never attached, or is current attached, then draw. Otherwise do not try
|
||||
// to draw, or we might trigger bugs with items that get drawn while requiring the view to
|
||||
// be attached.
|
||||
if (!mWasAttached || mAppWidgetHostView.isAttachedToWindow()) {
|
||||
mAppWidgetHostView.draw(canvas);
|
||||
}
|
||||
mAppWidgetHostView.draw(canvas);
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.OverviewScrim;
|
||||
import com.android.launcher3.graphics.SysUiScrim;
|
||||
import com.android.launcher3.graphics.WorkspaceDragScrim;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
@@ -84,7 +83,6 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
|
||||
// Related to adjacent page hints
|
||||
private final ViewGroupFocusHelper mFocusIndicatorHelper;
|
||||
private final OverviewScrim mOverviewScrim;
|
||||
private WorkspaceDragScrim mWorkspaceDragScrim;
|
||||
private SysUiScrim mSysUiScrim;
|
||||
private LauncherRootView mRootView;
|
||||
@@ -103,15 +101,12 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
setChildrenDrawingOrderEnabled(true);
|
||||
|
||||
mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
|
||||
mOverviewScrim = new OverviewScrim(this);
|
||||
}
|
||||
|
||||
public void setup(DragController dragController, Workspace workspace) {
|
||||
mDragController = dragController;
|
||||
recreateControllers();
|
||||
|
||||
mOverviewScrim.setup();
|
||||
|
||||
mWorkspaceDragScrim = new WorkspaceDragScrim((this));
|
||||
mWorkspaceDragScrim.setWorkspace(workspace);
|
||||
|
||||
@@ -529,20 +524,8 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
// Draw the background below children.
|
||||
mWorkspaceDragScrim.draw(canvas);
|
||||
mOverviewScrim.updateCurrentScrimmedView(this);
|
||||
mFocusIndicatorHelper.draw(canvas);
|
||||
super.dispatchDraw(canvas);
|
||||
if (mOverviewScrim.getScrimmedView() == null) {
|
||||
mOverviewScrim.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
||||
if (child == mOverviewScrim.getScrimmedView()) {
|
||||
mOverviewScrim.draw(canvas);
|
||||
}
|
||||
return super.drawChild(canvas, child, drawingTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -564,8 +547,4 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
public SysUiScrim getSysUiScrim() {
|
||||
return mSysUiScrim;
|
||||
}
|
||||
|
||||
public OverviewScrim getOverviewScrim() {
|
||||
return mOverviewScrim;
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.graphics;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.uioverrides.WallpaperColorInfo;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
/**
|
||||
* View scrim which draws behind overview (recent apps).
|
||||
*/
|
||||
public class OverviewScrim extends Scrim {
|
||||
|
||||
public static final FloatProperty<OverviewScrim> SCRIM_MULTIPLIER =
|
||||
new FloatProperty<OverviewScrim>("scrimMultiplier") {
|
||||
@Override
|
||||
public Float get(OverviewScrim scrim) {
|
||||
return scrim.mScrimMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(OverviewScrim scrim, float v) {
|
||||
scrim.setScrimMultiplier(v);
|
||||
}
|
||||
};
|
||||
|
||||
private @NonNull View mStableScrimmedView;
|
||||
// Might be higher up if mStableScrimmedView is invisible.
|
||||
private @Nullable View mCurrentScrimmedView;
|
||||
|
||||
private float mScrimMultiplier = 1f;
|
||||
|
||||
public OverviewScrim(View view) {
|
||||
super(view);
|
||||
|
||||
mScrimColor = Themes.getAttrColor(view.getContext(), R.attr.allAppsScrimColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes once view hierarchy is established.
|
||||
*/
|
||||
public void setup() {
|
||||
mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view The view we want the scrim to be behind
|
||||
*/
|
||||
public void updateStableScrimmedView(View view) {
|
||||
mStableScrimmedView = view;
|
||||
}
|
||||
|
||||
public void updateCurrentScrimmedView(ViewGroup root) {
|
||||
// Find the lowest view that is at or above the view we want to show the scrim behind.
|
||||
mCurrentScrimmedView = mStableScrimmedView;
|
||||
int currentIndex = root.indexOfChild(mCurrentScrimmedView);
|
||||
final int childCount = root.getChildCount();
|
||||
while (mCurrentScrimmedView != null && mCurrentScrimmedView.getVisibility() != VISIBLE
|
||||
&& currentIndex < childCount) {
|
||||
currentIndex++;
|
||||
mCurrentScrimmedView = root.getChildAt(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) {
|
||||
// No super, don't respond to wallpaper colors, follow device ones instead
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The view to draw the scrim behind, or null if all visible views should be scrimmed.
|
||||
*/
|
||||
public @Nullable View getScrimmedView() {
|
||||
return mCurrentScrimmedView;
|
||||
}
|
||||
|
||||
private void setScrimMultiplier(float scrimMultiplier) {
|
||||
if (Float.compare(mScrimMultiplier, scrimMultiplier) != 0) {
|
||||
mScrimMultiplier = scrimMultiplier;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrimAlpha() {
|
||||
return Math.round(super.getScrimAlpha() * mScrimMultiplier);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class HintState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOverviewScrimAlpha(Launcher launcher) {
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SpringLoadedState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
public float getWorkspaceBackgroundAlpha(Launcher launcher) {
|
||||
return 0.3f;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StateAnimationConfig {
|
||||
ANIM_OVERVIEW_TRANSLATE_Y,
|
||||
ANIM_OVERVIEW_FADE,
|
||||
ANIM_ALL_APPS_FADE,
|
||||
ANIM_OVERVIEW_SCRIM_FADE,
|
||||
ANIM_WORKSPACE_SCRIM_FADE,
|
||||
ANIM_ALL_APPS_HEADER_FADE,
|
||||
ANIM_OVERVIEW_MODAL,
|
||||
ANIM_DEPTH,
|
||||
@@ -75,7 +75,7 @@ public class StateAnimationConfig {
|
||||
public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8;
|
||||
public static final int ANIM_OVERVIEW_FADE = 9;
|
||||
public static final int ANIM_ALL_APPS_FADE = 10;
|
||||
public static final int ANIM_OVERVIEW_SCRIM_FADE = 11;
|
||||
public static final int ANIM_WORKSPACE_SCRIM_FADE = 11;
|
||||
public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
|
||||
public static final int ANIM_OVERVIEW_MODAL = 13;
|
||||
public static final int ANIM_DEPTH = 14;
|
||||
|
||||
@@ -74,14 +74,6 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
scroller.startScroll(scroller.getCurrPos(), newPosition - scroller.getCurrPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
|
||||
out.scroll = view.getScrollY();
|
||||
out.halfPageSize = view.getNormalChildHeight() / 2;
|
||||
out.halfScreenSize = view.getMeasuredHeight() / 2;
|
||||
out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLayoutNaturalToLauncher() {
|
||||
return false;
|
||||
|
||||
@@ -93,7 +93,6 @@ public interface PagedOrientationHandler {
|
||||
void delegateScrollTo(PagedView pagedView, int primaryScroll);
|
||||
void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y);
|
||||
void scrollerStartScroll(OverScroller scroller, int newPosition);
|
||||
void getCurveProperties(PagedView view, Rect insets, CurveProperties out);
|
||||
boolean isLayoutNaturalToLauncher();
|
||||
float getTaskMenuX(float x, View thumbnailView);
|
||||
float getTaskMenuY(float y, View thumbnailView);
|
||||
@@ -121,13 +120,6 @@ public interface PagedOrientationHandler {
|
||||
*/
|
||||
void adjustFloatingIconStartVelocity(PointF velocity);
|
||||
|
||||
class CurveProperties {
|
||||
public int scroll;
|
||||
public int halfPageSize;
|
||||
public int screenCenter;
|
||||
public int halfScreenSize;
|
||||
}
|
||||
|
||||
class ChildBounds {
|
||||
|
||||
public final int primaryDimension;
|
||||
|
||||
@@ -22,7 +22,6 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.VERTICAL;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PointF;
|
||||
@@ -73,14 +72,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
scroller.startScroll(newPosition - scroller.getCurrPos(), scroller.getCurrPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
|
||||
out.scroll = view.getScrollX();
|
||||
out.halfPageSize = view.getNormalChildWidth() / 2;
|
||||
out.halfScreenSize = view.getMeasuredWidth() / 2;
|
||||
out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLayoutNaturalToLauncher() {
|
||||
return true;
|
||||
|
||||
@@ -15,14 +15,9 @@
|
||||
*/
|
||||
package com.android.launcher3.views;
|
||||
|
||||
import static androidx.core.graphics.ColorUtils.compositeColors;
|
||||
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
@@ -32,104 +27,61 @@ import androidx.core.graphics.ColorUtils;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.uioverrides.WallpaperColorInfo;
|
||||
import com.android.launcher3.uioverrides.WallpaperColorInfo.OnChangeListener;
|
||||
import com.android.launcher3.util.SystemUiController;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
/**
|
||||
* Simple scrim which draws a flat color
|
||||
*/
|
||||
public class ScrimView<T extends Launcher> extends View implements Insettable, OnChangeListener {
|
||||
private static final float STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD = .1f;
|
||||
public class ScrimView extends View implements Insettable {
|
||||
private static final float STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.9f;
|
||||
|
||||
protected final T mLauncher;
|
||||
private final WallpaperColorInfo mWallpaperColorInfo;
|
||||
protected final int mEndScrim;
|
||||
protected final boolean mIsScrimDark;
|
||||
|
||||
protected float mMaxScrimAlpha;
|
||||
|
||||
protected float mProgress = 1;
|
||||
protected int mScrimColor;
|
||||
|
||||
protected int mCurrentFlatColor;
|
||||
protected int mEndFlatColor;
|
||||
protected int mEndFlatColorAlpha;
|
||||
private final boolean mIsScrimDark;
|
||||
private SystemUiController mSystemUiController;
|
||||
|
||||
public ScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mLauncher = Launcher.cast(Launcher.getLauncher(context));
|
||||
mWallpaperColorInfo = WallpaperColorInfo.INSTANCE.get(context);
|
||||
mEndScrim = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
mIsScrimDark = ColorUtils.calculateLuminance(mEndScrim) < 0.5f;
|
||||
|
||||
mMaxScrimAlpha = 0.7f;
|
||||
mIsScrimDark = ColorUtils.calculateLuminance(
|
||||
Themes.getAttrColor(context, R.attr.allAppsScrimColor)) < 0.5f;
|
||||
setFocusable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInsets(Rect insets) { }
|
||||
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mWallpaperColorInfo.addOnChangeListener(this);
|
||||
onExtractedColorsChanged(mWallpaperColorInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
mWallpaperColorInfo.removeOnChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) {
|
||||
mScrimColor = wallpaperColorInfo.getMainColor();
|
||||
mEndFlatColor = compositeColors(mEndScrim, setColorAlphaBound(
|
||||
mScrimColor, Math.round(mMaxScrimAlpha * 255)));
|
||||
mEndFlatColorAlpha = Color.alpha(mEndFlatColor);
|
||||
updateColors();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
if (mProgress != progress) {
|
||||
mProgress = progress;
|
||||
updateColors();
|
||||
updateSysUiColors();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void reInitUi() { }
|
||||
|
||||
protected void updateColors() {
|
||||
mCurrentFlatColor = mProgress >= 1 ? 0 : setColorAlphaBound(
|
||||
mEndFlatColor, Math.round((1 - mProgress) * mEndFlatColorAlpha));
|
||||
}
|
||||
|
||||
protected void updateSysUiColors() {
|
||||
// Use a light system UI (dark icons) if all apps is behind at least half of the
|
||||
// status bar.
|
||||
boolean forceChange = mProgress <= STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD;
|
||||
if (forceChange) {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
|
||||
} else {
|
||||
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
|
||||
}
|
||||
protected boolean onSetAlpha(int alpha) {
|
||||
updateSysUiColors();
|
||||
return super.onSetAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mCurrentFlatColor != 0) {
|
||||
canvas.drawColor(mCurrentFlatColor);
|
||||
protected void onVisibilityChanged(View changedView, int visibility) {
|
||||
super.onVisibilityChanged(changedView, visibility);
|
||||
updateSysUiColors();
|
||||
}
|
||||
|
||||
private void updateSysUiColors() {
|
||||
// Use a light system UI (dark icons) if all apps is behind at least half of the
|
||||
// status bar.
|
||||
boolean forceChange =
|
||||
getVisibility() == VISIBLE && getAlpha() > STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD;
|
||||
if (forceChange) {
|
||||
getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
|
||||
} else {
|
||||
getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private SystemUiController getSystemUiController() {
|
||||
if (mSystemUiController == null) {
|
||||
mSystemUiController = Launcher.getLauncher(getContext()).getSystemUiController();
|
||||
}
|
||||
return mSystemUiController;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -108,7 +109,7 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView
|
||||
|
||||
// If the ImageView doesn't have a drawable yet, the widget preview hasn't been loaded and
|
||||
// we abort the drag.
|
||||
if (image.getDrawable() == null) {
|
||||
if (image.getDrawable() == null && v.getAppWidgetHostViewPreview() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,11 +117,21 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView
|
||||
dragHelper.setRemoteViewsPreview(v.getPreview());
|
||||
dragHelper.setAppWidgetHostViewPreview(v.getAppWidgetHostViewPreview());
|
||||
|
||||
int[] loc = new int[2];
|
||||
getPopupContainer().getLocationInDragLayer(image, loc);
|
||||
if (image.getDrawable() != null) {
|
||||
int[] loc = new int[2];
|
||||
getPopupContainer().getLocationInDragLayer(image, loc);
|
||||
|
||||
dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(),
|
||||
image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
|
||||
dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(),
|
||||
image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
|
||||
} else {
|
||||
View preview = v.getAppWidgetHostViewPreview();
|
||||
int[] loc = new int[2];
|
||||
getPopupContainer().getLocationInDragLayer(preview, loc);
|
||||
|
||||
Rect r = new Rect(0, 0, preview.getWidth(), preview.getHeight());
|
||||
dragHelper.startDrag(r, preview.getMeasuredWidth(), preview.getMeasuredWidth(),
|
||||
new Point(loc[0], loc[1]), this, new DragOptions());
|
||||
}
|
||||
close(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ public class PendingItemDragHelper extends DragPreviewProvider {
|
||||
}
|
||||
if (mAppWidgetHostViewPreview != null) {
|
||||
preview = new AppWidgetHostViewDrawable(mAppWidgetHostViewPreview);
|
||||
previewSizeBeforeScale[0] = mAppWidgetHostViewPreview.getMeasuredWidth();
|
||||
launcher.getDragController()
|
||||
.addDragListener(new AppWidgetHostViewDragListener(launcher));
|
||||
}
|
||||
|
||||
@@ -28,9 +28,11 @@ import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnLayoutChangeListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RemoteViews;
|
||||
import android.widget.TextView;
|
||||
@@ -42,7 +44,6 @@ import com.android.launcher3.CheckLongPressHelper;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.WidgetPreviewLoader;
|
||||
import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable;
|
||||
import com.android.launcher3.icons.BaseIconFactory;
|
||||
import com.android.launcher3.icons.BitmapRenderer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
@@ -77,7 +78,9 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
private int mCellSize;
|
||||
private float mPreviewScale = 1f;
|
||||
|
||||
private FrameLayout mWidgetImageContainer;
|
||||
private WidgetImageView mWidgetImage;
|
||||
private ImageView mWidgetBadge;
|
||||
private TextView mWidgetName;
|
||||
private TextView mWidgetDims;
|
||||
private TextView mWidgetDescription;
|
||||
@@ -133,7 +136,9 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mWidgetImageContainer = findViewById(R.id.widget_preview_container);
|
||||
mWidgetImage = findViewById(R.id.widget_preview);
|
||||
mWidgetBadge = findViewById(R.id.widget_badge);
|
||||
mWidgetName = findViewById(R.id.widget_name);
|
||||
mWidgetDims = findViewById(R.id.widget_dims);
|
||||
mWidgetDescription = findViewById(R.id.widget_description);
|
||||
@@ -155,7 +160,9 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
Log.d(TAG, "reset called on:" + mWidgetName.getText());
|
||||
}
|
||||
mWidgetImage.animate().cancel();
|
||||
mWidgetImage.setDrawable(null, null);
|
||||
mWidgetImage.setDrawable(null);
|
||||
mWidgetImage.setVisibility(View.VISIBLE);
|
||||
mWidgetBadge.setImageDrawable(null);
|
||||
mWidgetName.setText(null);
|
||||
mWidgetDims.setText(null);
|
||||
mWidgetDescription.setText(null);
|
||||
@@ -167,6 +174,9 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
mActiveRequest = null;
|
||||
}
|
||||
mPreview = null;
|
||||
if (mAppWidgetHostViewPreview != null) {
|
||||
mWidgetImageContainer.removeView(mAppWidgetHostViewPreview);
|
||||
}
|
||||
mAppWidgetHostViewPreview = null;
|
||||
}
|
||||
|
||||
@@ -215,6 +225,13 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
mAppWidgetHostViewPreview.setPadding(/* left= */ 0, /* top= */0, /* right= */
|
||||
0, /* bottom= */ 0);
|
||||
mAppWidgetHostViewPreview.updateAppWidget(/* remoteViews= */ null);
|
||||
// Gravity 77 = "fill"
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, /* gravity= */ 77);
|
||||
mAppWidgetHostViewPreview.setLayoutParams(params);
|
||||
mWidgetImageContainer.addView(mAppWidgetHostViewPreview, /* index= */ 0);
|
||||
mWidgetImage.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,21 +275,36 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
return;
|
||||
}
|
||||
if (drawable != null) {
|
||||
LayoutParams layoutParams = (LayoutParams) mWidgetImage.getLayoutParams();
|
||||
layoutParams.width = (int) (drawable.getIntrinsicWidth() * mPreviewScale);
|
||||
layoutParams.height = (int) (drawable.getIntrinsicHeight() * mPreviewScale);
|
||||
mWidgetImage.setLayoutParams(layoutParams);
|
||||
|
||||
mWidgetImage.setDrawable(drawable, mWidgetPreviewLoader.getBadgeForUser(mItem.user,
|
||||
BaseIconFactory.getBadgeSizeForIconSize(mDeviceProfile.allAppsIconSizePx)));
|
||||
if (mAnimatePreview) {
|
||||
mWidgetImage.setAlpha(0f);
|
||||
ViewPropertyAnimator anim = mWidgetImage.animate();
|
||||
anim.alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
|
||||
} else {
|
||||
mWidgetImage.setAlpha(1f);
|
||||
setContainerSize(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
mWidgetImage.setDrawable(drawable);
|
||||
mWidgetImage.setVisibility(View.VISIBLE);
|
||||
if (mAppWidgetHostViewPreview != null) {
|
||||
removeView(mAppWidgetHostViewPreview);
|
||||
mAppWidgetHostViewPreview = null;
|
||||
}
|
||||
}
|
||||
Drawable badge = mWidgetPreviewLoader.getBadgeForUser(mItem.user,
|
||||
BaseIconFactory.getBadgeSizeForIconSize(mDeviceProfile.allAppsIconSizePx));
|
||||
if (badge == null) {
|
||||
mWidgetBadge.setVisibility(View.GONE);
|
||||
} else {
|
||||
mWidgetBadge.setVisibility(View.VISIBLE);
|
||||
mWidgetBadge.setImageDrawable(badge);
|
||||
}
|
||||
if (mAnimatePreview) {
|
||||
mWidgetImageContainer.setAlpha(0f);
|
||||
ViewPropertyAnimator anim = mWidgetImageContainer.animate();
|
||||
anim.alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
|
||||
} else {
|
||||
mWidgetImageContainer.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
|
||||
private void setContainerSize(int width, int height) {
|
||||
LayoutParams layoutParams = (LayoutParams) mWidgetImageContainer.getLayoutParams();
|
||||
layoutParams.width = (int) (width * mPreviewScale);
|
||||
layoutParams.height = (int) (height * mPreviewScale);
|
||||
mWidgetImageContainer.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
public void ensurePreview() {
|
||||
@@ -290,15 +322,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
int viewWidth = dp.cellWidthPx * mItem.spanX;
|
||||
int viewHeight = dp.cellHeightPx * mItem.spanY;
|
||||
|
||||
mAppWidgetHostViewPreview.measure(
|
||||
MeasureSpec.makeMeasureSpec(viewWidth, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(viewHeight, MeasureSpec.EXACTLY));
|
||||
|
||||
viewWidth = mAppWidgetHostViewPreview.getMeasuredWidth();
|
||||
viewHeight = mAppWidgetHostViewPreview.getMeasuredHeight();
|
||||
mAppWidgetHostViewPreview.layout(0, 0, viewWidth, viewHeight);
|
||||
Drawable drawable = new AppWidgetHostViewDrawable(mAppWidgetHostViewPreview);
|
||||
applyPreview(drawable);
|
||||
setContainerSize(viewWidth, viewHeight);
|
||||
applyPreview((Drawable) null);
|
||||
return;
|
||||
}
|
||||
if (mActiveRequest != null) {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/**
|
||||
* View group managing the widget preview: either using a {@link WidgetImageView} or an actual
|
||||
* {@link LauncherAppWidgetHostView}.
|
||||
*/
|
||||
public class WidgetCellPreview extends FrameLayout {
|
||||
public WidgetCellPreview(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public WidgetCellPreview(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public WidgetCellPreview(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
super.onInterceptTouchEvent(ev);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
/**
|
||||
* View that draws a bitmap horizontally centered. If the image width is greater than the view
|
||||
@@ -37,7 +36,6 @@ public class WidgetImageView extends View {
|
||||
private final int mBadgeMargin;
|
||||
|
||||
private Drawable mDrawable;
|
||||
private Drawable mBadge;
|
||||
|
||||
public WidgetImageView(Context context) {
|
||||
this(context, null);
|
||||
@@ -54,9 +52,9 @@ public class WidgetImageView extends View {
|
||||
.getDimensionPixelSize(R.dimen.profile_badge_margin);
|
||||
}
|
||||
|
||||
public void setDrawable(Drawable drawable, Drawable badge) {
|
||||
/** Set the drawable to use for this view. */
|
||||
public void setDrawable(Drawable drawable) {
|
||||
mDrawable = drawable;
|
||||
mBadge = badge;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@@ -70,11 +68,6 @@ public class WidgetImageView extends View {
|
||||
updateDstRectF();
|
||||
mDrawable.setBounds(getBitmapBounds());
|
||||
mDrawable.draw(canvas);
|
||||
|
||||
// Only draw the badge if a preview was drawn.
|
||||
if (mBadge != null) {
|
||||
mBadge.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,17 +98,6 @@ public class WidgetImageView extends View {
|
||||
mDstRectF.top = (myHeight - scaledHeight) / 2;
|
||||
mDstRectF.bottom = (myHeight + scaledHeight) / 2;
|
||||
}
|
||||
|
||||
if (mBadge != null) {
|
||||
Rect bounds = mBadge.getBounds();
|
||||
int left = Utilities.boundToRange(
|
||||
(int) (mDstRectF.right + mBadgeMargin - bounds.width()),
|
||||
mBadgeMargin, getWidth() - bounds.width());
|
||||
int top = Utilities.boundToRange(
|
||||
(int) (mDstRectF.bottom + mBadgeMargin - bounds.height()),
|
||||
mBadgeMargin, getHeight() - bounds.height());
|
||||
mBadge.setBounds(left, top, bounds.width() + left, bounds.height() + top);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.android.launcher3.WidgetPreviewLoader;
|
||||
import com.android.launcher3.model.WidgetItem;
|
||||
import com.android.launcher3.recyclerview.ViewHolderBinder;
|
||||
import com.android.launcher3.widget.WidgetCell;
|
||||
import com.android.launcher3.widget.WidgetImageView;
|
||||
import com.android.launcher3.widget.model.WidgetsListContentEntry;
|
||||
import com.android.launcher3.widget.util.WidgetsTableUtils;
|
||||
|
||||
@@ -170,7 +169,7 @@ public final class WidgetsListTableViewHolderBinder
|
||||
WidgetCell widget = (WidgetCell) mLayoutInflater.inflate(
|
||||
R.layout.widget_cell, tableRow, false);
|
||||
// set up touch.
|
||||
WidgetImageView preview = widget.findViewById(R.id.widget_preview);
|
||||
View preview = widget.findViewById(R.id.widget_preview_container);
|
||||
preview.setOnClickListener(mIconClickListener);
|
||||
preview.setOnLongClickListener(mIconLongClickListener);
|
||||
tableRow.addView(widget);
|
||||
|
||||
@@ -74,4 +74,9 @@ public class AllAppsState extends LauncherState {
|
||||
public float getVerticalProgress(Launcher launcher) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWorkspaceScrimAlpha(Launcher launcher) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user