mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add cancel method too
This commit is contained in:
parent
bfd30e9435
commit
e4c05d2fb3
1 changed files with 19 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ class ContributionsListAdapter extends CursorAdapter {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
Log.d("deneme","Cancel button is clicked");
|
||||
deleteUpload(cursor);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -126,4 +127,22 @@ class ContributionsListAdapter extends CursorAdapter {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a failed upload attempt
|
||||
* @param cursor position of upload attempt which will be deteled
|
||||
*/
|
||||
public void deleteUpload(Cursor cursor) {
|
||||
// TODO: check internet connection, warn user and do nothing is a problem occurred
|
||||
|
||||
Contribution c = contributionDao.fromCursor(cursor);
|
||||
if (c.getState() == STATE_FAILED) {
|
||||
Timber.d("Deleting failed contrib %s", c.toString());
|
||||
Log.d("deneme","Deleting failed:"+c.getFilename());
|
||||
contributionDao.delete(c);
|
||||
} else {
|
||||
Timber.d("Skipping deletion for non-failed contrib %s", c.toString());
|
||||
Log.d("deneme","Skipping deletion for non-failed contrib"+c.getFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue