mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Fix bug 2258128 - homescreen on Passion unresponsive while still not leaking the contexts.
This commit is contained in:
@@ -116,6 +116,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
private boolean mZoomDirty = false;
|
||||
private float mNextZoom;
|
||||
private boolean mNextAnimate;
|
||||
AAMessage mMessageProc;
|
||||
|
||||
static class Defines {
|
||||
public static final int ALLOC_PARAMS = 0;
|
||||
@@ -207,6 +208,8 @@ public class AllAppsView extends RSSurfaceView
|
||||
mRollo.dirtyCheck();
|
||||
}
|
||||
|
||||
mRS.mMessageCallback = mMessageProc = new AAMessage();
|
||||
|
||||
Resources res = getContext().getResources();
|
||||
int barHeight = (int)res.getDimension(R.dimen.button_bar_height);
|
||||
|
||||
@@ -228,7 +231,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
if (mRollo.mState.iconCount > 0) {
|
||||
if (mLastSelection == SELECTION_ICONS) {
|
||||
int selection = mLastSelectedIcon;
|
||||
final int firstIcon = Math.round(mRollo.mMessageProc.mPosX) *
|
||||
final int firstIcon = Math.round(mMessageProc.mPosX) *
|
||||
Defines.COLUMNS_PER_PAGE;
|
||||
if (selection < 0 || // No selection
|
||||
selection < firstIcon || // off the top of the screen
|
||||
@@ -283,7 +286,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
|
||||
// Select the first icon when we gain keyboard focus
|
||||
mArrowNavigation = true;
|
||||
mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,
|
||||
mRollo.selectIcon(Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,
|
||||
SELECTED_FOCUSED);
|
||||
mRollo.mState.save();
|
||||
}
|
||||
@@ -319,7 +322,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
mArrowNavigation = true;
|
||||
|
||||
int currentSelection = mRollo.mState.selectedIconIndex;
|
||||
int currentTopRow = Math.round(mRollo.mMessageProc.mPosX);
|
||||
int currentTopRow = Math.round(mMessageProc.mPosX);
|
||||
|
||||
// The column of the current selection, in the range 0..COLUMNS_PER_PAGE-1
|
||||
final int currentPageCol = currentSelection % Defines.COLUMNS_PER_PAGE;
|
||||
@@ -448,7 +451,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
mRollo.clearSelectedIcon();
|
||||
} else {
|
||||
mDownIconIndex = mCurrentIconIndex
|
||||
= mRollo.selectIcon(x, y, mRollo.mMessageProc.mPosX, SELECTED_PRESSED);
|
||||
= mRollo.selectIcon(x, y, mMessageProc.mPosX, SELECTED_PRESSED);
|
||||
if (mDownIconIndex < 0) {
|
||||
// if nothing was selected, no long press.
|
||||
cancelLongPress();
|
||||
@@ -476,7 +479,7 @@ public class AllAppsView extends RSSurfaceView
|
||||
if (!mStartedScrolling && slop < mSlop) {
|
||||
// don't update anything so when we do start scrolling
|
||||
// below, we get the right delta.
|
||||
mCurrentIconIndex = mRollo.chooseTappedIcon(x, y, mRollo.mMessageProc.mPosX);
|
||||
mCurrentIconIndex = mRollo.chooseTappedIcon(x, y, mMessageProc.mPosX);
|
||||
if (mDownIconIndex != mCurrentIconIndex) {
|
||||
// If a different icon is selected, don't allow it to be picked up.
|
||||
// This handles off-axis dragging.
|
||||
@@ -634,10 +637,10 @@ public class AllAppsView extends RSSurfaceView
|
||||
if (mZoomDirty) {
|
||||
return mNextZoom > 0.001f;
|
||||
} else {
|
||||
if (mRollo == null) {
|
||||
if (mMessageProc == null) {
|
||||
return false;
|
||||
} else {
|
||||
return mRollo.mMessageProc.mZoom > 0.001f;
|
||||
return mMessageProc.mZoom > 0.001f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,10 +649,10 @@ public class AllAppsView extends RSSurfaceView
|
||||
if (mZoomDirty) {
|
||||
return mNextZoom > 0.999f;
|
||||
} else {
|
||||
if (mRollo == null) {
|
||||
if (mMessageProc == null) {
|
||||
return false;
|
||||
} else {
|
||||
return mRollo.mMessageProc.mZoom > 0.999f;
|
||||
return mMessageProc.mZoom > 0.999f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -755,6 +758,18 @@ public class AllAppsView extends RSSurfaceView
|
||||
return pages;
|
||||
}
|
||||
|
||||
class AAMessage extends RenderScript.RSMessage {
|
||||
public void run() {
|
||||
mPosX = ((float)mData[0]) / (1 << 16);
|
||||
mVelocity = ((float)mData[1]) / (1 << 16);
|
||||
mZoom = ((float)mData[2]) / (1 << 16);
|
||||
mZoomDirty = false;
|
||||
}
|
||||
float mZoom;
|
||||
float mPosX;
|
||||
float mVelocity;
|
||||
}
|
||||
|
||||
public class RolloRS {
|
||||
|
||||
// Allocations ======
|
||||
@@ -813,18 +828,6 @@ public class AllAppsView extends RSSurfaceView
|
||||
}
|
||||
}
|
||||
|
||||
class AAMessage extends RenderScript.RSMessage {
|
||||
public void run() {
|
||||
mPosX = ((float)mData[0]) / (1 << 16);
|
||||
mVelocity = ((float)mData[1]) / (1 << 16);
|
||||
mZoom = ((float)mData[2]) / (1 << 16);
|
||||
}
|
||||
float mZoom;
|
||||
float mPosX;
|
||||
float mVelocity;
|
||||
}
|
||||
AAMessage mMessageProc;
|
||||
|
||||
private boolean checkClickOK() {
|
||||
return (Math.abs(mMessageProc.mVelocity) < 0.4f) &&
|
||||
(Math.abs(mMessageProc.mPosX - Math.round(mMessageProc.mPosX)) < 0.4f);
|
||||
@@ -1047,8 +1050,6 @@ public class AllAppsView extends RSSurfaceView
|
||||
mScript.bindAllocation(mAllocIconIds, Defines.ALLOC_ICON_IDS);
|
||||
mScript.bindAllocation(mAllocLabelIds, Defines.ALLOC_LABEL_IDS);
|
||||
|
||||
mMessageProc = new AAMessage();
|
||||
mRS.mMessageCallback = mMessageProc;
|
||||
mRS.contextBindRootScript(mScript);
|
||||
}
|
||||
|
||||
@@ -1067,7 +1068,6 @@ public class AllAppsView extends RSSurfaceView
|
||||
}
|
||||
if (mZoomDirty) {
|
||||
setZoom(mNextZoom, mNextAnimate);
|
||||
mZoomDirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user