mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
cleanup upload list adapter
# Conflicts: # src/main/java/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
This commit is contained in:
parent
d96dee930a
commit
4b1fd06b81
1 changed files with 19 additions and 9 deletions
|
@ -79,8 +79,8 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
}
|
||||
|
||||
abstract class UploadGroup implements Refresh {
|
||||
OCUpload[] items;
|
||||
String name;
|
||||
private OCUpload[] items;
|
||||
private String name;
|
||||
|
||||
public UploadGroup(String groupName) {
|
||||
this.name = groupName;
|
||||
|
@ -91,6 +91,14 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
return name;
|
||||
}
|
||||
|
||||
public OCUpload[] getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(OCUpload[] items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public int getGroupItemCount() {
|
||||
return items == null ? 0 : items.length;
|
||||
}
|
||||
|
@ -145,31 +153,33 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
mParentActivity = parentActivity;
|
||||
mUploadsStorageManager = new UploadsStorageManager(mParentActivity.getContentResolver(), parentActivity.getApplicationContext());
|
||||
mUploadGroups = new UploadGroup[3];
|
||||
|
||||
mUploadGroups[0] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_current_uploads)) {
|
||||
@Override
|
||||
public void refresh() {
|
||||
items = mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount();
|
||||
Arrays.sort(items, comparator);
|
||||
setItems(mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount());
|
||||
Arrays.sort(getItems(), comparator);
|
||||
}
|
||||
};
|
||||
|
||||
mUploadGroups[1] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_failed_uploads)) {
|
||||
@Override
|
||||
public void refresh() {
|
||||
items = mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount();
|
||||
Arrays.sort(items, comparator);
|
||||
setItems(mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount());
|
||||
Arrays.sort(getItems(), comparator);
|
||||
}
|
||||
};
|
||||
|
||||
mUploadGroups[2] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_finished_uploads)) {
|
||||
@Override
|
||||
public void refresh() {
|
||||
items = mUploadsStorageManager.getFinishedUploadsForCurrentAccount();
|
||||
Arrays.sort(items, comparator);
|
||||
setItems(mUploadsStorageManager.getFinishedUploadsForCurrentAccount());
|
||||
Arrays.sort(getItems(), comparator);
|
||||
}
|
||||
};
|
||||
loadUploadItemsFromDb();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerDataSetObserver(DataSetObserver observer) {
|
||||
super.registerDataSetObserver(observer);
|
||||
|
|
Loading…
Reference in a new issue