@@ -0,0 +1,1830 @@
+package org.ccci.gto.android.common.content;%0A%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.v4.util.LongSparseArray;%0A%0Apublic final class IntersectingLongsBroadcastReceiver extends ForwardingBroadcastReceiver %7B%0A    private static final long%5B%5D NO_VALUES = new long%5B0%5D;%0A%0A    public static final String EXTRA_VALUES = IntersectingLongsBroadcastReceiver.class.getName() + %22.EXTRA_VALUES%22;%0A%0A    @NonNull%0A    private String mExtra = EXTRA_VALUES;%0A    private final LongSparseArray%3CBoolean%3E mValues = new LongSparseArray%3C%3E();%0A%0A    @Override%0A    public void onReceive(final Context context, @NonNull final Intent intent) %7B%0A        // short-circuit if we don't have any values to match%0A        if (mValues.size() == 0) %7B%0A            return;%0A        %7D%0A%0A        // short-circuit if there are no values in the intent%0A        final long%5B%5D values = intent.getLongArrayExtra(mExtra);%0A        if (values == null %7C%7C values.length == 0) %7B%0A            return;%0A        %7D%0A%0A        // look for an intersection%0A        for (final long value : values) %7B%0A            if (mValues.indexOfKey(value) %3E= 0) %7B%0A                // process the first intersection only, then return%0A                super.onReceive(context, intent);%0A                return;%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void setExtraName(@NonNull final String name) %7B%0A        this.mExtra = name;%0A    %7D%0A%0A    public void addValues(@NonNull final long... values) %7B%0A        for (final long value : values) %7B%0A            mValues.put(value, Boolean.TRUE);%0A        %7D%0A    %7D%0A%0A    public boolean containsValues() %7B%0A        return mValues.size() %3E 0;%0A    %7D%0A%0A    public void removeValues(@NonNull final long... values) %7B%0A        for (final long value : values) %7B%0A            mValues.delete(value);%0A        %7D%0A    %7D%0A%7D%0A

create a BroadcastReceiver that will filter based on intersecting sets of longs