summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-07-24 13:55:41 -0700
committerAdam Cohen <adamcohen@google.com>2013-07-24 14:25:58 -0700
commit6ad0e7dcaeef394cc1c28294dde309da69233412 (patch)
tree598332d287e30afcde0d4c31392fcd34886cbf41 /src
parent390af56a31562cc7c42a719db4192d0cee0b0f9d (diff)
downloadandroid_packages_apps_Trebuchet-6ad0e7dcaeef394cc1c28294dde309da69233412.tar.gz
android_packages_apps_Trebuchet-6ad0e7dcaeef394cc1c28294dde309da69233412.tar.bz2
android_packages_apps_Trebuchet-6ad0e7dcaeef394cc1c28294dde309da69233412.zip
Fix overhang of custom content area into first screen of launcher
Change-Id: I2e8cbedb644c8399be269616e617851136489da5
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/PagedView.java8
-rw-r--r--src/com/android/launcher3/Workspace.java19
2 files changed, 15 insertions, 12 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index ed88ea90d..9a851ac36 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -833,6 +833,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
for (int i = startIndex; i != endIndex; i += delta) {
+
final View child = getPageAt(i);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
int childTop;
@@ -856,10 +857,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// We assume the left and right padding are equal, and hence center the pages
// horizontally
- int scrollOffset = false ? 0 : (getViewportWidth() - childWidth) / 2;
+ int scrollOffset = (getViewportWidth() - childWidth) / 2;
mPageScrolls[i] = childLeft - scrollOffset - offsetX;
- childLeft += childWidth + mPageSpacing;
+ if (i != endIndex - delta) {
+ int nextScrollOffset = (getViewportWidth() - getChildWidth(i + delta)) / 2;
+ childLeft += childWidth + nextScrollOffset;
+ }
}
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 985538cb2..91f539689 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -930,25 +930,25 @@ public class Workspace extends SmoothPagedView
stripEmptyScreens();
mStripScreensOnPageStopMoving = false;
}
- }
-
- @Override
- protected void notifyPageSwitchListener() {
- super.notifyPageSwitchListener();
- Launcher.setScreen(mCurrentPage);
- if (hasCustomContent() && mCurrentPage == 0) {
+ if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) {
mCustomContentShowing = true;
if (mCustomContentCallbacks != null) {
mCustomContentCallbacks.onShow();
}
- } else if (hasCustomContent() && mCustomContentShowing) {
+ } else if (hasCustomContent() && getNextPage() != 0 && mCustomContentShowing) {
mCustomContentShowing = false;
if (mCustomContentCallbacks != null) {
mCustomContentCallbacks.onHide();
mLauncher.resetQSBScroll();
}
}
+ }
+
+ @Override
+ protected void notifyPageSwitchListener() {
+ super.notifyPageSwitchListener();
+ Launcher.setScreen(mCurrentPage);
};
// As a ratio of screen height, the total distance we want the parallax effect to span
@@ -1303,11 +1303,9 @@ public class Workspace extends SmoothPagedView
private void updateStateForCustomContent(int screenCenter) {
if (hasCustomContent()) {
- CellLayout customContent = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
int index = mScreenOrder.indexOf(CUSTOM_CONTENT_SCREEN_ID);
int scrollDelta = getScrollForPage(index + 1) - getScrollX();
- float translationX = Math.max(scrollDelta, 0);
float progress = (1.0f * scrollDelta) /
(getScrollForPage(index + 1) - getScrollForPage(index));
@@ -1318,6 +1316,7 @@ public class Workspace extends SmoothPagedView
if (mLauncher.getHotseat() != null) {
mLauncher.getHotseat().setTranslationY(transY);
+ mLauncher.getHotseat().setAlpha(1 - progress);
}
if (getPageIndicator() != null) {
getPageIndicator().setAlpha(1 - progress);