summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2011-11-11 07:58:58 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-11 07:58:58 -0800
commitcb5679ca3e32e9020b5877f53d53fa91c1895de6 (patch)
treebf692567e61e73719eb9aabe9788bc01650d2928 /src
parentaaf41bcd841e8b1de39d770ebf9fa59399a7826b (diff)
parentceea1b9d40b80c5e24a12ae0374afc053dad09fb (diff)
downloadLegacyCamera-cb5679ca3e32e9020b5877f53d53fa91c1895de6.zip
LegacyCamera-cb5679ca3e32e9020b5877f53d53fa91c1895de6.tar.gz
LegacyCamera-cb5679ca3e32e9020b5877f53d53fa91c1895de6.tar.bz2
Merge "Fix sometimes share icons disappear." into ics-mr1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/ui/OneRowGridView.java26
-rw-r--r--src/com/android/camera/ui/SharePopup.java2
2 files changed, 17 insertions, 11 deletions
diff --git a/src/com/android/camera/ui/OneRowGridView.java b/src/com/android/camera/ui/OneRowGridView.java
index 5e37d35..2545f1c 100644
--- a/src/com/android/camera/ui/OneRowGridView.java
+++ b/src/com/android/camera/ui/OneRowGridView.java
@@ -16,28 +16,32 @@
package com.android.camera.ui;
-import com.android.camera.R;
-import com.android.camera.Util;
-
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;
public class OneRowGridView extends GridView {
+ private int mInternalRequestedColumnWidth;
public OneRowGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
+ public void setColumnWidth(int columnWidth) {
+ super.setColumnWidth(columnWidth);
+ if (mInternalRequestedColumnWidth != columnWidth) {
+ mInternalRequestedColumnWidth = columnWidth;
+ requestLayout();
+ }
+ }
+
+ @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- // Once we know the number of children in this view, we have to set
- // the correct width and height for containing the icons in one row.
- int n = getChildCount();
- if (n == 0) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- } else {
- setMeasuredDimension((n * getChildAt(0).getMeasuredWidth()),
- getMeasuredHeight());
+ if (mInternalRequestedColumnWidth != 0) {
+ int n = (getAdapter() == null) ? 0 : getAdapter().getCount();
+ int size = mInternalRequestedColumnWidth * n;
+ widthMeasureSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
}
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
diff --git a/src/com/android/camera/ui/SharePopup.java b/src/com/android/camera/ui/SharePopup.java
index c54a38b..43f3ae8 100644
--- a/src/com/android/camera/ui/SharePopup.java
+++ b/src/com/android/camera/ui/SharePopup.java
@@ -285,6 +285,8 @@ public class SharePopup extends PopupWindow implements View.OnClickListener,
// the view is measured.
if (mActivityOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
mShareList.setNumColumns(items.size());
+ int width = mContext.getResources().getDimensionPixelSize(R.dimen.share_item_width);
+ mShareList.setColumnWidth(width);
}
SimpleAdapter listItemAdapter = new MySimpleAdapter(mContext, items,