mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixing codacy issues. Reduced reported count from 550 to 518.
This commit is contained in:
parent
9b8d8e9b7c
commit
fc9cd0a3b7
13 changed files with 51 additions and 41 deletions
|
|
@ -147,10 +147,10 @@ public class CommonsApplication extends Application {
|
|||
* @return Account|null
|
||||
*/
|
||||
public Account getCurrentAccount() {
|
||||
if(currentAccount == null) {
|
||||
if (currentAccount == null) {
|
||||
AccountManager accountManager = AccountManager.get(this);
|
||||
Account[] allAccounts = accountManager.getAccountsByType(AccountUtil.accountType());
|
||||
if(allAccounts.length != 0) {
|
||||
if (allAccounts.length != 0) {
|
||||
currentAccount = allAccounts[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ public class CommonsApplication extends Application {
|
|||
AccountManager accountManager = AccountManager.get(this);
|
||||
Account curAccount = getCurrentAccount();
|
||||
|
||||
if(curAccount == null) {
|
||||
if (curAccount == null) {
|
||||
return false; // This should never happen
|
||||
}
|
||||
|
||||
|
|
@ -224,11 +224,13 @@ public class CommonsApplication extends Application {
|
|||
if (getIndex() == allAccounts.length) {
|
||||
Timber.d("All accounts have been removed");
|
||||
//TODO: fix preference manager
|
||||
PreferenceManager.getDefaultSharedPreferences(getInstance()).edit().clear().commit();
|
||||
PreferenceManager.getDefaultSharedPreferences(getInstance())
|
||||
.edit().clear().commit();
|
||||
SharedPreferences preferences = context
|
||||
.getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE);
|
||||
preferences.edit().clear().commit();
|
||||
context.getSharedPreferences("prefs", Context.MODE_PRIVATE).edit().clear().commit();
|
||||
context.getSharedPreferences("prefs", Context.MODE_PRIVATE)
|
||||
.edit().clear().commit();
|
||||
preferences.edit().putBoolean("firstrun", false).apply();
|
||||
updateAllDatabases();
|
||||
currentAccount = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue