diff options
Diffstat (limited to 'src/com/android/camera')
-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, |