Search in sources :

Example 16 with MediaItem

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;
}
Also used : MediaItem(com.android.gallery3d.data.MediaItem) TimeLineTitleMediaItem(com.android.gallery3d.data.TimeLineTitleMediaItem)

Example 17 with MediaItem

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;
}
Also used : MediaItem(com.android.gallery3d.data.MediaItem)

Example 18 with MediaItem

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;
}
Also used : MediaItem(com.android.gallery3d.data.MediaItem) MediaSet(com.android.gallery3d.data.MediaSet) ArrayList(java.util.ArrayList) Uri(android.net.Uri)

Example 19 with MediaItem

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;
}
Also used : MediaItem(com.android.gallery3d.data.MediaItem) MediaSet(com.android.gallery3d.data.MediaSet) ArrayList(java.util.ArrayList) MediaObject(com.android.gallery3d.data.MediaObject) MatrixCursor(android.database.MatrixCursor)

Example 20 with MediaItem

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;
}
Also used : MediaItem(com.android.gallery3d.data.MediaItem)

Aggregations

MediaItem (com.android.gallery3d.data.MediaItem)37 MediaSet (com.android.gallery3d.data.MediaSet)9 LocalMediaItem (com.android.gallery3d.data.LocalMediaItem)8 Path (com.android.gallery3d.data.Path)8 Intent (android.content.Intent)6 Uri (android.net.Uri)3 Bundle (android.os.Bundle)3 TiledScreenNail (com.android.gallery3d.ui.TiledScreenNail)3 ArrayList (java.util.ArrayList)3 Activity (android.app.Activity)2 MatrixCursor (android.database.MatrixCursor)2 View (android.view.View)2 ThreeDimensionalActivity (com.android.gallery3d.app.dualcam3d.ThreeDimensionalActivity)2 ClusterAlbum (com.android.gallery3d.data.ClusterAlbum)2 DataManager (com.android.gallery3d.data.DataManager)2 MediaObject (com.android.gallery3d.data.MediaObject)2 FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)2 BitmapScreenNail (com.android.gallery3d.ui.BitmapScreenNail)2 ScreenNail (com.android.gallery3d.ui.ScreenNail)2 ResolveInfo (android.content.pm.ResolveInfo)1