diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-11-11 16:51:23 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-11-11 18:23:58 +0800 |
commit | ceea1b9d40b80c5e24a12ae0374afc053dad09fb (patch) | |
tree | b033caca05ef0fe687921618b374d3f7c8a27872 /src | |
parent | 450396c1c56565c8b9ec1ccafbdd36de2d6ce313 (diff) | |
download | LegacyCamera-ceea1b9d40b80c5e24a12ae0374afc053dad09fb.zip LegacyCamera-ceea1b9d40b80c5e24a12ae0374afc053dad09fb.tar.gz LegacyCamera-ceea1b9d40b80c5e24a12ae0374afc053dad09fb.tar.bz2 |
Fix sometimes share icons disappear.
bug:5580133
Change-Id: I4f76ac8d03a54cfd7105e70ca4f1d643e01d3293
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ui/OneRowGridView.java | 26 | ||||
-rw-r--r-- | src/com/android/camera/ui/SharePopup.java | 2 |
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 134b7c0..b4b0462 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, if (((Activity) mContext).getRequestedOrientation() == 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, |