Make use of List.contains(o) since it already does .equals()
This commit is contained in:
parent
ea559d0675
commit
0506160f7b
F-Droid/src/org/fdroid/fdroid
@ -25,21 +25,17 @@ public class AppFilter {
|
||||
// Return true if the given app should be filtered out based on user
|
||||
// preferences, and false otherwise.
|
||||
public boolean filter(App app) {
|
||||
|
||||
final boolean dontFilterRequiringRoot = Preferences.get().filterAppsRequiringRoot();
|
||||
|
||||
if (app.requirements == null || dontFilterRequiringRoot) {
|
||||
if (app.requirements == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final String r : app.requirements) {
|
||||
if (r.equals("root")) {
|
||||
if (!Preferences.get().filterAppsRequiringRoot()) {
|
||||
if (app.requirements.contains("root")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,9 +62,11 @@ public class CompatibilityChecker extends Compatibility {
|
||||
}
|
||||
|
||||
private boolean compatibleApi(Utils.CommaSeparatedList nativecode) {
|
||||
if (nativecode == null) return true;
|
||||
for (final String abi : nativecode) {
|
||||
if (Utils.arrayContains(cpuAbis, abi)) {
|
||||
if (nativecode == null) {
|
||||
return true;
|
||||
}
|
||||
for (final String cpuAbi : cpuAbis) {
|
||||
if (nativecode.contains(cpuAbi)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -617,19 +617,11 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
|
||||
List<ContentProviderOperation> operations = new ArrayList<>();
|
||||
List<String> knownAppIds = getKnownAppIds(appsToUpdate);
|
||||
for (final App a : appsToUpdate) {
|
||||
boolean known = false;
|
||||
for (final String knownId : knownAppIds) {
|
||||
if (knownId.equals(a.id)) {
|
||||
known = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (known) {
|
||||
operations.add(updateExistingApp(a));
|
||||
for (final App app : appsToUpdate) {
|
||||
if (knownAppIds.contains(app.id)) {
|
||||
operations.add(updateExistingApp(app));
|
||||
} else {
|
||||
operations.add(insertNewApp(a));
|
||||
operations.add(insertNewApp(app));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,15 +506,6 @@ public final class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> boolean arrayContains(final T[] array, final T v) {
|
||||
for (final T e : array) {
|
||||
if (e == v || v != null && v.equals(e)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all files from the {@parm directory} either beginning with {@param startsWith}
|
||||
* or ending with {@param endsWith}. Note that if the SD card is not ready, then the
|
||||
|
Loading…
x
Reference in New Issue
Block a user