Commit ac7f0e0e authored by Alan McNatty's avatar Alan McNatty
Browse files

Fixed a bugs detecting upload readiness (filename was always null so never ready for upload)

parent d982dd8e
......@@ -119,7 +119,7 @@ public class Artefact extends Object implements Parcelable {
return this.title;
}
public boolean isJournal() {
return ( journal_id != null && Long.valueOf(journal_id) > 0 );
return ( journal_id != null && Long.parseLong(journal_id) > 0 );
}
public boolean hasAttachment() {
return ( filename != null );
......
......@@ -302,17 +302,18 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
}
if ( ! a.canUpload() ) {
Toast.makeText(this, R.string.uploadincomplete, Toast.LENGTH_SHORT).show();
if ( DEBUG ) Log.d(TAG, "Incomplete artefact: title [" + a.getTitle() + "], journal: [" + a.getJournalId() + "], desc: [" + a.getDescription() + "], file [" + a.getFilename() + "]");
return false;
}
if ( VERBOSE ) Log.v(TAG, "InitiateUpload can upload");
Intent uploader_intent;
// Write a journal - no file(s) attached.
if ( uris == null || uris.length == 0 ) {
if ( ! a.canUpload() ) {
Toast.makeText(this, R.string.uploadincomplete, Toast.LENGTH_SHORT).show();
if ( DEBUG ) Log.d(TAG, "Incomplete artefact: title [" + a.getTitle() + "], journal: [" + a.getJournalId() + "], desc: [" + a.getDescription() + "], file [" + a.getFilename() + "]");
return false;
}
uploader_intent = new Intent(this, TransferService.class);
uploader_intent.putExtra("artefact", a);
if ( VERBOSE ) Log.v(TAG, "InitiateUpload no file - about to start service");
......@@ -322,10 +323,16 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
} else {
for ( int i = 0; i < uris.length; i++ ) {
a.setFilename(uris[i]);
if ( VERBOSE ) Log.v(TAG, "InitiateUpload have file, name is '" + uris[i] + "'");
if ( ! a.canUpload() ) {
Toast.makeText(this, R.string.uploadincomplete, Toast.LENGTH_SHORT).show();
if ( DEBUG ) Log.d(TAG, "Incomplete artefact: title [" + a.getTitle() + "], journal: [" + a.getJournalId() + "], desc: [" + a.getDescription() + "], file [" + a.getFilename() + "]");
break;
}
uploader_intent = new Intent(this, TransferService.class);
uploader_intent.putExtra("artefact", a);
if ( VERBOSE ) Log.v(TAG, "InitiateUpload with file [" + i + "] - about to start service");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment