package epson.print.imgsel;

import android.app.Activity;
import android.content.Intent;
import com.epson.iprint.apf.ApfPreviewView;
import com.epson.iprint.prtlogger.PrintLog;
import epson.print.ActivityViewImageSelect;
import java.util.ArrayList;

public class PhotoImageSelectActivity extends ImageSelectActivity {
    private static final int REQUEST_CODE_PREVIEW = 103;

    public boolean showNfcInvalidMessageOnPagerActivity() {
        return true;
    }

    public boolean singleImageMode() {
        return false;
    }

    public ImageFinder getImageFinder() {
        return new PhotoImageFinder();
    }

    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 103 && intent != null) {
            ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("imageList");
            if (i2 == 22) {
                popFragmentStackToFolderView();
            }
            if (stringArrayListExtra != null) {
                refreshSelector(stringArrayListExtra);
            }
        }
    }

    private void popFragmentStackToFolderView() {
        getSupportFragmentManager().popBackStackImmediate();
    }

    protected void goNext() {
        Intent intent = new Intent(this, ActivityViewImageSelect.class);
        intent.putExtra("imageList", getImageSelector().getFileArrayList());
        intent.putExtra(ActivityViewImageSelect.PARAMS_KEY_EPSON_COLOR_MODE, true);
        intent.putExtra("print_log", getPrintLog());
        startActivityForResult(intent, 103);
    }

    private PrintLog getPrintLog() {
        PrintLog printLog = new PrintLog();
        printLog.uiRoute = 1;
        return printLog;
    }

    protected void onPause() {
        if (isFinishing()) {
            ApfPreviewView.deleteWorkingDirectory(this);
        }
        super.onPause();
    }

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