mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Fix Codacy issues
This commit is contained in:
parent
7862f3a19c
commit
43af519a16
21 changed files with 48 additions and 47 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ public class GPSExtractor {
|
|||
return decimalCoords;
|
||||
}
|
||||
|
||||
private double convertToDegree(String stringDMS){
|
||||
private double convertToDegree(String stringDMS) {
|
||||
double result;
|
||||
String[] DMS = stringDMS.split(",", 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class MultipleShareActivity
|
|||
dialog.setTitle(getResources().getQuantityString(R.plurals.starting_multiple_uploads, photosList.size(), photosList.size()));
|
||||
dialog.show();
|
||||
|
||||
for(int i = 0; i < photosList.size(); i++) {
|
||||
for (int i = 0; i < photosList.size(); i++) {
|
||||
Contribution up = photosList.get(i);
|
||||
final int uploadCount = i + 1; // Goddamn Java
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ public class MultipleShareActivity
|
|||
public void onCategoriesSave(List<String> categories) {
|
||||
if (categories.size() > 0) {
|
||||
ContentProviderClient client = getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY);
|
||||
for(Contribution contribution: photosList) {
|
||||
for (Contribution contribution: photosList) {
|
||||
ModifierSequence categoriesSequence = new ModifierSequence(contribution.getContentUri());
|
||||
|
||||
categoriesSequence.queueModifier(new CategoryModifier(categories.toArray(new String[]{})));
|
||||
|
|
@ -189,7 +189,7 @@ public class MultipleShareActivity
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (mediaDetails.isVisible()) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
|
|
@ -225,7 +225,7 @@ public class MultipleShareActivity
|
|||
}
|
||||
|
||||
private void showDetail(int i) {
|
||||
if (mediaDetails == null ||!mediaDetails.isVisible()) {
|
||||
if (mediaDetails == null || !mediaDetails.isVisible()) {
|
||||
mediaDetails = new MediaDetailPagerFragment(true);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
|
|
@ -252,7 +252,7 @@ public class MultipleShareActivity
|
|||
if (photosList == null) {
|
||||
photosList = new ArrayList<>();
|
||||
ArrayList<Uri> urisList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||
for(int i=0; i < urisList.size(); i++) {
|
||||
for (int i = 0; i < urisList.size(); i++) {
|
||||
Contribution up = new Contribution();
|
||||
Uri uri = urisList.get(i);
|
||||
up.setLocalUri(uri);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,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();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class UploadController {
|
|||
}
|
||||
|
||||
public void cleanup() {
|
||||
if(isUploadServiceConnected) {
|
||||
if (isUploadServiceConnected) {
|
||||
app.unbindService(uploadServiceConnection);
|
||||
}
|
||||
}
|
||||
|
|
@ -82,11 +82,11 @@ public class UploadController {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app);
|
||||
|
||||
//Set creator, desc, and license
|
||||
if(TextUtils.isEmpty(contribution.getCreator())) {
|
||||
if (TextUtils.isEmpty(contribution.getCreator())) {
|
||||
contribution.setCreator(app.getCurrentAccount().name);
|
||||
}
|
||||
|
||||
if(contribution.getDescription() == null) {
|
||||
if (contribution.getDescription() == null) {
|
||||
contribution.setDescription("");
|
||||
}
|
||||
|
||||
|
|
@ -103,11 +103,11 @@ public class UploadController {
|
|||
protected Contribution doInBackground(Void... voids /* stare into you */) {
|
||||
long length;
|
||||
try {
|
||||
if(contribution.getDataLength() <= 0) {
|
||||
if (contribution.getDataLength() <= 0) {
|
||||
length = app.getContentResolver()
|
||||
.openAssetFileDescriptor(contribution.getLocalUri(), "r")
|
||||
.getLength();
|
||||
if(length == -1) {
|
||||
if (length == -1) {
|
||||
// Let us find out the long way!
|
||||
length = Utils.countBytes(app.getContentResolver()
|
||||
.openInputStream(contribution.getLocalUri()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue