Back to project page PhotoPicker.
The source code is released under:
GNU General Public License
If you think the Android project PhotoPicker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.thuytrinh.photopicker.controller; /* w ww . j av a 2 s . c o m*/ import android.database.Cursor; import android.database.MatrixCursor; import java.util.HashSet; import java.util.Set; import rx.functions.Func1; public class GroupByBucketIdFunc implements Func1<Cursor, Cursor> { @Override public Cursor call(Cursor imageCursor) { MatrixCursor bucketCursor = new MatrixCursor( imageCursor.getColumnNames(), imageCursor.getCount() ); Set<Long> seenBucketIdSet = new HashSet<>(); ImageCursorMapper imageCursorMapper = new ImageCursorMapper(imageCursor); long bucketId; while (imageCursor.moveToNext()) { bucketId = imageCursorMapper.getBucketId(); if (!seenBucketIdSet.contains(bucketId)) { bucketCursor.addRow(new Object[] { imageCursorMapper.getId(), imageCursorMapper.getBucketId(), imageCursorMapper.getBucketDisplayName(), imageCursorMapper.getData() }); seenBucketIdSet.add(bucketId); } } return bucketCursor; } }