mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add constructor to StartUploadTask that takes a contribution
This commit is contained in:
parent
90eb0d840d
commit
2e4264c16c
3 changed files with 4 additions and 3 deletions
|
|
@ -82,7 +82,7 @@ public class MultipleShareActivity
|
|||
}
|
||||
}
|
||||
|
||||
StartUploadTask startUploadTask = new StartUploadTask(MultipleShareActivity.this, uploadService, up.getFilename(), up.getLocalUri(), up.getDescription(), (String)up.getTag("mimeType"), Contribution.SOURCE_EXTERNAL);
|
||||
StartUploadTask startUploadTask = new StartUploadTask(MultipleShareActivity.this, uploadService, up);
|
||||
try {
|
||||
Utils.executeAsyncTask(startUploadTask);
|
||||
startUploadTask.get();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class StartUploadTask extends AsyncTask<Void, Void, Contribution> {
|
|||
public StartUploadTask(Activity context, UploadService uploadService, Contribution contribution) {
|
||||
this.context = context;
|
||||
this.uploadService = uploadService;
|
||||
this.contribution = contribution;
|
||||
|
||||
app = (CommonsApplication)context.getApplicationContext();
|
||||
}
|
||||
|
|
@ -52,7 +53,7 @@ public class StartUploadTask extends AsyncTask<Void, Void, Contribution> {
|
|||
|
||||
long length;
|
||||
try {
|
||||
if(contribution.getDataLength() == -1) {
|
||||
if(contribution.getDataLength() <= 0) {
|
||||
length = context.getContentResolver().openAssetFileDescriptor(contribution.getLocalUri(), "r").getLength();
|
||||
if(length == -1) {
|
||||
// Let us find out the long way!
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public class Contribution extends Media {
|
|||
}
|
||||
|
||||
public Contribution() {
|
||||
// Empty constructor for being constructed by our static methods
|
||||
timestamp = new Date(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public static Contribution fromCursor(Cursor cursor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue