summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/LinearLayout.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-07-01 13:43:49 -0700
committerAdam Powell <adamp@google.com>2011-07-06 16:30:38 -0700
commit35aecd5884a5ccfe380903e39f30f468315e8f92 (patch)
treee2f3c25ae59129d8f63a4bcf186d4fc870b13d4d /core/java/android/widget/LinearLayout.java
parent6f2e4d1021fc5f453c025ec00a17bbb071b6e7f5 (diff)
downloadframeworks_base-35aecd5884a5ccfe380903e39f30f468315e8f92.zip
frameworks_base-35aecd5884a5ccfe380903e39f30f468315e8f92.tar.gz
frameworks_base-35aecd5884a5ccfe380903e39f30f468315e8f92.tar.bz2
Updates for action menus
Sync with UX designs for action menus in split action bar mode. Layout is now based on a grid cell scheme. Tweak action menu item layouts. Fix some bugs with drawing LinearLayout dividers. Rename config resources to follow convention. Action bar menu items now show text in ALL CAPS. This is done in a locale-dependent manner, but if it produces problems in specific locales the config resource config_actionMenuItemAllCaps should be set to false for that locale. Change-Id: I064c2dd85e012e89551f29153efcfc17f9106333
Diffstat (limited to 'core/java/android/widget/LinearLayout.java')
-rw-r--r--core/java/android/widget/LinearLayout.java42
1 files changed, 24 insertions, 18 deletions
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index fc8bce8..427fd3e 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -301,49 +301,55 @@ public class LinearLayout extends ViewGroup {
void drawDividersVertical(Canvas canvas) {
final int count = getVirtualChildCount();
- int top = getPaddingTop();
for (int i = 0; i < count; i++) {
final View child = getVirtualChildAt(i);
- if (child == null) {
- top += measureNullChild(i);
- } else if (child.getVisibility() != GONE) {
+ if (child != null && child.getVisibility() != GONE) {
if (hasDividerBeforeChildAt(i)) {
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ final int top = child.getTop() - lp.topMargin;
drawHorizontalDivider(canvas, top);
- top += mDividerHeight;
}
-
- LayoutParams lp = (LayoutParams) child.getLayoutParams();
- top += lp.topMargin + child.getHeight() + lp.bottomMargin;
}
}
if (hasDividerBeforeChildAt(count)) {
- drawHorizontalDivider(canvas, top);
+ final View child = getVirtualChildAt(count - 1);
+ int bottom = 0;
+ if (child == null) {
+ bottom = getHeight() - getPaddingBottom() - mDividerHeight;
+ } else {
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ bottom = child.getBottom() + lp.bottomMargin;
+ }
+ drawHorizontalDivider(canvas, bottom);
}
}
void drawDividersHorizontal(Canvas canvas) {
final int count = getVirtualChildCount();
- int left = getPaddingLeft();
for (int i = 0; i < count; i++) {
final View child = getVirtualChildAt(i);
- if (child == null) {
- left += measureNullChild(i);
- } else if (child.getVisibility() != GONE) {
+ if (child != null && child.getVisibility() != GONE) {
if (hasDividerBeforeChildAt(i)) {
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ final int left = child.getLeft() - lp.leftMargin;
drawVerticalDivider(canvas, left);
- left += mDividerWidth;
}
-
- LayoutParams lp = (LayoutParams) child.getLayoutParams();
- left += lp.leftMargin + child.getWidth() + lp.rightMargin;
}
}
if (hasDividerBeforeChildAt(count)) {
- drawVerticalDivider(canvas, left);
+ final View child = getVirtualChildAt(count - 1);
+ int right = 0;
+ if (child == null) {
+ right = getWidth() - getPaddingRight() - mDividerWidth;
+ } else {
+ final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ right = child.getRight() + lp.rightMargin;
+ }
+ drawVerticalDivider(canvas, right);
}
}