mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Simplify if statements
This patch simplifies a few if statements by replacing them with returns, which helps improve code readability and simplicity.
This commit is contained in:
parent
67dfa170d2
commit
7a8e04eec1
2 changed files with 2 additions and 11 deletions
|
|
@ -270,10 +270,6 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDarkTheme(Context context) {
|
public static boolean isDarkTheme(Context context) {
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme",true)) {
|
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme",true);
|
||||||
return true;
|
|
||||||
}else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,12 +57,7 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
||||||
ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/img");
|
ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/img");
|
||||||
Timber.d("Result nodes: %s", resultNodes);
|
Timber.d("Result nodes: %s", resultNodes);
|
||||||
|
|
||||||
boolean fileExists;
|
boolean fileExists = !resultNodes.isEmpty();
|
||||||
if (!resultNodes.isEmpty()) {
|
|
||||||
fileExists = true;
|
|
||||||
} else {
|
|
||||||
fileExists = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Timber.d("File already exists in Commons: %s", fileExists);
|
Timber.d("File already exists in Commons: %s", fileExists);
|
||||||
return fileExists;
|
return fileExists;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue