Fix conflicts from #1366 fixing lint issues (#1470)

* lint issue #171 - added Locale.getDefault()

* lint issue #171 - added Locale.getDefault()

* lint issue #171 - added %d

* lint issue #171 - Changed version

* lint issue #171 - added singleLine="true"

* lint issue #171 - changed commit to apply

* lint issue #171 - added Locale.getDefault()

* lint issue #171 - added Locale.getDefault()

* Codacy issues #778 - nested if loop

* Codacy issues #778 - nested if loop

* Revert "lint issue #171 - added %d" since we dont edit translated string files

This reverts commit e4917cddcf.
This commit is contained in:
neslihanturan 2018-04-30 14:05:47 +03:00 committed by GitHub
parent f80311d9f6
commit 3c2cc26d3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 15 deletions

View file

@ -35,7 +35,7 @@ dependencies {
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
kapt "com.jakewharton:butterknife-compiler:$BUTTERKNIFE_VERSION"
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okio:okio:1.13.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

View file

@ -29,6 +29,7 @@ import android.widget.EditText;
import android.widget.TextView;
import java.io.IOException;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Named;
@ -267,18 +268,18 @@ public class LoginActivity extends AccountAuthenticatorActivity {
if (result.equals("NetworkFailure")) {
// Matches NetworkFailure which is created by the doInBackground method
showMessageAndCancelDialog(R.string.login_failed_network);
} else if (result.toLowerCase().contains("nosuchuser".toLowerCase()) || result.toLowerCase().contains("noname".toLowerCase())) {
} else if (result.toLowerCase(Locale.getDefault()).contains("nosuchuser".toLowerCase()) || result.toLowerCase().contains("noname".toLowerCase())) {
// Matches nosuchuser, nosuchusershort, noname
showMessageAndCancelDialog(R.string.login_failed_username);
emptySensitiveEditFields();
} else if (result.toLowerCase().contains("wrongpassword".toLowerCase())) {
} else if (result.toLowerCase(Locale.getDefault()).contains("wrongpassword".toLowerCase())) {
// Matches wrongpassword, wrongpasswordempty
showMessageAndCancelDialog(R.string.login_failed_password);
emptySensitiveEditFields();
} else if (result.toLowerCase().contains("throttle".toLowerCase())) {
} else if (result.toLowerCase(Locale.getDefault()).contains("throttle".toLowerCase())) {
// Matches unknown throttle error codes
showMessageAndCancelDialog(R.string.login_failed_throttled);
} else if (result.toLowerCase().contains("userblocked".toLowerCase())) {
} else if (result.toLowerCase(Locale.getDefault()).contains("userblocked".toLowerCase())) {
// Matches login-userblocked
showMessageAndCancelDialog(R.string.login_failed_blocked);
} else if (result.equals("2FA")) {

View file

@ -83,7 +83,7 @@ public class DeleteTask extends AsyncTask<Void, Integer, Boolean> {
String logPageString = "\n{{Commons:Deletion requests/" + media.getFilename() +
"}}\n";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault());
String date = sdf.format(calendar.getTime());
String userPageString = "\n{{subst:idw|" + media.getFilename() +

View file

@ -458,7 +458,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
if (date == null || date.toString() == null || date.toString().isEmpty()) {
return "Uploaded date not available";
}
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy");
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
return formatter.format(date);
}

View file

@ -133,8 +133,8 @@ public class SettingsFragment extends PreferenceFragment {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CODE_WRITE_EXTERNAL_STORAGE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (requestCode == REQUEST_CODE_WRITE_EXTERNAL_STORAGE && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
{
sendAppLogsViaEmail();
}
}

View file

@ -221,8 +221,8 @@ public class MultipleShareActivity extends AuthenticatedActivity
//TODO: 15/10/17 should location permission be explicitly requested if not provided?
//check if location permission is enabled
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
{
locationPermitted = true;
}
}

View file

@ -226,7 +226,7 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
setLicenseSummary(license);
prefs.edit()
.putString(Prefs.DEFAULT_LICENSE, license)
.commit();
.apply();
}

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons.utils;
import java.util.Comparator;
import java.util.Locale;
import info.debatty.java.stringsimilarity.Levenshtein;
@ -28,8 +29,8 @@ public class StringSortingUtils {
}
private static double calculateSimilarity(String firstString, String secondString) {
String longer = firstString.toLowerCase();
String shorter = secondString.toLowerCase();
String longer = firstString.toLowerCase(Locale.getDefault());
String shorter = secondString.toLowerCase(Locale.getDefault());
if (firstString.length() < secondString.length()) {
longer = secondString;

View file

@ -2,7 +2,7 @@
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:maxLines="1"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:ellipsize="marquee"