Fixing boot stall.
Revert "-Added 3D effect to home screen scrolling"
This reverts commit 9415d87eda.
Change-Id: Ib8d6602f5d82884eb1f6cc44c0cc71cc563a3a59
This commit is contained in:
1 parent
de7658b5e0
commit
0fb7db5a37
8 files changed
+122
-261
No files matched your search
@@ -21,17 +21,18 @@ import com.android.launcher.R;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
|
||||
public class DimmableBubbleTextView extends BubbleTextView {
|
||||
private Paint mDimmedPaint = new Paint();
|
||||
private int mAlpha;
|
||||
private int mDimmedAlpha;
|
||||
private Bitmap mDimmedView;
|
||||
private Canvas mDimmedViewCanvas;
|
||||
private boolean isDimmedViewUpdatePass;
|
||||
private float mDimmableProgress;
|
||||
|
||||
public DimmableBubbleTextView(Context context) {
|
||||
super(context);
|
||||
@@ -48,12 +49,48 @@ public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
|
||||
mDimmedPaint.setFilterBitmap(true);
|
||||
}
|
||||
|
||||
public void setDimmableProgress(float progress) {
|
||||
mDimmableProgress = progress;
|
||||
private static float cubic(float r) {
|
||||
return (float) (Math.pow(r-1, 3) + 1);
|
||||
}
|
||||
|
||||
public float getDimmableProgress() {
|
||||
return mDimmableProgress;
|
||||
/**
|
||||
* Returns the interpolated holographic highlight alpha for the effect we want when scrolling
|
||||
* pages.
|
||||
*/
|
||||
public static float highlightAlphaInterpolator(float r) {
|
||||
final float pivot = 0.3f;
|
||||
if (r < pivot) {
|
||||
return Math.max(0.5f, 0.65f*cubic(r/pivot));
|
||||
} else {
|
||||
return Math.min(1.0f, 0.65f*cubic(1 - (r-pivot)/(1-pivot)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the interpolated view alpha for the effect we want when scrolling pages.
|
||||
*/
|
||||
public static float viewAlphaInterpolator(float r) {
|
||||
final float pivot = 0.6f;
|
||||
if (r < pivot) {
|
||||
return r/pivot;
|
||||
} else {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSetAlpha(int alpha) {
|
||||
super.onSetAlpha(alpha);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
final float viewAlpha = viewAlphaInterpolator(alpha);
|
||||
final float dimmedAlpha = highlightAlphaInterpolator(alpha);
|
||||
mAlpha = (int) (viewAlpha * 255);
|
||||
mDimmedAlpha = (int) (dimmedAlpha * 255);
|
||||
super.setAlpha(viewAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,11 +124,13 @@ public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
|
||||
super.setAlpha(alpha);
|
||||
canvas.restore();
|
||||
} else {
|
||||
super.onDraw(canvas);
|
||||
if (mAlpha > 0) {
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
if (mDimmedView != null && mDimmableProgress > 0) {
|
||||
mDimmedPaint.setAlpha((int) (mDimmableProgress * 255));
|
||||
if (mDimmedView != null && mDimmedAlpha > 0) {
|
||||
mDimmedPaint.setAlpha(mDimmedAlpha);
|
||||
canvas.drawBitmap(mDimmedView, mScrollX, mScrollY, mDimmedPaint);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user