mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +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) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme",true)) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme",true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,7 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
|||
ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/img");
|
||||
Timber.d("Result nodes: %s", resultNodes);
|
||||
|
||||
boolean fileExists;
|
||||
if (!resultNodes.isEmpty()) {
|
||||
fileExists = true;
|
||||
} else {
|
||||
fileExists = false;
|
||||
}
|
||||
boolean fileExists = !resultNodes.isEmpty();
|
||||
|
||||
Timber.d("File already exists in Commons: %s", fileExists);
|
||||
return fileExists;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue