/*
 * Copyright 2017 Yan Zhenjie.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sobot.album.api;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.sobot.album.AlbumFile;
import com.sobot.album.SobotAlbum;
import com.sobot.album.app.gallery.GalleryAlbumActivity;
import com.sobot.album.app.preview.PreviewAlbumActivity;


public class GalleryAlbumWrapper extends BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> {

    public GalleryAlbumWrapper(Context context) {
        super(context);
    }

    @Override
    public void start() {
        GalleryAlbumActivity.sResult = mResult;
        GalleryAlbumActivity.sCancel = mCancel;
        GalleryAlbumActivity.sClick = mItemClick;
        GalleryAlbumActivity.sLongClick = mItemLongClick;
        Intent intent = new Intent(mContext, GalleryAlbumActivity.class);
        intent.putExtra(SobotAlbum.KEY_INPUT_WIDGET, mWidget);
        intent.putParcelableArrayListExtra(SobotAlbum.KEY_INPUT_CHECKED_LIST, mChecked);
        intent.putExtra(SobotAlbum.KEY_INPUT_CURRENT_POSITION, mCurrentPosition);
        intent.putExtra(SobotAlbum.KEY_INPUT_GALLERY_CHECKABLE, mCheckable);
        mContext.startActivity(intent);
    }
    public void preview() {
        PreviewAlbumActivity.sResult = mResult;
        PreviewAlbumActivity.sCancel = mCancel;
        PreviewAlbumActivity.sClick = mItemClick;
        PreviewAlbumActivity.sLongClick = mItemLongClick;
        Intent intent = new Intent(mContext, PreviewAlbumActivity.class);
        Bundle bundle = new Bundle();
        bundle.putParcelable(SobotAlbum.KEY_INPUT_WIDGET, mWidget);
        bundle.putParcelableArrayList(SobotAlbum.KEY_INPUT_CHECKED_LIST, mChecked);
        bundle.putInt(SobotAlbum.KEY_INPUT_CURRENT_POSITION, mCurrentPosition);
        bundle.putBoolean(SobotAlbum.KEY_INPUT_GALLERY_CHECKABLE, mCheckable);
        intent.putExtras(bundle);
        mContext.startActivity(intent);
    }
}