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 {
|
abstract class UploadGroup implements Refresh {
|
||||||
OCUpload[] items;
|
private OCUpload[] items;
|
||||||
String name;
|
private String name;
|
||||||
|
|
||||||
public UploadGroup(String groupName) {
|
public UploadGroup(String groupName) {
|
||||||
this.name = groupName;
|
this.name = groupName;
|
||||||
|
@ -91,6 +91,14 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OCUpload[] getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItems(OCUpload[] items) {
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
public int getGroupItemCount() {
|
public int getGroupItemCount() {
|
||||||
return items == null ? 0 : items.length;
|
return items == null ? 0 : items.length;
|
||||||
}
|
}
|
||||||
|
@ -145,31 +153,33 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
||||||
mParentActivity = parentActivity;
|
mParentActivity = parentActivity;
|
||||||
mUploadsStorageManager = new UploadsStorageManager(mParentActivity.getContentResolver(), parentActivity.getApplicationContext());
|
mUploadsStorageManager = new UploadsStorageManager(mParentActivity.getContentResolver(), parentActivity.getApplicationContext());
|
||||||
mUploadGroups = new UploadGroup[3];
|
mUploadGroups = new UploadGroup[3];
|
||||||
|
|
||||||
mUploadGroups[0] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_current_uploads)) {
|
mUploadGroups[0] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_current_uploads)) {
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
items = mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount();
|
setItems(mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount());
|
||||||
Arrays.sort(items, comparator);
|
Arrays.sort(getItems(), comparator);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mUploadGroups[1] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_failed_uploads)) {
|
mUploadGroups[1] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_failed_uploads)) {
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
items = mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount();
|
setItems(mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount());
|
||||||
Arrays.sort(items, comparator);
|
Arrays.sort(getItems(), comparator);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mUploadGroups[2] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_finished_uploads)) {
|
mUploadGroups[2] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_finished_uploads)) {
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
items = mUploadsStorageManager.getFinishedUploadsForCurrentAccount();
|
setItems(mUploadsStorageManager.getFinishedUploadsForCurrentAccount());
|
||||||
Arrays.sort(items, comparator);
|
Arrays.sort(getItems(), comparator);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
loadUploadItemsFromDb();
|
loadUploadItemsFromDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerDataSetObserver(DataSetObserver observer) {
|
public void registerDataSetObserver(DataSetObserver observer) {
|
||||||
super.registerDataSetObserver(observer);
|
super.registerDataSetObserver(observer);
|
||||||
|
|
Loading…
Reference in a new issue