@@ -65,21 +65,6 @@ public class ContributionsActivity
65
65
private UploadService uploadService ;
66
66
private boolean isUploadServiceConnected ;
67
67
private ArrayList <DataSetObserver > observersWaitingForLoad = new ArrayList <>();
68
- private String CONTRIBUTION_SELECTION = "" ;
69
-
70
- /*
71
- This sorts in the following order:
72
- Currently Uploading
73
- Failed (Sorted in ascending order of time added - FIFO)
74
- Queued to Upload (Sorted in ascending order of time added - FIFO)
75
- Completed (Sorted in descending order of time added)
76
-
77
- This is why Contribution.STATE_COMPLETED is -1.
78
- */
79
- private String CONTRIBUTION_SORT = ContributionDao .Table .COLUMN_STATE + " DESC, "
80
- + ContributionDao .Table .COLUMN_UPLOADED + " DESC , ("
81
- + ContributionDao .Table .COLUMN_TIMESTAMP + " * "
82
- + ContributionDao .Table .COLUMN_STATE + ")" ;
83
68
84
69
private CompositeDisposable compositeDisposable = new CompositeDisposable ();
85
70
@@ -127,8 +112,7 @@ protected void onAuthCookieAcquired(String authCookie) {
127
112
startService (uploadServiceIntent );
128
113
bindService (uploadServiceIntent , uploadServiceConnection , Context .BIND_AUTO_CREATE );
129
114
130
- allContributions = getContentResolver ().query (BASE_URI , ALL_FIELDS ,
131
- CONTRIBUTION_SELECTION , null , CONTRIBUTION_SORT );
115
+ allContributions = contributionDao .loadAllContributions ();
132
116
133
117
getSupportLoaderManager ().initLoader (0 , null , this );
134
118
}
@@ -238,8 +222,8 @@ public boolean onCreateOptionsMenu(Menu menu) {
238
222
public Loader <Cursor > onCreateLoader (int i , Bundle bundle ) {
239
223
int uploads = prefs .getInt (UPLOADS_SHOWING , 100 );
240
224
return new CursorLoader (this , BASE_URI ,
241
- ALL_FIELDS , CONTRIBUTION_SELECTION , null ,
242
- CONTRIBUTION_SORT + "LIMIT " + uploads );
225
+ ALL_FIELDS , "" , null ,
226
+ ContributionDao . CONTRIBUTION_SORT + "LIMIT " + uploads );
243
227
}
244
228
245
229
@ Override
0 commit comments