package com.epson.memcardacc;

import android.app.Activity;
import android.content.Intent;
import android.os.Build;

import epson.print.imgsel.ImageFinder;
import epson.print.imgsel.ImageSelectActivity;
import epson.print.imgsel.JpegHeifImageFinder;
import epson.print.imgsel.JpegImageFinder;

import java.util.ArrayList;

public class LocalImageSelectActivity extends ImageSelectActivity {
    private static final int REQUEST_CODE_CONFIRM_WIRTE = 105;

    public boolean singleImageMode() {
        return false;
    }

    public ImageFinder getImageFinder() {
        if (Build.VERSION.SDK_INT >= 28) {
            return new JpegHeifImageFinder();
        }
        return new JpegImageFinder();
    }

    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 105 && i2 == 1) {
            finish();
        }
    }

    protected void goNext() {
        ArrayList<String> fileArrayList = getImageSelector().getFileArrayList();
        if (fileArrayList.size() > 0) {
            startActivityForResult(ConfirmWriteMemcard.getStartIntent(this, fileArrayList), 105);
        }
    }

    public static void startAddImageList(Activity activity, ArrayList<String> arrayList) {
        Intent intent = new Intent(activity, LocalImageSelectActivity.class);
        intent.addFlags(335544320);
        intent.putExtra(ImageSelectActivity.PARAM_SELECTED_FILE_LIST, arrayList);
        activity.startActivity(intent);
    }
}
