mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Merge branch 'master' into dependency-injection
This commit is contained in:
commit
02b5b9b680
148 changed files with 1169 additions and 364 deletions
|
|
@ -123,8 +123,9 @@ public class FileUtils {
|
|||
} catch (IllegalArgumentException e) {
|
||||
Timber.d(e);
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public class GPSExtractor {
|
|||
return decimalCoords;
|
||||
}
|
||||
|
||||
private double convertToDegree(String stringDMS){
|
||||
private double convertToDegree(String stringDMS) {
|
||||
double result;
|
||||
String[] DMS = stringDMS.split(",", 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class MwVolleyApi {
|
|||
* @param coords Coordinates to build query with
|
||||
* @return URL for API query
|
||||
*/
|
||||
private String buildUrl (String coords){
|
||||
private String buildUrl(String coords) {
|
||||
|
||||
Uri.Builder builder = Uri.parse(MWURL).buildUpon();
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class UploadController {
|
|||
}
|
||||
|
||||
public void cleanup() {
|
||||
if(isUploadServiceConnected) {
|
||||
if (isUploadServiceConnected) {
|
||||
context.unbindService(uploadServiceConnection);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,11 +87,11 @@ public class UploadController {
|
|||
|
||||
public void startUpload(final Contribution contribution, final ContributionUploadProgress onComplete) {
|
||||
//Set creator, desc, and license
|
||||
if(TextUtils.isEmpty(contribution.getCreator())) {
|
||||
if (TextUtils.isEmpty(contribution.getCreator())) {
|
||||
contribution.setCreator(sessionManager.getCurrentAccount().name);
|
||||
}
|
||||
|
||||
if(contribution.getDescription() == null) {
|
||||
if (contribution.getDescription() == null) {
|
||||
contribution.setDescription("");
|
||||
}
|
||||
|
||||
|
|
@ -109,11 +109,11 @@ public class UploadController {
|
|||
long length;
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
try {
|
||||
if(contribution.getDataLength() <= 0) {
|
||||
if (contribution.getDataLength() <= 0) {
|
||||
length = contentResolver
|
||||
.openAssetFileDescriptor(contribution.getLocalUri(), "r")
|
||||
.getLength();
|
||||
if(length == -1) {
|
||||
if (length == -1) {
|
||||
// Let us find out the long way!
|
||||
length = countBytes(contentResolver
|
||||
.openInputStream(contribution.getLocalUri()));
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public class UploadService extends HandlerService<Contribution> {
|
|||
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
private void uploadContribution(Contribution contribution) {
|
||||
InputStream file = null;
|
||||
InputStream file;
|
||||
|
||||
String notificationTag = contribution.getLocalUri().toString();
|
||||
|
||||
|
|
@ -196,6 +196,14 @@ public class UploadService extends HandlerService<Contribution> {
|
|||
Timber.d("File not found");
|
||||
Toast fileNotFound = Toast.makeText(this, R.string.upload_failed, Toast.LENGTH_LONG);
|
||||
fileNotFound.show();
|
||||
return;
|
||||
}
|
||||
|
||||
//As the file is null there's no point in continuing the upload process
|
||||
//mwapi.upload accepts a NonNull input stream
|
||||
if(file == null) {
|
||||
Timber.d("File not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Timber.d("Before execution!");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue