diff options
| author | 2011-08-16 15:04:53 -0700 | |
|---|---|---|
| committer | 2011-08-16 15:05:09 -0700 | |
| commit | 3bb421d5b85a8a99c408d16e4f80163a53bc0505 (patch) | |
| tree | d97c78a00fdc416be99d287b0517bb5fd6540825 | |
| parent | e91e745254859110af8bff23d60666d6ce80f668 (diff) | |
Fix bug 5165771 - Gmail: crash on launch from notifier
Change-Id: Iec9c189bd3fa5e62bc8eb520ca2a1dd4db106036
| -rw-r--r-- | core/java/com/android/internal/view/menu/ActionMenuView.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/com/android/internal/view/menu/ActionMenuView.java b/core/java/com/android/internal/view/menu/ActionMenuView.java index 267221bec8a4..d6139218e3d0 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuView.java @@ -109,6 +109,13 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo // Divide the view into cells. final int cellCount = widthSize / mMinCellSize; final int cellSizeRemaining = widthSize % mMinCellSize; + + if (cellCount == 0) { + // Give up, nothing fits. + setMeasuredDimension(widthSize, 0); + return; + } + final int cellSize = mMinCellSize + cellSizeRemaining / cellCount; int cellsRemaining = cellCount; @@ -213,7 +220,8 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo } } - final int extraPixels = (int) (cellsRemaining * cellSize / expandCount); + final int extraPixels = expandCount > 0 ? + (int) (cellsRemaining * cellSize / expandCount) : 0; for (int i = 0; i < childCount; i++) { if ((smallestItemsAt & (1 << i)) == 0) continue; |