am 5c503f44: am a276072d: am e5f3bedf: am 953498c6: Merge "Don\'t crash when the MiniDrawerView is too short" into ub-gmail-ur14-dev
* commit '5c503f44802e796677628c0d393ab9cb133c5d21':
Don't crash when the MiniDrawerView is too short
diff --git a/src/com/android/mail/ui/MiniDrawerView.java b/src/com/android/mail/ui/MiniDrawerView.java
index 53cfa32..4ebe641 100644
--- a/src/com/android/mail/ui/MiniDrawerView.java
+++ b/src/com/android/mail/ui/MiniDrawerView.java
@@ -181,6 +181,19 @@
}
@Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ // We want to make sure that all children get measured. These will be re-hidden in onLayout
+ // according to space constraints.
+ // This means we can't set views to Gone elsewhere, which is kind of unfortunate.
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+ child.setVisibility(View.VISIBLE);
+ }
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (getChildCount() == 0) {
return;
@@ -220,8 +233,9 @@
// Sanity check
if (getChildAt(getChildCount() - 1).equals(mSpacer)) {
- LogUtils.wtf(LogUtils.TAG, "The ellipsis was the last item in the minidrawer and " +
+ LogUtils.v(LogUtils.TAG, "The ellipsis was the last item in the minidrawer and " +
"hiding it didn't help fit all the views");
+ return;
}
final View childToHide = getChildAt(indexOfChild(mSpacer) + 1);
@@ -239,9 +253,8 @@
return;
}
- LogUtils.wtf(LogUtils.TAG,
- "Hid two children in the minidrawer and still couldn't fit " +
- "all the views");
+ LogUtils.v(LogUtils.TAG, "Hid two children in the minidrawer and still couldn't fit " +
+ "all the views");
}
private void measureSpacer(int height) {