use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class SelectionManager method getSelected.
public ArrayList<Path> getSelected(boolean expandSet, int maxSelection) {
ArrayList<Path> selected = new ArrayList<Path>();
if (mIsAlbumSet) {
if (mInverseSelection) {
int total = getTotalCount();
for (int i = 0; i < total; i++) {
MediaSet set = mSourceMediaSet.getSubMediaSet(i);
Path id = set.getPath();
if (!mClickedSet.contains(id)) {
if (expandSet) {
if (!expandMediaSet(selected, set, maxSelection)) {
return null;
}
} else {
addPathIfSelectable(selected, id);
if (selected.size() > maxSelection) {
return null;
}
}
}
}
} else {
for (Path id : mClickedSet) {
if (expandSet) {
if (!expandMediaSet(selected, mDataManager.getMediaSet(id), maxSelection)) {
return null;
}
} else {
addPathIfSelectable(selected, id);
if (selected.size() > maxSelection) {
return null;
}
}
}
}
} else {
if (mInverseSelection) {
int total = getTotalCount();
int index = 0;
while (index < total) {
int count = Math.min(total - index, MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
ArrayList<MediaItem> list = mSourceMediaSet.getMediaItem(index, count);
for (MediaItem item : list) {
Path id = item.getPath();
if (!mClickedSet.contains(id)) {
addPathIfSelectable(selected, id);
if (selected.size() > maxSelection) {
return null;
}
}
}
index += count;
}
} else {
for (Path id : mClickedSet) {
addPathIfSelectable(selected, id);
if (selected.size() > maxSelection) {
return null;
}
}
}
}
return selected;
}
use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class AlbumSetSlidingWindow method updateAlbumSetEntry.
private void updateAlbumSetEntry(AlbumSetEntry entry, int slotIndex) {
MediaSet album = mSource.getMediaSet(slotIndex);
MediaItem cover = mSource.getCoverItem(slotIndex);
int totalCount = mSource.getTotalCount(slotIndex);
entry.album = album;
entry.setDataVersion = getDataVersion(album);
entry.cacheFlag = identifyCacheFlag(album);
entry.cacheStatus = identifyCacheStatus(album);
entry.setPath = (album == null) ? null : album.getPath();
String title = (album == null) ? "" : Utils.ensureNotNull(album.getName());
int sourceType = DataSourceType.identifySourceType(album);
if (isLabelChanged(entry, title, totalCount, sourceType)) {
entry.title = title;
entry.totalCount = totalCount;
entry.sourceType = sourceType;
if (entry.labelLoader != null) {
entry.labelLoader.recycle();
entry.labelLoader = null;
entry.labelTexture = null;
}
if (album != null) {
entry.labelLoader = new AlbumLabelLoader(slotIndex, title, totalCount, sourceType);
}
}
entry.coverItem = cover;
if (getDataVersion(cover) != entry.coverDataVersion) {
entry.coverDataVersion = getDataVersion(cover);
entry.rotation = (cover == null) ? 0 : cover.getRotation();
if (entry.coverLoader != null) {
entry.coverLoader.recycle();
entry.coverLoader = null;
entry.bitmapTexture = null;
entry.content = null;
}
if (cover != null) {
entry.coverLoader = new AlbumCoverLoader(slotIndex, cover);
}
}
}
Aggregations