Merge branch 'develop' of https://github.com/tobiasKaminsky/android into develop

Conflicts:
	src/com/owncloud/android/ui/adapter/FileListListAdapter.java
This commit is contained in:
tobiasKaminsky 2014-08-09 10:20:07 +02:00
commit 8c96447fe7

View file

@ -28,10 +28,15 @@ import android.accounts.OperationCanceledException;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
<<<<<<< HEAD
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.media.ThumbnailUtils;
import android.os.AsyncTask;
=======
import android.graphics.BitmapFactory;
import android.media.ThumbnailUtils;
>>>>>>> c0dc4c42d71eb9593ff48a02a8af74bd7df8776e
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
@ -263,10 +268,10 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflator.inflate(R.layout.list_item, null);
}
if (mFiles != null && mFiles.size() > position) {
OCFile file = mFiles.get(position);
TextView fileName = (TextView) view.findViewById(R.id.Filename);
TextView fileName = (TextView) view.findViewById(R.id.Filename);
String name = file.getFileName();
fileName.setText(name);
@ -320,6 +325,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
}
checkBoxV.setVisibility(View.VISIBLE);
}
<<<<<<< HEAD
// first set thumbnail according to Mimetype, prevents empty thumbnails
fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));
@ -336,6 +342,20 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
}
}
=======
// generate Thumbnail if file is available local and image
if (file.isDown() && file.isImage()){
// Converts dp to pixel
Resources r = mContext.getResources();
int px = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 150, r.getDisplayMetrics()));
Bitmap bitmap = BitmapFactory.decodeFile(file.getStoragePath());
fileIcon.setImageBitmap(ThumbnailUtils.extractThumbnail(bitmap, px, px));
} else {
fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));
}
>>>>>>> c0dc4c42d71eb9593ff48a02a8af74bd7df8776e
if (checkIfFileIsSharedWithMe(file)) {
sharedWithMeIconV.setVisibility(View.VISIBLE);
}