Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32bb9c56 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

Gallery: Fix filmstrip source index



Change-Id: I0213871f47fb386ddce5728f0079eb7884e6d9d4
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 73861e46
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -18,4 +18,9 @@ package com.android.gallery3d.app;

public class FilmstripPage extends PhotoPage {

    @Override
    protected int getStartSourceIndex() {
        // The camera itself
        return 1;
    }
}
+10 −13
Original line number Diff line number Diff line
@@ -164,8 +164,6 @@ public abstract class PhotoPage extends ActivityState implements
    private boolean mHasCameraScreennailOrPlaceholder = false;
    private boolean mRecenterCameraOnResume = true;

    private int mGalleryMode = GalleryActionBar.ALBUM_FILMSTRIP_MODE_SELECTED;

    // These are only valid after the panorama callback
    private boolean mIsPanorama;
    private boolean mIsPanorama360;
@@ -606,6 +604,13 @@ public abstract class PhotoPage extends ActivityState implements
        return mIsActive && !mPhotoView.canUndo();
    }

    /**
     * Returns the start source index of the album
     */
    protected int getStartSourceIndex() {
        return 0;
    }

    @Override
    public boolean canDisplayBottomControl(int control) {
        if (mCurrentPhoto == null) {
@@ -1505,26 +1510,18 @@ public abstract class PhotoPage extends ActivityState implements

        @Override
        public int size() {
            if (mMediaSet == null) {
                return 1;
            }
            return (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED)
                        ? mMediaSet.getMediaItemCount()
                        : mMediaSet.getMediaItemCount() - 1;
            return mMediaSet != null ? mMediaSet.getMediaItemCount() - getStartSourceIndex() : 1;
        }

        @Override
        public int setIndex() {
            return (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED)
                        ? mModel.getCurrentIndex()
                        : mModel.getCurrentIndex() - 1;
            return mModel.getCurrentIndex() - getStartSourceIndex();
        }
    }

    @Override
    public void onAlbumModeSelected(int mode) {
        mGalleryMode = mode;
        if (mGalleryMode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) {
        if (mode == GalleryActionBar.ALBUM_GRID_MODE_SELECTED) {
            switchToGrid();
        }
    }