use of android.support.v4.util.ArraySet in project AnExplorer by 1hakr.
the class RecentsProvider method call.
@Override
public Bundle call(String method, String arg, Bundle extras) {
if (METHOD_PURGE.equals(method)) {
// Purge references to unknown authorities
final ArraySet<String> knownAuth = new ArraySet<>();
List<ProviderInfo> providers = getContext().getPackageManager().queryContentProviders(getContext().getPackageName(), getContext().getApplicationInfo().uid, 0);
for (ProviderInfo providerInfo : providers) {
knownAuth.add(providerInfo.authority);
}
purgeByAuthority(new Predicate<String>() {
@Override
public boolean apply(String authority) {
// Purge unknown authorities
return !knownAuth.contains(authority);
}
});
return null;
} else if (METHOD_PURGE_PACKAGE.equals(method)) {
// Purge references to authorities in given package
final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
intent.setPackage(arg);
final ArraySet<String> packageAuth = new ArraySet<>();
List<ProviderInfo> providers = getContext().getPackageManager().queryContentProviders(getContext().getPackageName(), getContext().getApplicationInfo().uid, 0);
for (ProviderInfo providerInfo : providers) {
packageAuth.add(providerInfo.authority);
}
if (!packageAuth.isEmpty()) {
purgeByAuthority(new Predicate<String>() {
@Override
public boolean apply(String authority) {
// Purge authority matches
return packageAuth.contains(authority);
}
});
}
return null;
} else {
return super.call(method, arg, extras);
}
}
use of android.support.v4.util.ArraySet in project apps-android-wikipedia by wikimedia.
the class RequiredFieldsCheckOnReadTypeAdapterFactory method collectRequiredFields.
@NonNull
private Set<Field> collectRequiredFields(@NonNull Class<?> clazz) {
Field[] fields = clazz.getDeclaredFields();
Set<Field> required = new ArraySet<>();
for (Field field : fields) {
if (field.isAnnotationPresent(Required.class)) {
required.add(field);
}
}
return Collections.unmodifiableSet(required);
}
Aggregations