diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-09-18 18:33:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-18 18:33:42 +0000 |
commit | a8433c6512cc53fb0eef58181e364b4ba330811c (patch) | |
tree | a4200883fa3ecade50eb8742347030152f4f4c9e /packages/SystemUI/src/com/android/systemui | |
parent | 9aefd415577516afa0967cbb7db0a2006f3ac6ea (diff) | |
parent | cb5570316d55c6fe2ff717fa6b94b14d13980263 (diff) | |
download | frameworks_base-a8433c6512cc53fb0eef58181e364b4ba330811c.zip frameworks_base-a8433c6512cc53fb0eef58181e364b4ba330811c.tar.gz frameworks_base-a8433c6512cc53fb0eef58181e364b4ba330811c.tar.bz2 |
Merge "Add option for recents to use fake shadows" into lmp-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
8 files changed, 343 insertions, 32 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 52ec54b..e4a167b 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -39,8 +39,6 @@ public class Constants { public static final boolean EnableDevAppInfoOnLongPress = true; // Enables the search bar layout public static final boolean EnableSearchLayout = true; - // Enables the dynamic shadows behind each task - public static final boolean EnableShadows = true; // Enables the thumbnail alpha on the front-most task public static final boolean EnableThumbnailAlphaOnFrontmost = false; // This disables the bitmap and icon caches diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index 2f5b07b..e3a2ad8 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -121,6 +121,7 @@ public class RecentsConfiguration { /** Misc **/ public boolean useHardwareLayers; public int altTabKeyDelay; + public boolean fakeShadows; /** Dev options and global settings */ public boolean lockToAppEnabled; @@ -274,6 +275,7 @@ public class RecentsConfiguration { // Misc useHardwareLayers = res.getBoolean(R.bool.config_recents_use_hardware_layers); altTabKeyDelay = res.getInteger(R.integer.recents_alt_tab_key_delay); + fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows); } /** Updates the system insets */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java index 0adc73c..b584fd3 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java @@ -53,10 +53,12 @@ public class AnimateableViewBounds extends ViewOutlineProvider { @Override public void getOutline(View view, Outline outline) { outline.setAlpha(mMinAlpha + mAlpha / (1f - mMinAlpha)); + + // TODO: This doesn't work with fake shadows. outline.setRoundRect(Math.max(mClipRect.left, mOutlineClipRect.left), Math.max(mClipRect.top, mOutlineClipRect.top), - mSourceView.getMeasuredWidth() - Math.max(mClipRect.right, mOutlineClipRect.right), - mSourceView.getMeasuredHeight() - Math.max(mClipRect.bottom, mOutlineClipRect.bottom), + mSourceView.getWidth() - Math.max(mClipRect.right, mOutlineClipRect.right), + mSourceView.getHeight() - Math.max(mClipRect.bottom, mOutlineClipRect.bottom), mCornerRadius); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java b/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java new file mode 100644 index 0000000..72f9001 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2014 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.systemui.recents.views; + +import android.content.res.Resources; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.LinearGradient; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PixelFormat; +import android.graphics.RadialGradient; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader; +import android.graphics.drawable.Drawable; +import android.util.Log; + +import com.android.systemui.R; +import com.android.systemui.recents.RecentsConfiguration; + +/** + * A rounded rectangle drawable which also includes a shadow around. This is mostly copied from + * frameworks/support/v7/cardview/eclair-mr1/android/support/v7/widget/ + * RoundRectDrawableWithShadow.java revision c42ba8c000d1e6ce85e152dfc17089a0a69e739f with a few + * modifications to suit our needs in SystemUI. + */ +class FakeShadowDrawable extends Drawable { + // used to calculate content padding + final static double COS_45 = Math.cos(Math.toRadians(45)); + + final static float SHADOW_MULTIPLIER = 1.5f; + + final float mInsetShadow; // extra shadow to avoid gaps between card and shadow + + Paint mCornerShadowPaint; + + Paint mEdgeShadowPaint; + + final RectF mCardBounds; + + float mCornerRadius; + + Path mCornerShadowPath; + + // updated value with inset + float mMaxShadowSize; + + // actual value set by developer + float mRawMaxShadowSize; + + // multiplied value to account for shadow offset + float mShadowSize; + + // actual value set by developer + float mRawShadowSize; + + private boolean mDirty = true; + + private final int mShadowStartColor; + + private final int mShadowEndColor; + + private boolean mAddPaddingForCorners = true; + + /** + * If shadow size is set to a value above max shadow, we print a warning + */ + private boolean mPrintedShadowClipWarning = false; + + public FakeShadowDrawable(Resources resources, RecentsConfiguration config) { + mShadowStartColor = resources.getColor(R.color.fake_shadow_start_color); + mShadowEndColor = resources.getColor(R.color.fake_shadow_end_color); + mInsetShadow = resources.getDimension(R.dimen.fake_shadow_inset); + setShadowSize(resources.getDimensionPixelSize(R.dimen.fake_shadow_size), + resources.getDimensionPixelSize(R.dimen.fake_shadow_size)); + mCornerShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); + mCornerShadowPaint.setStyle(Paint.Style.FILL); + mCornerShadowPaint.setDither(true); + mCornerRadius = config.taskViewRoundedCornerRadiusPx; + mCardBounds = new RectF(); + mEdgeShadowPaint = new Paint(mCornerShadowPaint); + } + + @Override + public void setAlpha(int alpha) { + mCornerShadowPaint.setAlpha(alpha); + mEdgeShadowPaint.setAlpha(alpha); + } + + @Override + protected void onBoundsChange(Rect bounds) { + super.onBoundsChange(bounds); + mDirty = true; + } + + void setShadowSize(float shadowSize, float maxShadowSize) { + if (shadowSize < 0 || maxShadowSize < 0) { + throw new IllegalArgumentException("invalid shadow size"); + } + if (shadowSize > maxShadowSize) { + shadowSize = maxShadowSize; + if (!mPrintedShadowClipWarning) { + Log.w("CardView", "Shadow size is being clipped by the max shadow size. See " + + "{CardView#setMaxCardElevation}."); + mPrintedShadowClipWarning = true; + } + } + if (mRawShadowSize == shadowSize && mRawMaxShadowSize == maxShadowSize) { + return; + } + mRawShadowSize = shadowSize; + mRawMaxShadowSize = maxShadowSize; + mShadowSize = shadowSize * SHADOW_MULTIPLIER + mInsetShadow; + mMaxShadowSize = maxShadowSize + mInsetShadow; + mDirty = true; + invalidateSelf(); + } + + @Override + public boolean getPadding(Rect padding) { + int vOffset = (int) Math.ceil(calculateVerticalPadding(mRawMaxShadowSize, mCornerRadius, + mAddPaddingForCorners)); + int hOffset = (int) Math.ceil(calculateHorizontalPadding(mRawMaxShadowSize, mCornerRadius, + mAddPaddingForCorners)); + padding.set(hOffset, vOffset, hOffset, vOffset); + return true; + } + + static float calculateVerticalPadding(float maxShadowSize, float cornerRadius, + boolean addPaddingForCorners) { + if (addPaddingForCorners) { + return (float) (maxShadowSize * SHADOW_MULTIPLIER + (1 - COS_45) * cornerRadius); + } else { + return maxShadowSize * SHADOW_MULTIPLIER; + } + } + + static float calculateHorizontalPadding(float maxShadowSize, float cornerRadius, + boolean addPaddingForCorners) { + if (addPaddingForCorners) { + return (float) (maxShadowSize + (1 - COS_45) * cornerRadius); + } else { + return maxShadowSize; + } + } + + @Override + public void setColorFilter(ColorFilter cf) { + mCornerShadowPaint.setColorFilter(cf); + mEdgeShadowPaint.setColorFilter(cf); + } + + @Override + public int getOpacity() { + return PixelFormat.OPAQUE; + } + + @Override + public void draw(Canvas canvas) { + if (mDirty) { + buildComponents(getBounds()); + mDirty = false; + } + canvas.translate(0, mRawShadowSize / 4); + drawShadow(canvas); + canvas.translate(0, -mRawShadowSize / 4); + } + + private void drawShadow(Canvas canvas) { + final float edgeShadowTop = -mCornerRadius - mShadowSize; + final float inset = mCornerRadius + mInsetShadow + mRawShadowSize / 2; + final boolean drawHorizontalEdges = mCardBounds.width() - 2 * inset > 0; + final boolean drawVerticalEdges = mCardBounds.height() - 2 * inset > 0; + // LT + int saved = canvas.save(); + canvas.translate(mCardBounds.left + inset, mCardBounds.top + inset); + canvas.drawPath(mCornerShadowPath, mCornerShadowPaint); + if (drawHorizontalEdges) { + canvas.drawRect(0, edgeShadowTop, + mCardBounds.width() - 2 * inset, -mCornerRadius, + mEdgeShadowPaint); + } + canvas.restoreToCount(saved); + // RB + saved = canvas.save(); + canvas.translate(mCardBounds.right - inset, mCardBounds.bottom - inset); + canvas.rotate(180f); + canvas.drawPath(mCornerShadowPath, mCornerShadowPaint); + if (drawHorizontalEdges) { + canvas.drawRect(0, edgeShadowTop, + mCardBounds.width() - 2 * inset, -mCornerRadius + mShadowSize, + mEdgeShadowPaint); + } + canvas.restoreToCount(saved); + // LB + saved = canvas.save(); + canvas.translate(mCardBounds.left + inset, mCardBounds.bottom - inset); + canvas.rotate(270f); + canvas.drawPath(mCornerShadowPath, mCornerShadowPaint); + if (drawVerticalEdges) { + canvas.drawRect(0, edgeShadowTop, + mCardBounds.height() - 2 * inset, -mCornerRadius, mEdgeShadowPaint); + } + canvas.restoreToCount(saved); + // RT + saved = canvas.save(); + canvas.translate(mCardBounds.right - inset, mCardBounds.top + inset); + canvas.rotate(90f); + canvas.drawPath(mCornerShadowPath, mCornerShadowPaint); + if (drawVerticalEdges) { + canvas.drawRect(0, edgeShadowTop, + mCardBounds.height() - 2 * inset, -mCornerRadius, mEdgeShadowPaint); + } + canvas.restoreToCount(saved); + } + + private void buildShadowCorners() { + RectF innerBounds = new RectF(-mCornerRadius, -mCornerRadius, mCornerRadius, mCornerRadius); + RectF outerBounds = new RectF(innerBounds); + outerBounds.inset(-mShadowSize, -mShadowSize); + + if (mCornerShadowPath == null) { + mCornerShadowPath = new Path(); + } else { + mCornerShadowPath.reset(); + } + mCornerShadowPath.setFillType(Path.FillType.EVEN_ODD); + mCornerShadowPath.moveTo(-mCornerRadius, 0); + mCornerShadowPath.rLineTo(-mShadowSize, 0); + // outer arc + mCornerShadowPath.arcTo(outerBounds, 180f, 90f, false); + // inner arc + mCornerShadowPath.arcTo(innerBounds, 270f, -90f, false); + mCornerShadowPath.close(); + + float startRatio = mCornerRadius / (mCornerRadius + mShadowSize); + mCornerShadowPaint.setShader(new RadialGradient(0, 0, mCornerRadius + mShadowSize, + new int[]{mShadowStartColor, mShadowStartColor, mShadowEndColor}, + new float[]{0f, startRatio, 1f} + , Shader.TileMode.CLAMP)); + + // we offset the content shadowSize/2 pixels up to make it more realistic. + // this is why edge shadow shader has some extra space + // When drawing bottom edge shadow, we use that extra space. + mEdgeShadowPaint.setShader(new LinearGradient(0, -mCornerRadius + mShadowSize, 0, + -mCornerRadius - mShadowSize, + new int[]{mShadowStartColor, mShadowStartColor, mShadowEndColor}, + new float[]{0f, .5f, 1f}, Shader.TileMode.CLAMP)); + } + + private void buildComponents(Rect bounds) { + // Card is offset SHADOW_MULTIPLIER * maxShadowSize to account for the shadow shift. + // We could have different top-bottom offsets to avoid extra gap above but in that case + // center aligning Views inside the CardView would be problematic. + final float verticalOffset = mMaxShadowSize * SHADOW_MULTIPLIER; + mCardBounds.set(bounds.left + mMaxShadowSize, bounds.top + verticalOffset, + bounds.right - mMaxShadowSize, bounds.bottom - verticalOffset); + buildShadowCorners(); + } + + float getMinWidth() { + final float content = 2 * + Math.max(mRawMaxShadowSize, mCornerRadius + mInsetShadow + mRawMaxShadowSize / 2); + return content + (mRawMaxShadowSize + mInsetShadow) * 2; + } + + float getMinHeight() { + final float content = 2 * Math.max(mRawMaxShadowSize, mCornerRadius + mInsetShadow + + mRawMaxShadowSize * SHADOW_MULTIPLIER / 2); + return content + (mRawMaxShadowSize * SHADOW_MULTIPLIER + mInsetShadow) * 2; + } +}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index 1bfb41f..e6d0280 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -393,7 +393,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV // Upfront the processing of the thumbnail TaskViewTransform transform = new TaskViewTransform(); - View sourceView = tv; + View sourceView; int offsetX = 0; int offsetY = 0; float stackScroll = stackView.getScroller().getStackScroll(); @@ -406,6 +406,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV offsetX = transform.rect.left; offsetY = mConfig.displayRect.height(); } else { + sourceView = tv.mThumbnailView; transform = stackView.getStackAlgorithm().getStackTransform(task, stackScroll, transform, null); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 895b9d1..470b1f0 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -81,6 +81,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal boolean mStartEnterAnimationCompleted; ViewAnimation.TaskViewEnterContext mStartEnterAnimationContext; int[] mTmpVisibleRange = new int[2]; + Rect mTmpRect = new Rect(); TaskViewTransform mTmpTransform = new TaskViewTransform(); HashMap<Task, TaskView> mTmpTaskViewMap = new HashMap<Task, TaskView>(); LayoutInflater mInflater; @@ -537,10 +538,17 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (tv.isFullScreenView()) { tv.measure(widthMeasureSpec, heightMeasureSpec); } else { + if (tv.getBackground() != null) { + tv.getBackground().getPadding(mTmpRect); + } else { + mTmpRect.setEmpty(); + } tv.measure( - MeasureSpec.makeMeasureSpec(mLayoutAlgorithm.mTaskRect.width(), + MeasureSpec.makeMeasureSpec( + mLayoutAlgorithm.mTaskRect.width() + mTmpRect.left + mTmpRect.right, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(mLayoutAlgorithm.mTaskRect.height() + + MeasureSpec.makeMeasureSpec( + mLayoutAlgorithm.mTaskRect.height() + mTmpRect.top + mTmpRect.bottom + tv.getMaxFooterHeight(), MeasureSpec.EXACTLY)); } } @@ -562,8 +570,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (tv.isFullScreenView()) { tv.layout(left, top, left + tv.getMeasuredWidth(), top + tv.getMeasuredHeight()); } else { - tv.layout(mLayoutAlgorithm.mTaskRect.left, mLayoutAlgorithm.mTaskRect.top, - mLayoutAlgorithm.mTaskRect.right, mLayoutAlgorithm.mTaskRect.bottom + + if (tv.getBackground() != null) { + tv.getBackground().getPadding(mTmpRect); + } else { + mTmpRect.setEmpty(); + } + tv.layout(mLayoutAlgorithm.mTaskRect.left - mTmpRect.left, + mLayoutAlgorithm.mTaskRect.top - mTmpRect.top, + mLayoutAlgorithm.mTaskRect.right + mTmpRect.right, + mLayoutAlgorithm.mTaskRect.bottom + mTmpRect.bottom + tv.getMaxFooterHeight()); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index a1ddf0f..4baf31f 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -26,6 +26,8 @@ import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; @@ -106,9 +108,12 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mMaxDimScale = mConfig.taskStackMaxDim / 255f; mClipViewInStack = true; mViewBounds = new AnimateableViewBounds(this, mConfig.taskViewRoundedCornerRadiusPx); - setOutlineProvider(mViewBounds); setTaskProgress(getTaskProgress()); setDim(getDim()); + if (mConfig.fakeShadows) { + setBackground(new FakeShadowDrawable(context.getResources(), mConfig)); + } + setOutlineProvider(mViewBounds); } /** Set callback */ @@ -150,24 +155,30 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); + int widthWithoutPadding = width - mPaddingLeft - mPaddingRight; + int heightWithoutPadding = height - mPaddingTop - mPaddingBottom; // Measure the bar view, thumbnail, and footer - mHeaderView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), + mHeaderView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mConfig.taskBarHeight, MeasureSpec.EXACTLY)); if (mFooterView != null) { - mFooterView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), + mFooterView.measure( + MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mConfig.taskViewLockToAppButtonHeight, MeasureSpec.EXACTLY)); } - mActionButtonView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); + mActionButtonView.measure( + MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.AT_MOST), + MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.AT_MOST)); if (mIsFullScreenView) { // Measure the thumbnail height to be the full dimensions - mThumbnailView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); + mThumbnailView.measure( + MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.EXACTLY)); } else { // Measure the thumbnail to be square - mThumbnailView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)); + mThumbnailView.measure( + MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY)); } setMeasuredDimension(width, height); invalidateOutline(); @@ -178,7 +189,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, // If we are a full screen view, then only update the Z to keep it in order // XXX: Also update/animate the dim as well if (mIsFullScreenView) { - if (Constants.DebugFlags.App.EnableShadows && + if (!mConfig.fakeShadows && toTransform.hasTranslationZChangedFrom(getTranslationZ())) { setTranslationZ(toTransform.translationZ); } @@ -186,7 +197,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } // Apply the transform - toTransform.applyToTaskView(this, duration, mConfig.fastOutSlowInInterpolator, false); + toTransform.applyToTaskView(this, duration, mConfig.fastOutSlowInInterpolator, false, + !mConfig.fakeShadows); // Update the task progress if (mTaskProgressAnimator != null) { @@ -258,9 +270,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } else if (mConfig.launchedFromHome) { // Move the task view off screen (below) so we can animate it in setTranslationY(offscreenY); - if (Constants.DebugFlags.App.EnableShadows) { - setTranslationZ(0); - } + setTranslationZ(0); setScaleX(1f); setScaleY(1f); } @@ -413,7 +423,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, int frontIndex = (ctx.currentStackViewCount - ctx.currentStackViewIndex - 1); int delay = mConfig.taskViewEnterFromHomeDelay + frontIndex * mConfig.taskViewEnterFromHomeStaggerDelay; - if (Constants.DebugFlags.App.EnableShadows) { + if (!mConfig.fakeShadows) { animate().translationZ(transform.translationZ); } animate() diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java index ce2e80b..fee4e80 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java @@ -77,7 +77,8 @@ public class TaskViewTransform { } /** Applies this transform to a view. */ - public void applyToTaskView(View v, int duration, Interpolator interp, boolean allowLayers) { + public void applyToTaskView(View v, int duration, Interpolator interp, boolean allowLayers, + boolean allowShadows) { // Check to see if any properties have changed, and update the task view if (duration > 0) { ViewPropertyAnimator anim = v.animate(); @@ -87,8 +88,7 @@ public class TaskViewTransform { if (hasTranslationYChangedFrom(v.getTranslationY())) { anim.translationY(translationY); } - if (Constants.DebugFlags.App.EnableShadows && - hasTranslationZChangedFrom(v.getTranslationZ())) { + if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) { anim.translationZ(translationZ); } if (hasScaleChangedFrom(v.getScaleX())) { @@ -113,8 +113,7 @@ public class TaskViewTransform { if (hasTranslationYChangedFrom(v.getTranslationY())) { v.setTranslationY(translationY); } - if (Constants.DebugFlags.App.EnableShadows && - hasTranslationZChangedFrom(v.getTranslationZ())) { + if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) { v.setTranslationZ(translationZ); } if (hasScaleChangedFrom(v.getScaleX())) { @@ -131,9 +130,7 @@ public class TaskViewTransform { public static void reset(View v) { v.setTranslationX(0f); v.setTranslationY(0f); - if (Constants.DebugFlags.App.EnableShadows) { - v.setTranslationZ(0f); - } + v.setTranslationZ(0f); v.setScaleX(1f); v.setScaleY(1f); v.setAlpha(1f); |