Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,13 @@ public void onGlobalLayout() {
final int numCount = width / desireSize;
final int columnSpace = getResources().getDimensionPixelOffset(R.dimen.space_size);
int columnWidth = (width - columnSpace*(numCount-1)) / numCount;

mGridView.setNumColumns(numCount);

mImageAdapter.setItemSize(columnWidth);



if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
mGridView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}else{
Expand Down Expand Up @@ -265,7 +270,7 @@ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
*/
private void createPopupFolderList(int width, int height) {
mFolderPopupWindow = new ListPopupWindow(getActivity());
mFolderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mFolderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
mFolderPopupWindow.setAdapter(mFolderAdapter);
mFolderPopupWindow.setContentWidth(width);
mFolderPopupWindow.setWidth(width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ public void setItemSize(int columnWidth) {
}

mItemSize = columnWidth;

mItemLayoutParams = new GridView.LayoutParams(mItemSize, mItemSize);

notifyDataSetChanged();
}

@Override
Expand Down Expand Up @@ -196,11 +192,6 @@ public View getView(int i, View view, ViewGroup viewGroup) {
}
}

/** Fixed View Size */
GridView.LayoutParams lp = (GridView.LayoutParams) view.getLayoutParams();
if(lp.height != mItemSize){
view.setLayoutParams(mItemLayoutParams);
}

return view;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package me.nereo.multi_image_selector.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

final class SquaredImageView extends ImageView {
public SquaredImageView(Context context) {
super(context);
}

public SquaredImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package me.nereo.multi_image_selector.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

final class SquaredLayout extends FrameLayout {
public SquaredLayout(Context context) {
super(context);
}

public SquaredLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
android:verticalSpacing="@dimen/space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false"
android:numColumns="auto_fit"
android:columnWidth="@dimen/image_size"/>
/>

<TextView
android:id="@+id/timeline_area"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
android:verticalSpacing="@dimen/space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false"
android:numColumns="auto_fit"
android:columnWidth="@dimen/image_size"/>
/>

<TextView
android:id="@+id/timeline_area"
Expand Down
4 changes: 2 additions & 2 deletions multi-image-selector/src/main/res/layout/list_item_camera.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<me.nereo.multi_image_selector.view.SquaredLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#343535"
android:layout_width="match_parent" android:layout_height="match_parent">

Expand All @@ -14,4 +14,4 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</FrameLayout>
</me.nereo.multi_image_selector.view.SquaredLayout>
3 changes: 1 addition & 2 deletions multi-image-selector/src/main/res/layout/list_item_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">

<ImageView
<me.nereo.multi_image_selector.view.SquaredImageView
android:id="@+id/image"
android:scaleType="centerInside"
android:src="@drawable/default_error"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down