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
This commit is contained in:
Winson Chung
2010-10-12 17:49:56 -07:00
parent f93a49422b
commit b0b2e6f588
11 changed files with 184 additions and 11 deletions
+12
View File
@@ -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();
}
}