mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	* 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:
		
							parent
							
								
									f80311d9f6
								
							
						
					
					
						commit
						3c2cc26d3b
					
				
					 9 changed files with 17 additions and 15 deletions
				
			
		|  | @ -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")) { | ||||
|  |  | |||
|  | @ -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() + | ||||
|  |  | |||
|  | @ -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); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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(); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -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; | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -226,7 +226,7 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment { | |||
|         setLicenseSummary(license); | ||||
|         prefs.edit() | ||||
|                 .putString(Prefs.DEFAULT_LICENSE, license) | ||||
|                 .commit(); | ||||
|                 .apply(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan