Search in sources :

Example 1 with ClusterAlbum

use of com.android.gallery3d.data.ClusterAlbum in project android_packages_apps_Gallery2 by LineageOS.

the class TimeLinePage method onLongTap.

public void onLongTap(int slotIndex, boolean isTitle) {
    if (mGetContent)
        return;
    if (isTitle) {
        MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex);
        if (targetSet == null)
            return;
        ArrayList<Path> paths = ((ClusterAlbum) targetSet).getMediaItems();
        if (paths == null || paths.size() <= 0)
            return;
        mSelectionManager.setAutoLeaveSelectionMode(true);
        mSelectionManager.toggleTimeLineSet(paths);
        mSlotView.invalidate();
    } else {
        MediaItem item = mAlbumDataAdapter.get(slotIndex);
        if (item == null)
            return;
        mSelectionManager.setAutoLeaveSelectionMode(true);
        mSelectionManager.toggle(item.getPath());
        mSlotView.invalidate();
    }
}
Also used : Path(com.android.gallery3d.data.Path) ClusterAlbum(com.android.gallery3d.data.ClusterAlbum) MediaItem(com.android.gallery3d.data.MediaItem) MediaSet(com.android.gallery3d.data.MediaSet)

Example 2 with ClusterAlbum

use of com.android.gallery3d.data.ClusterAlbum in project android_packages_apps_Gallery2 by LineageOS.

the class TimeLinePage method onSingleTapUp.

private void onSingleTapUp(int slotIndex, boolean isTitle) {
    if (!mIsActive)
        return;
    if (mSelectionManager.inSelectionMode()) {
        if (isTitle) {
            MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex);
            if (targetSet == null)
                return;
            ArrayList<Path> paths = ((ClusterAlbum) targetSet).getMediaItems();
            if (paths == null || paths.size() <= 0)
                return;
            mSelectionManager.toggleTimeLineSet(paths);
            mSlotView.invalidate();
        } else {
            MediaItem item = mAlbumDataAdapter.get(slotIndex);
            // Item not ready yet, ignore the click
            if (item == null)
                return;
            if (mSelectionManager.getSelectedCount() > 0) {
                if (!ActionModeHandler.isThreadComplete)
                    return;
            }
            mSelectionManager.toggle(item.getPath());
            mSlotView.invalidate();
        }
    } else if (!isTitle) {
        // Render transition in pressed state
        mAlbumView.setPressedIndex(slotIndex);
        mAlbumView.setPressedUp();
        mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), FadeTexture.DURATION);
    }
}
Also used : Path(com.android.gallery3d.data.Path) ClusterAlbum(com.android.gallery3d.data.ClusterAlbum) MediaItem(com.android.gallery3d.data.MediaItem) MediaSet(com.android.gallery3d.data.MediaSet)

Aggregations

ClusterAlbum (com.android.gallery3d.data.ClusterAlbum)2 MediaItem (com.android.gallery3d.data.MediaItem)2 MediaSet (com.android.gallery3d.data.MediaSet)2 Path (com.android.gallery3d.data.Path)2