diff options
author | Winson Chung <winsonc@google.com> | 2010-10-12 17:49:56 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2010-10-12 18:27:22 -0700 |
commit | b0b2e6f588367cf40a4270cca81af7d78f8e382e (patch) | |
tree | 62abbbdfee693ee344eecd407df0c97d62062b60 /src/com | |
parent | f93a49422ba1516492a29f0563285d06d079404e (diff) | |
download | packages_apps_trebuchet-b0b2e6f588367cf40a4270cca81af7d78f8e382e.zip packages_apps_trebuchet-b0b2e6f588367cf40a4270cca81af7d78f8e382e.tar.gz packages_apps_trebuchet-b0b2e6f588367cf40a4270cca81af7d78f8e382e.tar.bz2 |
Tweaking spacing and layout of AllApps/Customize in portrait.
- Also added workaround for tab label not being initially selected
- Added fix for initial layout of PagedViews preventing side pages from having proper alpha
- Marking widget dims format string as not translatable
Change-Id: I74a5410b88e2766816a87b14e64058b4288c214d
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 12 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 6 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 368306f..aff8ddd 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -127,6 +127,9 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { } }); + // TEMP: Working around a bug in tab host where the current tab does not initially have a + // highlight on it by selecting something else, then selecting the actual tab we want.. + setCurrentTab(1); setCurrentTab(0); // It needs to be INVISIBLE so that it will be measured in the layout. diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 989ee25..d7c2f5b 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -350,6 +350,9 @@ public final class Launcher extends Activity } }); + // TEMP: Working around a bug in tab host where the current tab does not initially have + // a highlight on it by selecting something else, then selecting the actual tab we want.. + mHomeCustomizationDrawer.setCurrentTab(1); mHomeCustomizationDrawer.setCurrentTab(0); } setupViews(); diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 8332053..97bbbdf 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -406,6 +406,14 @@ public abstract class PagedView extends ViewGroup { int halfChildWidth = (childWidth / 2); int childCenter = getChildOffset(i) + halfChildWidth; + // On the first layout, we may not have a width nor a proper offset, so for now + // we should just assume full page width (and calculate the offset according to + // that). + if (childWidth <= 0) { + childWidth = getMeasuredWidth(); + childCenter = (i * childWidth) + (childWidth / 2); + } + int d = halfChildWidth; int distanceFromScreenCenter = childCenter - screenCenter; if (distanceFromScreenCenter > 0) { @@ -419,6 +427,9 @@ public abstract class PagedView extends ViewGroup { } d += mPageSpacing; + // Preventing potential divide-by-zero + d = Math.max(1, d); + float dimAlpha = (float) (Math.abs(distanceFromScreenCenter)) / d; dimAlpha = Math.max(0.0f, Math.min(1.0f, (dimAlpha * dimAlpha))); float alpha = 1.0f - dimAlpha; @@ -1237,6 +1248,7 @@ public abstract class PagedView extends ViewGroup { // Load any pages that are necessary for the current window of views loadAssociatedPages(mCurrentPage); mDirtyPageAlpha = true; + updateAdjacentPagesAlpha(); requestLayout(); } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index ac5c1b9..0d07048 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -717,8 +717,10 @@ public class Workspace extends SmoothPagedView finalAlpha = 0.0f; extraShrinkFactor = 0.1f; } else if (shrinkPosition == ShrinkPosition.SHRINK_TO_MIDDLE) { - newY = screenHeight / 2 - scaledPageHeight / 2; - finalAlpha = 1.0f; + newY = screenHeight / 2 - scaledPageHeight / 2; + finalAlpha = 1.0f; + } else if (shrinkPosition == ShrinkPosition.SHRINK_TO_TOP) { + newY = screenHeight / 10; } // We animate all the screens to the centered position in workspace |