Snap for 7314842 from a7fc3ee4c7 to sc-v2-release
Change-Id: Ic2ac01faffdf19b092e2d61e8648e39b6e23d486
This commit is contained in:
@@ -27,12 +27,11 @@ import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SY
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.IBinder;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -41,7 +40,6 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.model.WellbeingModel;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.proxy.ProxyActivityStarter;
|
||||
import com.android.launcher3.proxy.StartActivityParams;
|
||||
@@ -73,7 +71,6 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -240,8 +237,9 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(DisplayController.Info info, int flags) {
|
||||
super.onDisplayInfoChanged(info, flags);
|
||||
public void onDisplayInfoChanged(Context context, DisplayController.Info info,
|
||||
int flags) {
|
||||
super.onDisplayInfoChanged(context, info, flags);
|
||||
if ((flags & CHANGE_SIZE) != 0) {
|
||||
addTaskbarIfNecessary();
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private static final String TAG = "QuickstepTransition";
|
||||
|
||||
private static final boolean ENABLE_SHELL_STARTING_SURFACE =
|
||||
SystemProperties.getBoolean("persist.debug.shell_starting_surface", false);
|
||||
SystemProperties.getBoolean("persist.debug.shell_starting_surface", true);
|
||||
|
||||
/** Duration of status bar animations. */
|
||||
public static final int STATUS_BAR_TRANSITION_DURATION = 120;
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.graphics.IconShape.getShape;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
@@ -37,6 +36,7 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.graphics.IconPalette;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
@@ -58,9 +58,13 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
private final DeviceProfile mDeviceProfile;
|
||||
private final Paint mIconRingPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path mRingPath = new Path();
|
||||
private boolean mIsPinned = false;
|
||||
private final int mNormalizedIconRadius;
|
||||
private final int mNormalizedIconSize;
|
||||
private final Path mShapePath;
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
|
||||
private final BlurMaskFilter mShadowFilter;
|
||||
|
||||
private boolean mIsPinned = false;
|
||||
private int mPlateColor;
|
||||
boolean mDrawForDrag = false;
|
||||
|
||||
@@ -75,24 +79,18 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
public PredictedAppIcon(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mDeviceProfile = ActivityContext.lookupContext(context).getDeviceProfile();
|
||||
mNormalizedIconRadius = IconNormalizer.getNormalizedCircleSize(getIconSize()) / 2;
|
||||
mNormalizedIconSize = IconNormalizer.getNormalizedCircleSize(getIconSize());
|
||||
int shadowSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.blur_size_thin_outline);
|
||||
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
|
||||
mShapePath = GraphicsUtils.getShapePath(mNormalizedIconSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
int count = canvas.save();
|
||||
if (!mIsPinned) {
|
||||
boolean isBadged = false;
|
||||
if (getTag() instanceof WorkspaceItemInfo) {
|
||||
WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
|
||||
isBadged = !Process.myUserHandle().equals(info.user)
|
||||
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
|
||||
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
}
|
||||
drawEffect(canvas, isBadged);
|
||||
drawEffect(canvas);
|
||||
canvas.translate(getWidth() * RING_EFFECT_RATIO, getHeight() * RING_EFFECT_RATIO);
|
||||
canvas.scale(1 - 2 * RING_EFFECT_RATIO, 1 - 2 * RING_EFFECT_RATIO);
|
||||
}
|
||||
@@ -161,33 +159,58 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
}
|
||||
|
||||
private int getOutlineOffsetX() {
|
||||
return (getMeasuredWidth() / 2) - mNormalizedIconRadius;
|
||||
return (getMeasuredWidth() - mNormalizedIconSize) / 2;
|
||||
}
|
||||
|
||||
private int getOutlineOffsetY() {
|
||||
if (mDisplay != DISPLAY_TASKBAR) {
|
||||
return getPaddingTop() + mDeviceProfile.folderIconOffsetYPx;
|
||||
}
|
||||
return (getMeasuredHeight() / 2) - mNormalizedIconRadius;
|
||||
return (getMeasuredHeight() - mNormalizedIconSize) / 2;
|
||||
}
|
||||
|
||||
private void drawEffect(Canvas canvas, boolean isBadged) {
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
updateRingPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTag(Object tag) {
|
||||
super.setTag(tag);
|
||||
updateRingPath();
|
||||
}
|
||||
|
||||
private void updateRingPath() {
|
||||
boolean isBadged = false;
|
||||
if (getTag() instanceof WorkspaceItemInfo) {
|
||||
WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
|
||||
isBadged = !Process.myUserHandle().equals(info.user)
|
||||
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
|
||||
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
}
|
||||
|
||||
mRingPath.reset();
|
||||
mTmpMatrix.setTranslate(getOutlineOffsetX(), getOutlineOffsetY());
|
||||
|
||||
mRingPath.addPath(mShapePath, mTmpMatrix);
|
||||
if (isBadged) {
|
||||
float outlineSize = mNormalizedIconSize * RING_EFFECT_RATIO;
|
||||
float iconSize = getIconSize() * (1 - 2 * RING_EFFECT_RATIO);
|
||||
float badgeSize = LauncherIcons.getBadgeSizeForIconSize((int) iconSize) + outlineSize;
|
||||
float scale = badgeSize / mNormalizedIconSize;
|
||||
mTmpMatrix.postTranslate(mNormalizedIconSize, mNormalizedIconSize);
|
||||
mTmpMatrix.preScale(scale, scale);
|
||||
mTmpMatrix.preTranslate(-mNormalizedIconSize, -mNormalizedIconSize);
|
||||
mRingPath.addPath(mShapePath, mTmpMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawEffect(Canvas canvas) {
|
||||
// Don't draw ring effect if item is about to be dragged.
|
||||
if (mDrawForDrag) {
|
||||
return;
|
||||
}
|
||||
mRingPath.reset();
|
||||
getShape().addToPath(mRingPath, getOutlineOffsetX(), getOutlineOffsetY(),
|
||||
mNormalizedIconRadius);
|
||||
if (isBadged) {
|
||||
float outlineSize = mNormalizedIconRadius * RING_EFFECT_RATIO * 2;
|
||||
float iconSize = getIconSize() * (1 - 2 * RING_EFFECT_RATIO);
|
||||
float badgeSize = LauncherIcons.getBadgeSizeForIconSize((int) iconSize) + outlineSize;
|
||||
float badgeInset = mNormalizedIconRadius * 2 - badgeSize;
|
||||
getShape().addToPath(mRingPath, getOutlineOffsetX() + badgeInset,
|
||||
getOutlineOffsetY() + badgeInset, badgeSize / 2);
|
||||
|
||||
}
|
||||
mIconRingPaint.setColor(RING_SHADOW_COLOR);
|
||||
mIconRingPaint.setMaskFilter(mShadowFilter);
|
||||
canvas.drawPath(mRingPath, mIconRingPaint);
|
||||
@@ -249,8 +272,10 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
*/
|
||||
@Override
|
||||
public void drawUnderItem(Canvas canvas) {
|
||||
getShape().drawShape(canvas, mIcon.getOutlineOffsetX(), mIcon.getOutlineOffsetY(),
|
||||
mIcon.mNormalizedIconRadius, mOutlinePaint);
|
||||
canvas.save();
|
||||
canvas.translate(mIcon.getOutlineOffsetX(), mIcon.getOutlineOffsetY());
|
||||
canvas.drawPath(mIcon.mShapePath, mOutlinePaint);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -241,7 +241,7 @@ public class RecentsAnimationDeviceState implements
|
||||
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mDisplayController.addChangeListener(this);
|
||||
onDisplayInfoChanged(mDisplayController.getInfo(), CHANGE_ALL);
|
||||
onDisplayInfoChanged(mContext, mDisplayController.getInfo(), CHANGE_ALL);
|
||||
|
||||
if (newMode == NO_BUTTON) {
|
||||
mExclusionListener.register();
|
||||
@@ -254,7 +254,7 @@ public class RecentsAnimationDeviceState implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Info info, int flags) {
|
||||
public void onDisplayInfoChanged(Context context, Info info, int flags) {
|
||||
if (info.id != getDisplayId() || flags == CHANGE_FRAME_DELAY) {
|
||||
// ignore displays that aren't running launcher and frame refresh rate changes
|
||||
return;
|
||||
|
||||
@@ -225,7 +225,7 @@ public class RotationTouchHelper implements
|
||||
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mDisplayController.addChangeListener(this);
|
||||
onDisplayInfoChanged(mDisplayController.getInfo(), CHANGE_ALL);
|
||||
onDisplayInfoChanged(mContext, mDisplayController.getInfo(), CHANGE_ALL);
|
||||
|
||||
mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayController.getInfo(),
|
||||
mContext.getResources());
|
||||
@@ -243,7 +243,7 @@ public class RotationTouchHelper implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Info info, int flags) {
|
||||
public void onDisplayInfoChanged(Context context, Info info, int flags) {
|
||||
if (info.id != mDisplayId|| flags == CHANGE_FRAME_DELAY) {
|
||||
// ignore displays that aren't running launcher and frame refresh rate changes
|
||||
return;
|
||||
|
||||
@@ -515,7 +515,8 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
}
|
||||
mRotationTouchHelper.setOrientationTransformIfNeeded(event);
|
||||
|
||||
if (mRotationTouchHelper.isInSwipeUpTouchRegion(event)) {
|
||||
if (!mDeviceState.isOneHandedModeActive()
|
||||
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event)) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.NO_SWIPE_TO_HOME,
|
||||
"TouchInteractionService.onInputEvent:isInSwipeUpTouchRegion");
|
||||
@@ -544,8 +545,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
InputConsumer.NO_OP, mInputMonitorCompat,
|
||||
mDeviceState,
|
||||
event);
|
||||
} else if (mDeviceState.canTriggerOneHandedAction(event)
|
||||
&& !mDeviceState.isOneHandedModeActive()) {
|
||||
} else if (mDeviceState.canTriggerOneHandedAction(event)) {
|
||||
// Consume gesture event for triggering one handed feature.
|
||||
mUncheckedConsumer = new OneHandedModeInputConsumer(this, mDeviceState,
|
||||
InputConsumer.NO_OP, mInputMonitorCompat);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@android:color/system_neutral1_800" />
|
||||
</selector>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@android:color/system_neutral1_500" android:lStar="98"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?android:attr/colorBackgroundFloating" />
|
||||
</selector>
|
||||
@@ -30,7 +30,7 @@
|
||||
</item>
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
<solid android:color="@color/widgets_picker_surface" />
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
|
||||
android:topRightRadius="@dimen/widget_list_content_corner_radius"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
<solid android:color="@color/widgets_picker_surface" />
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
|
||||
android:topRightRadius="@dimen/widget_list_content_corner_radius"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</item>
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
<solid android:color="@color/widgets_picker_surface" />
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
|
||||
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
<solid android:color="@color/widgets_picker_surface" />
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
|
||||
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/widgets_picker_surface" />
|
||||
<corners android:radius="@dimen/widget_list_top_bottom_corner_radius"/>
|
||||
</shape>
|
||||
@@ -25,7 +25,7 @@
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackgroundFloating"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:elevation="4dp">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:clipToPadding="false">
|
||||
<View
|
||||
android:id="@+id/collapse_handle"
|
||||
android:layout_width="48dp"
|
||||
@@ -44,6 +45,8 @@
|
||||
android:id="@+id/recommended_widget_table"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/widgets_recommendation_background"
|
||||
android:paddingVertical="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
android:id="@+id/widgets_list_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/widgets_list_middle_ripple"
|
||||
android:layout_marginBottom="@dimen/widget_list_entry_bottom_margin"
|
||||
android:paddingVertical="@dimen/widget_list_header_view_vertical_padding"
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
android:id="@+id/widgets_table"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/widgets_list_middle_ripple"
|
||||
android:layout_marginBottom="@dimen/widget_list_entry_bottom_margin"/>
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Configuration;
|
||||
@@ -296,7 +297,7 @@ public abstract class BaseDraggingActivity extends BaseActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Info info, int flags) {
|
||||
public void onDisplayInfoChanged(Context context, Info info, int flags) {
|
||||
if ((flags & CHANGE_ROTATION) != 0 && mDeviceProfile.updateIsSeascape(this)) {
|
||||
reapplyUi();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.graphics.IconShape.getShape;
|
||||
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
|
||||
@@ -26,16 +25,13 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils.TruncateAt;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
@@ -50,7 +46,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dot.DotInfo;
|
||||
import com.android.launcher3.dragndrop.DraggableView;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
@@ -60,7 +55,6 @@ import com.android.launcher3.graphics.PreloadIconDrawable;
|
||||
import com.android.launcher3.icons.DotRenderer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.icons.PlaceHolderIconDrawable;
|
||||
import com.android.launcher3.icons.cache.HandlerRunnable;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
@@ -97,11 +91,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
|
||||
private float mScaleForReorderBounce = 1f;
|
||||
|
||||
protected final Paint mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path mHighlightPath = new Path();
|
||||
protected int mHighlightColor = Color.TRANSPARENT;
|
||||
private final BlurMaskFilter mHighlightShadowFilter;
|
||||
|
||||
private static final Property<BubbleTextView, Float> DOT_SCALE_PROPERTY
|
||||
= new Property<BubbleTextView, Float>(Float.TYPE, "dotScale") {
|
||||
@Override
|
||||
@@ -220,10 +209,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
setEllipsize(TruncateAt.END);
|
||||
setAccessibilityDelegate(mActivity.getAccessibilityDelegate());
|
||||
setTextAlpha(1f);
|
||||
|
||||
int shadowSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.blur_size_click_shadow);
|
||||
mHighlightShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.INNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -451,41 +436,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mHighlightColor != Color.TRANSPARENT) {
|
||||
int count = canvas.save();
|
||||
drawFocusHighlight(canvas);
|
||||
canvas.restoreToCount(count);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
drawDotIfNecessary(canvas);
|
||||
}
|
||||
|
||||
protected void drawFocusHighlight(Canvas canvas) {
|
||||
boolean isBadged = getTag() instanceof ItemInfo && !Process.myUserHandle().equals(
|
||||
((ItemInfo) getTag()).user);
|
||||
float insetScale = (HIGHLIGHT_SCALE - 1) / 2;
|
||||
canvas.translate(-getIconSize() * insetScale, -insetScale * getIconSize());
|
||||
float outlineSize = getIconSize() * HIGHLIGHT_SCALE;
|
||||
mHighlightPath.reset();
|
||||
mHighlightPaint.reset();
|
||||
getIconBounds(mDotParams.iconBounds);
|
||||
getShape().addToPath(mHighlightPath, mDotParams.iconBounds.left, mDotParams.iconBounds.top,
|
||||
outlineSize / 2);
|
||||
if (isBadged) {
|
||||
float borderSize = outlineSize - getIconSize();
|
||||
float badgeSize = LauncherIcons.getBadgeSizeForIconSize(getIconSize()) + borderSize;
|
||||
float badgeInset = outlineSize - badgeSize;
|
||||
getShape().addToPath(mHighlightPath, mDotParams.iconBounds.left + badgeInset,
|
||||
mDotParams.iconBounds.top + badgeInset, badgeSize / 2);
|
||||
}
|
||||
mHighlightPaint.setMaskFilter(mHighlightShadowFilter);
|
||||
mHighlightPaint.setColor(mDotParams.color);
|
||||
canvas.drawPath(mHighlightPath, mHighlightPaint);
|
||||
mHighlightPaint.setMaskFilter(null);
|
||||
mHighlightPaint.setColor(mHighlightColor);
|
||||
canvas.drawPath(mHighlightPath, mHighlightPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the notification dot in the top right corner of the icon bounds.
|
||||
*
|
||||
@@ -921,11 +875,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
|
||||
@Override
|
||||
public SafeCloseable prepareDrawDragView() {
|
||||
int highlightColor = mHighlightColor;
|
||||
mHighlightColor = Color.TRANSPARENT;
|
||||
resetIconScale();
|
||||
setForceHideDot(true);
|
||||
return () -> mHighlightColor = highlightColor;
|
||||
return () -> { };
|
||||
}
|
||||
|
||||
private void resetIconScale() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
@@ -38,8 +39,8 @@ import android.view.WindowManager;
|
||||
import com.android.launcher3.CellLayout.ContainerType;
|
||||
import com.android.launcher3.DevicePaddings.DevicePadding;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.graphics.IconShape;
|
||||
import com.android.launcher3.icons.DotRenderer;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
@@ -54,6 +55,7 @@ public class DeviceProfile {
|
||||
private static final float TABLET_MIN_DPS = 600;
|
||||
private static final float LARGE_TABLET_MIN_DPS = 720;
|
||||
|
||||
private static final int DEFAULT_DOT_SIZE = 100;
|
||||
|
||||
public final InvariantDeviceProfile inv;
|
||||
private final Info mInfo;
|
||||
@@ -366,11 +368,10 @@ public class DeviceProfile {
|
||||
updateWorkspacePadding();
|
||||
|
||||
// This is done last, after iconSizePx is calculated above.
|
||||
mDotRendererWorkSpace = new DotRenderer(iconSizePx, IconShape.getShapePath(),
|
||||
IconShape.DEFAULT_PATH_SIZE);
|
||||
Path dotPath = GraphicsUtils.getShapePath(DEFAULT_DOT_SIZE);
|
||||
mDotRendererWorkSpace = new DotRenderer(iconSizePx, dotPath, DEFAULT_DOT_SIZE);
|
||||
mDotRendererAllApps = iconSizePx == allAppsIconSizePx ? mDotRendererWorkSpace :
|
||||
new DotRenderer(allAppsIconSizePx, IconShape.getShapePath(),
|
||||
IconShape.DEFAULT_PATH_SIZE);
|
||||
new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE);
|
||||
}
|
||||
|
||||
private void setCellLayoutBorderSpacing(int borderSpacing) {
|
||||
|
||||
@@ -203,9 +203,9 @@ public class InvariantDeviceProfile {
|
||||
.apply();
|
||||
|
||||
DisplayController.INSTANCE.get(context).addChangeListener(
|
||||
(info, flags) -> {
|
||||
(displayContext, info, flags) -> {
|
||||
if ((flags & (CHANGE_SIZE | CHANGE_DENSITY)) != 0) {
|
||||
onConfigChanged(context);
|
||||
onConfigChanged(displayContext);
|
||||
}
|
||||
});
|
||||
mOverlayMonitor = new OverlayMonitor(context);
|
||||
@@ -226,7 +226,7 @@ public class InvariantDeviceProfile {
|
||||
*/
|
||||
public InvariantDeviceProfile(Context context, Display display) {
|
||||
// Ensure that the main device profile is initialized
|
||||
InvariantDeviceProfile originalProfile = INSTANCE.get(context);
|
||||
INSTANCE.get(context);
|
||||
String gridName = getCurrentGridName(context);
|
||||
|
||||
// Get the display info based on default display and interpolate it to existing display
|
||||
|
||||
@@ -1197,7 +1197,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);
|
||||
mAllAppsController.setupViews(mAppsView, mScrimView);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,6 @@ 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 static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;
|
||||
|
||||
@@ -165,10 +164,6 @@ public class WorkspaceStateTransitionAnimation {
|
||||
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,6 +43,7 @@ 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.
|
||||
@@ -70,10 +71,11 @@ public class AllAppsTransitionController
|
||||
controller.setProgress(progress);
|
||||
}
|
||||
};
|
||||
private final Launcher mLauncher;
|
||||
|
||||
private AllAppsContainerView mAppsView;
|
||||
private ScrimView mScrimView;
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private boolean mIsVerticalLayout;
|
||||
|
||||
// Animation in this class is controlled by a single variable {@link mProgress}.
|
||||
@@ -121,6 +123,8 @@ public class AllAppsTransitionController
|
||||
*/
|
||||
public void setProgress(float progress) {
|
||||
mProgress = progress;
|
||||
//Note: Take inverted progress so progress=0 maps to a transparent scrim
|
||||
mScrimView.setProgress(1 - progress);
|
||||
mAppsView.setTranslationY(mProgress * mShiftRange);
|
||||
}
|
||||
|
||||
@@ -185,8 +189,12 @@ public class AllAppsTransitionController
|
||||
return AnimationSuccessListener.forRunnable(this::onProgressAnimationEnd);
|
||||
}
|
||||
|
||||
public void setupViews(AllAppsContainerView appsView) {
|
||||
/**
|
||||
* Setup views
|
||||
*/
|
||||
public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
|
||||
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
|
||||
|
||||
@@ -37,20 +37,14 @@ import android.graphics.drawable.AdaptiveIconDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ClipPathView;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
@@ -66,30 +60,16 @@ import java.util.List;
|
||||
public abstract class IconShape {
|
||||
|
||||
private static IconShape sInstance = new Circle();
|
||||
private static Path sShapePath;
|
||||
private static float sNormalizationScale = ICON_VISIBLE_AREA_FACTOR;
|
||||
|
||||
public static final int DEFAULT_PATH_SIZE = 100;
|
||||
|
||||
public static IconShape getShape() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static Path getShapePath() {
|
||||
if (sShapePath == null) {
|
||||
Path p = new Path();
|
||||
getShape().addToPath(p, 0, 0, DEFAULT_PATH_SIZE * 0.5f);
|
||||
sShapePath = p;
|
||||
}
|
||||
return sShapePath;
|
||||
}
|
||||
|
||||
public static float getNormalizationScale() {
|
||||
return sNormalizationScale;
|
||||
}
|
||||
|
||||
private SparseArray<TypedValue> mAttrs;
|
||||
|
||||
public boolean enableShapeDetection(){
|
||||
return false;
|
||||
};
|
||||
@@ -102,11 +82,6 @@ public abstract class IconShape {
|
||||
public abstract <T extends View & ClipPathView> Animator createRevealAnimator(T target,
|
||||
Rect startRect, Rect endRect, float endRadius, boolean isReversed);
|
||||
|
||||
@Nullable
|
||||
public TypedValue getAttrValue(int attr) {
|
||||
return mAttrs == null ? null : mAttrs.get(attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract shape where the reveal animation is a derivative of a round rect animation
|
||||
*/
|
||||
@@ -410,7 +385,6 @@ public abstract class IconShape {
|
||||
|
||||
final int depth = parser.getDepth();
|
||||
int[] radiusAttr = new int[] {R.attr.folderIconRadius};
|
||||
IntArray keysToIgnore = new IntArray(0);
|
||||
|
||||
while (((type = parser.next()) != XmlPullParser.END_TAG ||
|
||||
parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
|
||||
@@ -421,7 +395,6 @@ public abstract class IconShape {
|
||||
IconShape shape = getShapeDefinition(parser.getName(), a.getFloat(0, 1));
|
||||
a.recycle();
|
||||
|
||||
shape.mAttrs = Themes.createValueMap(context, attrs, keysToIgnore);
|
||||
result.add(shape);
|
||||
}
|
||||
}
|
||||
@@ -467,8 +440,6 @@ public abstract class IconShape {
|
||||
}
|
||||
|
||||
// Initialize shape properties
|
||||
drawable.setBounds(0, 0, DEFAULT_PATH_SIZE, DEFAULT_PATH_SIZE);
|
||||
sShapePath = new Path(drawable.getIconMask());
|
||||
sNormalizationScale = IconNormalizer.normalizeAdaptiveIcon(drawable, size, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
|
||||
package com.android.launcher3.graphics;
|
||||
|
||||
import static com.android.launcher3.graphics.IconShape.DEFAULT_PATH_SIZE;
|
||||
import static com.android.launcher3.graphics.IconShape.getShapePath;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
@@ -39,6 +36,7 @@ import android.view.ContextThemeWrapper;
|
||||
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
@@ -62,6 +60,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
|
||||
}
|
||||
};
|
||||
|
||||
private static final int DEFAULT_PATH_SIZE = 100;
|
||||
private static final float PROGRESS_WIDTH = 7;
|
||||
private static final float PROGRESS_GAP = 2;
|
||||
private static final int MAX_PAINT_ALPHA = 255;
|
||||
@@ -132,7 +131,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
|
||||
boolean isDarkMode) {
|
||||
super(info.bitmap);
|
||||
mItem = info;
|
||||
mShapePath = getShapePath();
|
||||
mShapePath = GraphicsUtils.getShapePath(DEFAULT_PATH_SIZE);
|
||||
mScaledTrackPath = new Path();
|
||||
mScaledProgressPath = new Path();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DisplayController implements DisplayListener, ComponentCallbacks {
|
||||
new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
|
||||
}
|
||||
|
||||
mInfo = createInfo(display);
|
||||
mInfo = new Info(getContext(display), display);
|
||||
mDM.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
|
||||
}
|
||||
|
||||
@@ -125,7 +125,13 @@ public class DisplayController implements DisplayListener, ComponentCallbacks {
|
||||
*/
|
||||
public interface DisplayInfoChangeListener {
|
||||
|
||||
void onDisplayInfoChanged(Info info, int flags);
|
||||
/**
|
||||
* Invoked when display info has changed.
|
||||
* @param context updated context associated with the display.
|
||||
* @param info updated display information.
|
||||
* @param flags bitmask indicating type of change.
|
||||
*/
|
||||
void onDisplayInfoChanged(Context context, Info info, int flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,14 +178,15 @@ public class DisplayController implements DisplayListener, ComponentCallbacks {
|
||||
return mInfo;
|
||||
}
|
||||
|
||||
private Info createInfo(Display display) {
|
||||
return new Info(mContext.createDisplayContext(display), display);
|
||||
private Context getContext(Display display) {
|
||||
return Utilities.ATLEAST_S ? mWindowContext : mContext.createDisplayContext(display);
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
private void handleInfoChange(Display display) {
|
||||
Info oldInfo = mInfo;
|
||||
Info newInfo = createInfo(display);
|
||||
Context context = getContext(display);
|
||||
Info newInfo = new Info(context, display);
|
||||
int change = 0;
|
||||
if (newInfo.hasDifferentSize(oldInfo)) {
|
||||
change |= CHANGE_SIZE;
|
||||
@@ -197,13 +204,13 @@ public class DisplayController implements DisplayListener, ComponentCallbacks {
|
||||
if (change != 0) {
|
||||
mInfo = newInfo;
|
||||
final int flags = change;
|
||||
MAIN_EXECUTOR.execute(() -> notifyChange(flags));
|
||||
MAIN_EXECUTOR.execute(() -> notifyChange(context, flags));
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyChange(int flags) {
|
||||
private void notifyChange(Context context, int flags) {
|
||||
for (int i = mListeners.size() - 1; i >= 0; i--) {
|
||||
mListeners.get(i).onDisplayInfoChanged(mInfo, flags);
|
||||
mListeners.get(i).onDisplayInfoChanged(context, mInfo, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,18 +15,21 @@
|
||||
*/
|
||||
package com.android.launcher3.views;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.util.SystemUiController;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
@@ -36,9 +39,22 @@ import com.android.launcher3.util.Themes;
|
||||
public class ScrimView extends View implements Insettable {
|
||||
private static final float STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.9f;
|
||||
|
||||
|
||||
private static final float TINT_DECAY_MULTIPLIER = .5f;
|
||||
|
||||
//min progress for scrim to become visible
|
||||
private static final float SCRIM_VISIBLE_THRESHOLD = .1f;
|
||||
//max progress where scrim alpha animates.
|
||||
private static final float SCRIM_SOLID_THRESHOLD = .5f;
|
||||
private final Interpolator mScrimInterpolator = Interpolators.clampToProgress(ACCEL,
|
||||
SCRIM_VISIBLE_THRESHOLD,
|
||||
SCRIM_SOLID_THRESHOLD);
|
||||
|
||||
private final boolean mIsScrimDark;
|
||||
private SystemUiController mSystemUiController;
|
||||
|
||||
private float mProgress;
|
||||
|
||||
public ScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mIsScrimDark = ColorUtils.calculateLuminance(
|
||||
@@ -47,17 +63,23 @@ public class ScrimView extends View implements Insettable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInsets(Rect insets) { }
|
||||
public void setInsets(Rect insets) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSetAlpha(int alpha) {
|
||||
updateSysUiColors();
|
||||
return super.onSetAlpha(alpha);
|
||||
/**
|
||||
* Set progress of scrim animation.
|
||||
* Note: progress should range from 0 for transparent to 1 for solid
|
||||
*/
|
||||
public void setProgress(float progress) {
|
||||
if (mProgress != progress) {
|
||||
mProgress = progress;
|
||||
setAlpha(mScrimInterpolator.getInterpolation(progress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -181,8 +181,8 @@ public class WidgetsDiffReporter {
|
||||
}
|
||||
if (newRow instanceof WidgetsListSearchHeaderEntry
|
||||
&& curRow instanceof WidgetsListSearchHeaderEntry) {
|
||||
return ((WidgetsListSearchHeaderEntry) newRow).hasEntryUpdated()
|
||||
|| !curRow.equals(newRow);
|
||||
// Always refresh search header entries to reset rounded corners in their view holder.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user