mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Thumbnail for local images
This commit is contained in:
parent
05c43c4d0f
commit
8adb5641c3
1 changed files with 12 additions and 2 deletions
|
@ -17,10 +17,14 @@
|
|||
*/
|
||||
package com.owncloud.android.ui.adapter;
|
||||
|
||||
import java.io.ObjectInputStream.GetField;
|
||||
import java.util.Vector;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -113,7 +117,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
String name = file.getFileName();
|
||||
|
||||
fileName.setText(name);
|
||||
ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
|
||||
ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
|
||||
ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);
|
||||
ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);
|
||||
sharedWithMeIconV.setVisibility(View.GONE);
|
||||
|
@ -164,7 +168,13 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
checkBoxV.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));
|
||||
// generate Thumbnail if file is available local and image
|
||||
if (file.isDown() && file.isImage()){
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(file.getStoragePath());
|
||||
fileIcon.setImageBitmap(ThumbnailUtils.extractThumbnail(bitmap, 50, 50));
|
||||
} else {
|
||||
fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));
|
||||
}
|
||||
|
||||
if (checkIfFileIsSharedWithMe(file)) {
|
||||
sharedWithMeIconV.setVisibility(View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue