From: tobiasKaminsky Date: Wed, 17 Sep 2014 15:21:26 +0000 (+0200) Subject: 3row Grid X-Git-Tag: oc-android-1.7.0_signed~16^2~36 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/3cab2038a375dd594ed12b55e55a0447d24ab777?ds=sidebyside;hp=--cc 3row Grid --- 3cab2038a375dd594ed12b55e55a0447d24ab777 diff --git a/res/layout/grid_image.xml b/res/layout/grid_image.xml index a9fe863f..ffeafcb5 100644 --- a/res/layout/grid_image.xml +++ b/res/layout/grid_image.xml @@ -15,36 +15,32 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . --> + android:gravity="center_horizontal" + android:orientation="vertical" > - - - @@ -115,4 +111,11 @@ android:textSize="12dip" /> + + \ No newline at end of file diff --git a/res/layout/grid_item.xml b/res/layout/grid_item.xml index 5c35c62c..9d7d7192 100644 --- a/res/layout/grid_item.xml +++ b/res/layout/grid_item.xml @@ -20,27 +20,30 @@ --> + 0) { - this.setSelection(mPositionToSetAndCenter); - //this.setSelectionFromTop(mPositionToSetAndCenter, getHeight() / 2); - mPositionToSetAndCenter = 0; + if (mPositionToSetTopLeft > 0) { + this.smoothScrollToPosition(mPositionToSetTopLeft); + mPositionToSetTopLeft = 0; } } /** - * Public method to set the position of the item that should be centered in the visible area of the view. + * Public method to set the position of the item that should be top left in the visible area of the view. * * The position is saved here and checked in onDraw(). * - * @param position Position (in the list of items) of the item to center in the visible area. + * @param position Position (in the list of items) of the item to be top left in the visible area. */ - public void setAndCenterSelection(int position) { - mPositionToSetAndCenter = position; + public void setSelectionAsTopLeft(int position) { + mPositionToSetTopLeft = position; } } diff --git a/src/com/owncloud/android/ui/SquareImageView.java b/src/com/owncloud/android/ui/SquareImageView.java new file mode 100644 index 00000000..3c909999 --- /dev/null +++ b/src/com/owncloud/android/ui/SquareImageView.java @@ -0,0 +1,25 @@ +package com.owncloud.android.ui; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.ImageView; + +public class SquareImageView extends ImageView { + + public SquareImageView(Context context) { + super(context); + } + + public SquareImageView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public SquareImageView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, widthMeasureSpec); + } +} diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 202854f6..5997020c 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -180,6 +180,10 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { localStateView.setVisibility(View.INVISIBLE); } + if (!fileView){ + localStateView.setVisibility(View.GONE); + } + TextView fileSizeV = (TextView) view.findViewById(R.id.file_size); TextView lastModV = (TextView) view.findViewById(R.id.last_mod); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 547a3c07..17c3d010 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -201,22 +201,14 @@ implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { int top = mTops.remove(mTops.size() - 1); - imageView.setSelection(firstPosition); + imageView.smoothScrollToPosition(firstPosition); // Move the scroll if the selection is not visible int indexPosition = mHeightCell*index; int height = imageView.getHeight(); if (indexPosition > height) { - if (android.os.Build.VERSION.SDK_INT >= 11) - { - imageView.smoothScrollToPosition(index); - } - else if (android.os.Build.VERSION.SDK_INT >= 8) - { - imageView.setSelection(index); - } - + imageView.smoothScrollToPosition(index); } } }