public static int removeUnreadCounts( final Context context, final int position, final long account_id, final long... status_ids) { if (context == null || position < 0 || status_ids == null || status_ids.length == 0) return 0; int result = 0; final Uri.Builder builder = UnreadCounts.CONTENT_URI.buildUpon(); builder.appendPath(String.valueOf(position)); builder.appendPath(String.valueOf(account_id)); builder.appendPath(TwidereArrayUtils.toString(status_ids, ',', false)); result += context.getContentResolver().delete(builder.build(), null, null); return result; }
public static int removeUnreadCounts( final Context context, final int position, final LongSparseArray<Set<Long>> counts) { if (context == null || position < 0 || counts == null) return 0; int result = 0; for (int i = 0, j = counts.size(); i < j; i++) { final long key = counts.keyAt(i); final Set<Long> value = counts.valueAt(i); final Uri.Builder builder = UnreadCounts.CONTENT_URI.buildUpon(); builder.appendPath(String.valueOf(position)); builder.appendPath(String.valueOf(key)); builder.appendPath(CollectionUtils.toString(value, ',', false)); result += context.getContentResolver().delete(builder.build(), null, null); } return result; }
public static int clearUnreadCount(final Context context, final int position) { if (context == null || position < 0) return 0; final Uri uri = UnreadCounts.CONTENT_URI.buildUpon().appendPath(String.valueOf(position)).build(); return context.getContentResolver().delete(uri, null, null); }