use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class TimeLineSlidingWindow method prepareSlotContent.
private void prepareSlotContent(int slotIndex) {
AlbumEntry entry = new AlbumEntry();
// item could be null;
MediaItem item = mSource.get(slotIndex);
entry.item = item;
entry.mediaType = (item == null) ? MediaItem.MEDIA_TYPE_UNKNOWN : entry.item.getMediaType();
entry.path = (item == null) ? null : item.getPath();
entry.rotation = (item == null) ? 0 : item.getRotation();
entry.contentLoader = new ThumbnailLoader(slotIndex, entry.item);
mData[slotIndex % mData.length] = entry;
}
use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class AlbumSlidingWindow method prepareSlotContent.
private void prepareSlotContent(int slotIndex) {
AlbumEntry entry = new AlbumEntry();
// item could be null;
MediaItem item = mSource.get(slotIndex);
entry.item = item;
entry.name = (item == null) ? null : item.getName();
entry.mediaType = (item == null) ? MediaItem.MEDIA_TYPE_UNKNOWN : entry.item.getMediaType();
entry.path = (item == null) ? null : item.getPath();
entry.rotation = (item == null) ? 0 : item.getRotation();
entry.contentLoader = new ThumbnailLoader(slotIndex, entry.item);
if (!mViewType) {
if (entry.labelLoader != null) {
entry.labelLoader.recycle();
entry.labelLoader = null;
entry.labelTexture = null;
}
if (entry.name != null) {
entry.labelLoader = new AlbumLabelLoader(slotIndex, entry.name);
}
}
mData[slotIndex % mData.length] = entry;
}
use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class MediaSetLoader method urisForSubItems.
@Override
public ArrayList<Uri> urisForSubItems(Cursor item) {
int index = item.getInt(AlbumSetLoader.INDEX_ID);
MediaSet ms = mMediaSet.getSubMediaSet(index);
if (ms == null)
return null;
final ArrayList<Uri> result = new ArrayList<Uri>();
ms.enumerateMediaItems(new MediaSet.ItemConsumer() {
@Override
public void consume(int index, MediaItem item) {
if (item != null) {
result.add(item.getContentUri());
}
}
});
return result;
}
use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class MediaSetLoader method loadInBackground.
@Override
public Cursor loadInBackground() {
// TODO: This probably doesn't work
mMediaSet.reload();
final MatrixCursor cursor = new MatrixCursor(AlbumSetLoader.PROJECTION);
final Object[] row = new Object[AlbumSetLoader.PROJECTION.length];
int count = mMediaSet.getSubMediaSetCount();
ArrayList<MediaItem> coverItems = new ArrayList<MediaItem>(count);
for (int i = 0; i < count; i++) {
MediaSet m = mMediaSet.getSubMediaSet(i);
m.reload();
row[AlbumSetLoader.INDEX_ID] = i;
row[AlbumSetLoader.INDEX_TITLE] = m.getName();
row[AlbumSetLoader.INDEX_COUNT] = m.getMediaItemCount();
row[AlbumSetLoader.INDEX_SUPPORTED_OPERATIONS] = m.getSupportedOperations();
MediaItem coverItem = m.getCoverMediaItem();
if (coverItem != null) {
row[AlbumSetLoader.INDEX_TIMESTAMP] = coverItem.getDateInMs();
}
coverItems.add(coverItem);
cursor.addRow(row);
}
synchronized (mMediaSet) {
mCoverItems = coverItems;
}
return cursor;
}
use of com.android.gallery3d.data.MediaItem in project android_packages_apps_Gallery2 by LineageOS.
the class MediaItemsLoader method getPathForItem.
@Override
public Object getPathForItem(Cursor item) {
int index = item.getInt(PhotoSetLoader.INDEX_ID);
MediaItem mi = mMediaItems.get(index);
if (mi != null) {
return mi.getPath();
}
return null;
}
Aggregations