Disabling certain effects (wallpaper transition, holographic icons in AllApps) if HW acceleration is not enabled.
Change-Id: I7926d5c3ba95c6d57999189677ff79f67b05434f
This commit is contained in:
parent
876668c132
commit
b46a2d130b
|
@ -41,7 +41,6 @@ public class HolographicPagedViewIcon extends TextView {
|
|||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
Bitmap overlay = mOriginalIcon.getHolographicOutline();
|
||||
|
||||
if (overlay != null) {
|
||||
final int offset = getScrollX();
|
||||
final int compoundPaddingLeft = getCompoundPaddingLeft();
|
||||
|
|
|
@ -57,6 +57,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
|
|||
private int mAlpha = 255;
|
||||
private int mHolographicAlpha;
|
||||
|
||||
private boolean mHolographicEffectsEnabled;
|
||||
private boolean mIsChecked;
|
||||
private ObjectAnimator mCheckedAlphaAnimator;
|
||||
private float mCheckedAlpha = 1.0f;
|
||||
|
@ -132,6 +133,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
|
|||
}
|
||||
|
||||
mHolographicOutlineView = new HolographicPagedViewIcon(context, this);
|
||||
mHolographicEffectsEnabled = isHardwareAccelerated();
|
||||
}
|
||||
|
||||
protected HolographicPagedViewIcon getHolographicOutlineView() {
|
||||
|
@ -164,7 +166,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
|
|||
mIconCache = cache;
|
||||
mIconCacheKey = new PagedViewIconCache.Key(info);
|
||||
mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
|
||||
if (!queueHolographicOutlineCreation()) {
|
||||
if (mHolographicEffectsEnabled && !queueHolographicOutlineCreation()) {
|
||||
getHolographicOutlineView().invalidate();
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +184,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
|
|||
mIconCache = cache;
|
||||
mIconCacheKey = new PagedViewIconCache.Key(info);
|
||||
mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
|
||||
if (!queueHolographicOutlineCreation()) {
|
||||
if (mHolographicEffectsEnabled && !queueHolographicOutlineCreation()) {
|
||||
getHolographicOutlineView().invalidate();
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +220,8 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
|
|||
|
||||
// draw any blended overlays
|
||||
if (mCheckedOutline == null) {
|
||||
if (mHolographicOutline != null && mHolographicAlpha > 0) {
|
||||
if (mHolographicEffectsEnabled && mHolographicOutline != null
|
||||
&& mHolographicAlpha > 0) {
|
||||
mPaint.setAlpha(mHolographicAlpha);
|
||||
overlay = mHolographicOutline;
|
||||
}
|
||||
|
|
|
@ -760,7 +760,8 @@ public class Workspace extends SmoothPagedView
|
|||
return offset;
|
||||
}
|
||||
private void syncWallpaperOffsetWithScroll() {
|
||||
if (LauncherApplication.isScreenXLarge()) {
|
||||
final boolean enableWallpaperEffects = isHardwareAccelerated();
|
||||
if (enableWallpaperEffects) {
|
||||
mWallpaperOffset.setFinalX(wallpaperOffsetForCurrentScroll());
|
||||
}
|
||||
}
|
||||
|
@ -1544,30 +1545,35 @@ public class Workspace extends SmoothPagedView
|
|||
float offsetFromCenter = (wallpaperTravelHeight / (float) mWallpaperHeight) / 2f;
|
||||
boolean isLandscape = display.getWidth() > display.getHeight();
|
||||
|
||||
switch (shrinkState) {
|
||||
// animating in
|
||||
case TOP:
|
||||
// customize
|
||||
wallpaperOffset = 0.5f + offsetFromCenter;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.46f : 0.44f);
|
||||
break;
|
||||
case MIDDLE:
|
||||
case SPRING_LOADED:
|
||||
wallpaperOffset = 0.5f;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
|
||||
break;
|
||||
case BOTTOM_HIDDEN:
|
||||
case BOTTOM_VISIBLE:
|
||||
// allapps
|
||||
wallpaperOffset = 0.5f - offsetFromCenter;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
|
||||
break;
|
||||
final boolean enableWallpaperEffects = isHardwareAccelerated();
|
||||
if (enableWallpaperEffects) {
|
||||
switch (shrinkState) {
|
||||
// animating in
|
||||
case TOP:
|
||||
// customize
|
||||
wallpaperOffset = 0.5f + offsetFromCenter;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.46f : 0.44f);
|
||||
break;
|
||||
case MIDDLE:
|
||||
case SPRING_LOADED:
|
||||
wallpaperOffset = 0.5f;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
|
||||
break;
|
||||
case BOTTOM_HIDDEN:
|
||||
case BOTTOM_VISIBLE:
|
||||
// allapps
|
||||
wallpaperOffset = 0.5f - offsetFromCenter;
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setLayoutScale(1.0f);
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(0.46f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
if (enableWallpaperEffects) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(0.46f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
|
||||
mSyncWallpaperOffsetWithScroll = false;
|
||||
|
||||
|
@ -1586,10 +1592,12 @@ public class Workspace extends SmoothPagedView
|
|||
return;
|
||||
}
|
||||
fastInvalidate();
|
||||
setHorizontalWallpaperOffset(
|
||||
if (enableWallpaperEffects) {
|
||||
setHorizontalWallpaperOffset(
|
||||
a * oldHorizontalWallpaperOffset + b * newHorizontalWallpaperOffset);
|
||||
setVerticalWallpaperOffset(
|
||||
setVerticalWallpaperOffset(
|
||||
a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
|
||||
}
|
||||
for (int i = 0; i < screenCount; i++) {
|
||||
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||
cl.fastInvalidate();
|
||||
|
@ -1607,7 +1615,7 @@ public class Workspace extends SmoothPagedView
|
|||
mAnimator.playTogether(animWithInterpolator);
|
||||
mAnimator.addListener(mShrinkAnimationListener);
|
||||
mAnimator.start();
|
||||
} else {
|
||||
} else if (enableWallpaperEffects) {
|
||||
setVerticalWallpaperOffset(wallpaperOffset);
|
||||
setHorizontalWallpaperOffset(0.5f);
|
||||
updateWallpaperOffsetImmediately();
|
||||
|
@ -1906,33 +1914,36 @@ public class Workspace extends SmoothPagedView
|
|||
}
|
||||
Display display = mLauncher.getWindowManager().getDefaultDisplay();
|
||||
boolean isLandscape = display.getWidth() > display.getHeight();
|
||||
switch (mShrinkState) {
|
||||
// animating out
|
||||
case TOP:
|
||||
// customize
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.62f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.62f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
case MIDDLE:
|
||||
case SPRING_LOADED:
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.49f : 0.46f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.49f : 0.46f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
case BOTTOM_HIDDEN:
|
||||
case BOTTOM_VISIBLE:
|
||||
// all apps
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.65f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.65f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
final boolean enableWallpaperEffects = isHardwareAccelerated();
|
||||
if (enableWallpaperEffects) {
|
||||
switch (mShrinkState) {
|
||||
// animating out
|
||||
case TOP:
|
||||
// customize
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.62f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.62f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
case MIDDLE:
|
||||
case SPRING_LOADED:
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.49f : 0.46f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.49f : 0.46f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
case BOTTOM_HIDDEN:
|
||||
case BOTTOM_VISIBLE:
|
||||
// all apps
|
||||
if (animated) {
|
||||
mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.65f);
|
||||
mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.65f);
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (animated) {
|
||||
ValueAnimator animWithInterpolator =
|
||||
|
@ -1950,10 +1961,12 @@ public class Workspace extends SmoothPagedView
|
|||
return;
|
||||
}
|
||||
fastInvalidate();
|
||||
setHorizontalWallpaperOffset(
|
||||
a * oldHorizontalWallpaperOffset + b * newHorizontalWallpaperOffset);
|
||||
setVerticalWallpaperOffset(
|
||||
a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
|
||||
if (enableWallpaperEffects) {
|
||||
setHorizontalWallpaperOffset(a * oldHorizontalWallpaperOffset
|
||||
+ b * newHorizontalWallpaperOffset);
|
||||
setVerticalWallpaperOffset(a * oldVerticalWallpaperOffset
|
||||
+ b * newVerticalWallpaperOffset);
|
||||
}
|
||||
for (int i = 0; i < screenCount; i++) {
|
||||
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||
cl.fastInvalidate();
|
||||
|
@ -1995,9 +2008,11 @@ public class Workspace extends SmoothPagedView
|
|||
mAnimator.addListener(mUnshrinkAnimationListener);
|
||||
mAnimator.start();
|
||||
} else {
|
||||
setHorizontalWallpaperOffset(wallpaperOffsetForCurrentScroll());
|
||||
setVerticalWallpaperOffset(0.5f);
|
||||
updateWallpaperOffsetImmediately();
|
||||
if (enableWallpaperEffects) {
|
||||
setHorizontalWallpaperOffset(wallpaperOffsetForCurrentScroll());
|
||||
setVerticalWallpaperOffset(0.5f);
|
||||
updateWallpaperOffsetImmediately();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue