|
@@ -17,7 +17,7 @@
|
|
*/
|
|
*/
|
|
package com.owncloud.android.ui.adapter;
|
|
package com.owncloud.android.ui.adapter;
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
@@ -35,6 +35,7 @@ import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
import android.widget.BaseAdapter;
|
|
import android.widget.BaseAdapter;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
+import android.widget.LinearLayout;
|
|
import android.widget.ListAdapter;
|
|
import android.widget.ListAdapter;
|
|
import android.widget.ListView;
|
|
import android.widget.ListView;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
@@ -50,7 +51,7 @@ import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
import com.owncloud.android.ui.activity.ComponentsGetter;
|
|
import com.owncloud.android.ui.activity.ComponentsGetter;
|
|
import com.owncloud.android.utils.DisplayUtils;
|
|
import com.owncloud.android.utils.DisplayUtils;
|
|
import com.owncloud.android.utils.FileStorageUtils;
|
|
import com.owncloud.android.utils.FileStorageUtils;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* This Adapter populates a ListView with all files and folders in an ownCloud
|
|
* This Adapter populates a ListView with all files and folders in an ownCloud
|
|
@@ -60,7 +61,7 @@ import com.owncloud.android.utils.FileStorageUtils;
|
|
* @author Tobias Kaminsky
|
|
* @author Tobias Kaminsky
|
|
* @author David A. Velasco
|
|
* @author David A. Velasco
|
|
*/
|
|
*/
|
|
-public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
|
|
|
|
+public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
private final static String PERMISSION_SHARED_WITH_ME = "S";
|
|
private final static String PERMISSION_SHARED_WITH_ME = "S";
|
|
|
|
|
|
private Context mContext;
|
|
private Context mContext;
|
|
@@ -68,8 +69,8 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
private Vector<OCFile> mFiles = null;
|
|
private Vector<OCFile> mFiles = null;
|
|
private boolean mJustFolders;
|
|
private boolean mJustFolders;
|
|
|
|
|
|
- private FileDataStorageManager mStorageManager;
|
|
|
|
- private Account mAccount;
|
|
|
|
|
|
+ private FileDataStorageManager mStorageManager;
|
|
|
|
+ private Account mAccount;
|
|
private ComponentsGetter mTransferServiceGetter;
|
|
private ComponentsGetter mTransferServiceGetter;
|
|
private Integer mSortOrder;
|
|
private Integer mSortOrder;
|
|
public static final Integer SORT_NAME = 0;
|
|
public static final Integer SORT_NAME = 0;
|
|
@@ -87,8 +88,8 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
mJustFolders = justFolders;
|
|
mJustFolders = justFolders;
|
|
mContext = context;
|
|
mContext = context;
|
|
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
|
|
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
|
|
-
|
|
|
|
- mTransferServiceGetter = transferServiceGetter;
|
|
|
|
|
|
+
|
|
|
|
+ mTransferServiceGetter = transferServiceGetter;
|
|
|
|
|
|
mAppPreferences = PreferenceManager
|
|
mAppPreferences = PreferenceManager
|
|
.getDefaultSharedPreferences(mContext);
|
|
.getDefaultSharedPreferences(mContext);
|
|
@@ -96,13 +97,13 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
// Read sorting order, default to sort by name ascending
|
|
// Read sorting order, default to sort by name ascending
|
|
mSortOrder = mAppPreferences
|
|
mSortOrder = mAppPreferences
|
|
.getInt("sortOrder", 0);
|
|
.getInt("sortOrder", 0);
|
|
- mSortAscending = mAppPreferences.getBoolean("sortAscending", true);
|
|
|
|
|
|
+ mSortAscending = mAppPreferences.getBoolean("sortAscending", true);
|
|
|
|
|
|
// initialise thumbnails cache on background thread
|
|
// initialise thumbnails cache on background thread
|
|
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
|
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean areAllItemsEnabled() {
|
|
public boolean areAllItemsEnabled() {
|
|
return true;
|
|
return true;
|
|
@@ -151,6 +152,9 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
TextView fileName = (TextView) view.findViewById(R.id.Filename);
|
|
TextView fileName = (TextView) view.findViewById(R.id.Filename);
|
|
String name = file.getFileName();
|
|
String name = file.getFileName();
|
|
|
|
|
|
|
|
+ LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ListItemLayout);
|
|
|
|
+ linearLayout.setContentDescription("LinearLayout-" + name);
|
|
|
|
+
|
|
fileName.setText(name);
|
|
fileName.setText(name);
|
|
ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
|
|
ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
|
|
fileIcon.setTag(file.getFileId());
|
|
fileIcon.setTag(file.getFileId());
|
|
@@ -237,7 +241,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())
|
|
DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())
|
|
);
|
|
);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (checkIfFileIsSharedWithMe(file)) {
|
|
if (checkIfFileIsSharedWithMe(file)) {
|
|
sharedWithMeIconV.setVisibility(View.VISIBLE);
|
|
sharedWithMeIconV.setVisibility(View.VISIBLE);
|
|
}
|
|
}
|
|
@@ -250,7 +254,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
// } else {
|
|
// } else {
|
|
fileSizeV.setVisibility(View.INVISIBLE);
|
|
fileSizeV.setVisibility(View.INVISIBLE);
|
|
// }
|
|
// }
|
|
-
|
|
|
|
|
|
+
|
|
lastModV.setVisibility(View.VISIBLE);
|
|
lastModV.setVisibility(View.VISIBLE);
|
|
lastModV.setText(showRelativeTimestamp(file));
|
|
lastModV.setText(showRelativeTimestamp(file));
|
|
checkBoxV.setVisibility(View.GONE);
|
|
checkBoxV.setVisibility(View.GONE);
|
|
@@ -281,7 +285,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
|
|
|
|
return view;
|
|
return view;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Local Folder size in human readable format
|
|
* Local Folder size in human readable format
|
|
*
|
|
*
|
|
@@ -320,8 +324,8 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int getViewTypeCount() {
|
|
public int getViewTypeCount() {
|
|
return 1;
|
|
return 1;
|
|
@@ -519,5 +523,5 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|
private CharSequence showRelativeTimestamp(OCFile file){
|
|
private CharSequence showRelativeTimestamp(OCFile file){
|
|
return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
|
return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
|
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
|
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|