Merge "Rename first page pinned widget to mFirstPagePinnedWidget" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f748755a4f
@@ -224,8 +224,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
// Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget)
|
||||
private float mXDown;
|
||||
private float mYDown;
|
||||
private View mQsb;
|
||||
private boolean mIsEventOverQsb;
|
||||
private View mFirstPagePinnedItem;
|
||||
private boolean mIsEventOverFirstPagePinnedItem;
|
||||
|
||||
final static float START_DAMPING_TOUCH_SLOP_ANGLE = (float) Math.PI / 6;
|
||||
final static float MAX_SWIPE_ANGLE = (float) Math.PI / 3;
|
||||
@@ -575,20 +575,22 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
// Add the first page
|
||||
CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, getChildCount());
|
||||
// Always add a QSB on the first screen.
|
||||
if (mQsb == null) {
|
||||
// In transposed layout, we add the QSB in the Grid. As workspace does not touch the
|
||||
// edges, we do not need a full width QSB.
|
||||
mQsb = LayoutInflater.from(getContext())
|
||||
// Always add a first page pinned widget on the first screen.
|
||||
if (mFirstPagePinnedItem == null) {
|
||||
// In transposed layout, we add the first page pinned widget in the Grid.
|
||||
// As workspace does not touch the edges, we do not need a full
|
||||
// width first page pinned widget.
|
||||
mFirstPagePinnedItem = LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.search_container_workspace, firstPage, false);
|
||||
}
|
||||
|
||||
int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1);
|
||||
lp.canReorder = false;
|
||||
if (!firstPage.addViewToCellLayout(mQsb, 0, R.id.search_container_workspace, lp, true)) {
|
||||
if (!firstPage.addViewToCellLayout(
|
||||
mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) {
|
||||
Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");
|
||||
mQsb = null;
|
||||
mFirstPagePinnedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,9 +599,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
// transition animations competing with us changing the scroll when we add pages
|
||||
disableLayoutTransitions();
|
||||
|
||||
// Recycle the QSB widget
|
||||
if (mQsb != null) {
|
||||
((ViewGroup) mQsb.getParent()).removeView(mQsb);
|
||||
// Recycle the first page pinned widget
|
||||
if (mFirstPagePinnedItem != null) {
|
||||
((ViewGroup) mFirstPagePinnedItem.getParent()).removeView(mFirstPagePinnedItem);
|
||||
}
|
||||
|
||||
// Remove the pages and clear the screen models
|
||||
@@ -919,8 +921,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
return mScreenOrder;
|
||||
}
|
||||
|
||||
protected View getQsb() {
|
||||
return mQsb;
|
||||
protected View getFirstPagePinnedItem() {
|
||||
return mFirstPagePinnedItem;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1074,20 +1076,22 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
mXDown = ev.getX();
|
||||
mYDown = ev.getY();
|
||||
if (mQsb != null) {
|
||||
if (mFirstPagePinnedItem != null) {
|
||||
mTempFXY[0] = mXDown + getScrollX();
|
||||
mTempFXY[1] = mYDown + getScrollY();
|
||||
Utilities.mapCoordInSelfToDescendant(mQsb, this, mTempFXY);
|
||||
mIsEventOverQsb = mQsb.getLeft() <= mTempFXY[0] && mQsb.getRight() >= mTempFXY[0]
|
||||
&& mQsb.getTop() <= mTempFXY[1] && mQsb.getBottom() >= mTempFXY[1];
|
||||
Utilities.mapCoordInSelfToDescendant(mFirstPagePinnedItem, this, mTempFXY);
|
||||
mIsEventOverFirstPagePinnedItem = mFirstPagePinnedItem.getLeft() <= mTempFXY[0]
|
||||
&& mFirstPagePinnedItem.getRight() >= mTempFXY[0]
|
||||
&& mFirstPagePinnedItem.getTop() <= mTempFXY[1]
|
||||
&& mFirstPagePinnedItem.getBottom() >= mTempFXY[1];
|
||||
} else {
|
||||
mIsEventOverQsb = false;
|
||||
mIsEventOverFirstPagePinnedItem = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void determineScrollingStart(MotionEvent ev) {
|
||||
if (!isFinishedSwitchingState() || mIsEventOverQsb) return;
|
||||
if (!isFinishedSwitchingState() || mIsEventOverFirstPagePinnedItem) return;
|
||||
|
||||
float deltaX = ev.getX() - mXDown;
|
||||
float absDeltaX = Math.abs(deltaX);
|
||||
@@ -2538,10 +2542,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
|
||||
private boolean isDragObjectOverSmartSpace(DragObject dragObject) {
|
||||
if (mQsb == null) {
|
||||
if (mFirstPagePinnedItem == null) {
|
||||
return false;
|
||||
}
|
||||
getViewBoundsRelativeToWorkspace(mQsb, mTempRect);
|
||||
getViewBoundsRelativeToWorkspace(mFirstPagePinnedItem, mTempRect);
|
||||
return mTempRect.contains(dragObject.x, dragObject.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ import com.android.systemui.plugins.ResourceProvider;
|
||||
*/
|
||||
public class WorkspaceStateTransitionAnimation {
|
||||
|
||||
private static final float QSB_DISABLED_ALPHA = 0.3f;
|
||||
private static final float FIRST_PAGE_PINNED_WIDGET_DISABLED_ALPHA = 0.3f;
|
||||
|
||||
private static final FloatProperty<Workspace<?>> WORKSPACE_SCALE_PROPERTY =
|
||||
WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WORKSPACE_STATE);
|
||||
@@ -161,12 +161,12 @@ public class WorkspaceStateTransitionAnimation {
|
||||
|
||||
if (SHOW_HOME_GARDENING.get()) {
|
||||
propertySetter.setViewAlpha(
|
||||
mWorkspace.getQsb(),
|
||||
state == SPRING_LOADED ? QSB_DISABLED_ALPHA : 1,
|
||||
mWorkspace.getFirstPagePinnedItem(),
|
||||
state == SPRING_LOADED ? FIRST_PAGE_PINNED_WIDGET_DISABLED_ALPHA : 1,
|
||||
workspaceFadeInterpolator);
|
||||
propertySetter.addEndListener(success -> {
|
||||
if (success) {
|
||||
mWorkspace.getQsb().setClickable(state != SPRING_LOADED);
|
||||
mWorkspace.getFirstPagePinnedItem().setClickable(state != SPRING_LOADED);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user