Search in sources :

Example 6 with ArraySet

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);
    }
}
Also used : ArraySet(android.support.v4.util.ArraySet) ProviderInfo(android.content.pm.ProviderInfo) Intent(android.content.Intent) List(java.util.List) DocumentInfo.getCursorString(dev.dworks.apps.anexplorer.model.DocumentInfo.getCursorString) Predicate(com.android.internal.util.Predicate)

Example 7 with ArraySet

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);
}
Also used : Field(java.lang.reflect.Field) ArraySet(android.support.v4.util.ArraySet) NonNull(android.support.annotation.NonNull)

Aggregations

ArraySet (android.support.v4.util.ArraySet)6 Intent (android.content.Intent)1 ProviderInfo (android.content.pm.ProviderInfo)1 Location (android.location.Location)1 NonNull (android.support.annotation.NonNull)1 ArrayMap (android.support.v4.util.ArrayMap)1 ArraySet (android.util.ArraySet)1 ContactCacheEntry (com.android.incallui.ContactInfoCache.ContactCacheEntry)1 DialerCall (com.android.incallui.call.DialerCall)1 Predicate (com.android.internal.util.Predicate)1 Geofence (com.google.android.gms.location.Geofence)1 GeofencingEvent (com.google.android.gms.location.GeofencingEvent)1 DocumentInfo.getCursorString (dev.dworks.apps.anexplorer.model.DocumentInfo.getCursorString)1 NotificationEvent (forpdateam.ru.forpda.api.events.models.NotificationEvent)1 Field (java.lang.reflect.Field)1 HttpCookie (java.net.HttpCookie)1 List (java.util.List)1 Map (java.util.Map)1 Area (org.infobip.mobile.messaging.geo.Area)1 GeoEventType (org.infobip.mobile.messaging.geo.GeoEventType)1