-
Notifications
You must be signed in to change notification settings - Fork 3k
PictureSelector 3.0 如何加载自定义数据源?
Luck edited this page Jun 12, 2022
·
4 revisions
v3.10.2版本,请使用如下方式
.setLoaderFactoryEngine(new IBridgeLoaderFactory() {
@Override
public IBridgeMediaLoader onCreateLoader() {
return new IBridgeMediaLoader() {
@Override
public String getAlbumFirstCover(long bucketId) {
return null;
}
@Override
public void loadAllAlbum(OnQueryAllAlbumListener<LocalMediaFolder> query) {
}
@Override
public void loadPageMediaData(long bucketId, int page, int pageSize, OnQueryDataResultListener<LocalMedia> query) {
}
@Override
public void loadOnlyInAppDirAllMedia(OnQueryAlbumListener<LocalMediaFolder> query) {
}
@Override
protected String getSelection() {
return null;
}
@Override
protected String[] getSelectionArgs() {
return new String[0];
}
@Override
protected String getSortOrder() {
return null;
}
};
}
});
*注意:v3.10.2版本已弃用
.setExtendLoaderEngine(new ExtendLoaderEngine() {
@Override
public void loadAllAlbumData(Context context, OnQueryAllAlbumListener<LocalMediaFolder> query) {
// 获取专辑列表数据源
}
@Override
public void loadOnlyInAppDirAllMediaData(Context context, OnQueryAlbumListener<LocalMediaFolder> query) {
// 获取指定app目录下的数据源
}
@Override
public void loadFirstPageMediaData(Context context, long bucketId, int page, int pageSize, OnQueryDataResultListener<LocalMedia> query) {
// 分页模式下获取首个目录下第一页数据
}
@Override
public void loadMoreMediaData(Context context, long bucketId, int page, int limit, int pageSize, OnQueryDataResultListener<LocalMedia> query) {
// 分页模式下获取更多数据
}
});