Merge "Prevent Recents from doing a relayout" into jb-mr2-dev
This commit is contained in:
@@ -41,7 +41,8 @@
|
||||
android:fadingEdge="horizontal"
|
||||
android:scrollbars="none"
|
||||
android:layout_gravity="right"
|
||||
android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length">
|
||||
android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout android:id="@+id/recents_linear_layout"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
android:clipChildren="false"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout android:id="@+id/recents_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
android:fadingEdgeLength="20dip"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
android:clipChildren="false"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout android:id="@+id/recents_linear_layout"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -177,6 +177,7 @@ public class RecentsActivity extends Activity {
|
||||
setContentView(R.layout.status_bar_recent_panel);
|
||||
mRecentsPanel = (RecentsPanelView) findViewById(R.id.recents_root);
|
||||
mRecentsPanel.setOnTouchListener(new TouchOutsideListener(mRecentsPanel));
|
||||
mRecentsPanel.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
|
||||
final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
|
||||
recentTasksLoader.setRecentsPanel(mRecentsPanel, mRecentsPanel);
|
||||
|
||||
@@ -256,7 +256,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
|
||||
mPerformanceHelper.drawCallback(canvas,
|
||||
left, right, top, bottom, mScrollX, mScrollY,
|
||||
0, 0,
|
||||
getLeftFadingEdgeStrength(), getRightFadingEdgeStrength());
|
||||
getLeftFadingEdgeStrength(), getRightFadingEdgeStrength(), mPaddingTop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,10 @@ public class RecentsScrollViewPerformanceHelper {
|
||||
private int mFadingEdgeLength;
|
||||
private boolean mIsVertical;
|
||||
private boolean mSoftwareRendered = false;
|
||||
private Paint mBlackPaint;
|
||||
private Paint mFadePaint;
|
||||
private Matrix mFadeMatrix;
|
||||
private LinearGradient mFade;
|
||||
|
||||
public static RecentsScrollViewPerformanceHelper create(Context context,
|
||||
AttributeSet attrs, View scrollView, boolean isVertical) {
|
||||
@@ -81,18 +85,19 @@ public class RecentsScrollViewPerformanceHelper {
|
||||
public void drawCallback(Canvas canvas,
|
||||
int left, int right, int top, int bottom, int scrollX, int scrollY,
|
||||
float topFadingEdgeStrength, float bottomFadingEdgeStrength,
|
||||
float leftFadingEdgeStrength, float rightFadingEdgeStrength) {
|
||||
float leftFadingEdgeStrength, float rightFadingEdgeStrength, int mPaddingTop) {
|
||||
|
||||
if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
|
||||
|| USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
|
||||
Paint p = new Paint();
|
||||
Matrix matrix = new Matrix();
|
||||
// use use a height of 1, and then wack the matrix each time we
|
||||
// actually use it.
|
||||
Shader fade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
|
||||
// PULL OUT THIS CONSTANT
|
||||
|
||||
p.setShader(fade);
|
||||
if (mFadePaint == null) {
|
||||
mFadePaint = new Paint();
|
||||
mFadeMatrix = new Matrix();
|
||||
// use use a height of 1, and then wack the matrix each time we
|
||||
// actually use it.
|
||||
mFade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
|
||||
// PULL OUT THIS CONSTANT
|
||||
mFadePaint.setShader(mFade);
|
||||
}
|
||||
|
||||
// draw the fade effect
|
||||
boolean drawTop = false;
|
||||
@@ -134,34 +139,41 @@ public class RecentsScrollViewPerformanceHelper {
|
||||
}
|
||||
|
||||
if (drawTop) {
|
||||
matrix.setScale(1, fadeHeight * topFadeStrength);
|
||||
matrix.postTranslate(left, top);
|
||||
fade.setLocalMatrix(matrix);
|
||||
canvas.drawRect(left, top, right, top + length, p);
|
||||
mFadeMatrix.setScale(1, fadeHeight * topFadeStrength);
|
||||
mFadeMatrix.postTranslate(left, top);
|
||||
mFade.setLocalMatrix(mFadeMatrix);
|
||||
canvas.drawRect(left, top, right, top + length, mFadePaint);
|
||||
|
||||
if (mBlackPaint == null) {
|
||||
// Draw under the status bar at the top
|
||||
mBlackPaint = new Paint();
|
||||
mBlackPaint.setColor(0xFF000000);
|
||||
}
|
||||
canvas.drawRect(left, top - mPaddingTop, right, top, mBlackPaint);
|
||||
}
|
||||
|
||||
if (drawBottom) {
|
||||
matrix.setScale(1, fadeHeight * bottomFadeStrength);
|
||||
matrix.postRotate(180);
|
||||
matrix.postTranslate(left, bottom);
|
||||
fade.setLocalMatrix(matrix);
|
||||
canvas.drawRect(left, bottom - length, right, bottom, p);
|
||||
mFadeMatrix.setScale(1, fadeHeight * bottomFadeStrength);
|
||||
mFadeMatrix.postRotate(180);
|
||||
mFadeMatrix.postTranslate(left, bottom);
|
||||
mFade.setLocalMatrix(mFadeMatrix);
|
||||
canvas.drawRect(left, bottom - length, right, bottom, mFadePaint);
|
||||
}
|
||||
|
||||
if (drawLeft) {
|
||||
matrix.setScale(1, fadeHeight * leftFadeStrength);
|
||||
matrix.postRotate(-90);
|
||||
matrix.postTranslate(left, top);
|
||||
fade.setLocalMatrix(matrix);
|
||||
canvas.drawRect(left, top, left + length, bottom, p);
|
||||
mFadeMatrix.setScale(1, fadeHeight * leftFadeStrength);
|
||||
mFadeMatrix.postRotate(-90);
|
||||
mFadeMatrix.postTranslate(left, top);
|
||||
mFade.setLocalMatrix(mFadeMatrix);
|
||||
canvas.drawRect(left, top, left + length, bottom, mFadePaint);
|
||||
}
|
||||
|
||||
if (drawRight) {
|
||||
matrix.setScale(1, fadeHeight * rightFadeStrength);
|
||||
matrix.postRotate(90);
|
||||
matrix.postTranslate(right, top);
|
||||
fade.setLocalMatrix(matrix);
|
||||
canvas.drawRect(right - length, top, right, bottom, p);
|
||||
mFadeMatrix.setScale(1, fadeHeight * rightFadeStrength);
|
||||
mFadeMatrix.postRotate(90);
|
||||
mFadeMatrix.postTranslate(right, top);
|
||||
mFade.setLocalMatrix(mFadeMatrix);
|
||||
canvas.drawRect(right - length, top, right, bottom, mFadePaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.FloatMath;
|
||||
@@ -68,7 +69,7 @@ public class RecentsVerticalScrollView extends ScrollView
|
||||
}
|
||||
|
||||
private int scrollPositionOfMostRecent() {
|
||||
return mLinearLayout.getHeight() - getHeight();
|
||||
return mLinearLayout.getHeight() - getHeight() + mPaddingTop;
|
||||
}
|
||||
|
||||
private void addToRecycledViews(View v) {
|
||||
@@ -265,7 +266,7 @@ public class RecentsVerticalScrollView extends ScrollView
|
||||
mPerformanceHelper.drawCallback(canvas,
|
||||
left, right, top, bottom, mScrollX, mScrollY,
|
||||
getTopFadingEdgeStrength(), getBottomFadingEdgeStrength(),
|
||||
0, 0);
|
||||
0, 0, mPaddingTop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user