package com.epson.cameracopy.ui; import android.app.Service; import android.content.Context; import android.graphics.Point; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.epson.cameracopy.device.CameraPreviewControl; import java.util.Collections; import java.util.List; import epson.print.R; /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment */ public class PictureResolutionDialogFragment extends DialogFragment { private static final String KEY_CAMERA_PICTURE_RESOLUTION_MODE = "picture_resolution_mode"; private static final String KEY_CAMERA_PICTURE_SIZE = "picture_size"; private static final int MANUAL_SIZE_START_INDEX = 1; private List mSizeList; /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$OnItemSelectedListener */ interface OnItemSelectedListener { void onItemSelected(boolean z, int i, Point point); } public static PictureResolutionDialogFragment newInstance(int i, Point point) { PictureResolutionDialogFragment pictureResolutionDialogFragment = new PictureResolutionDialogFragment(); Bundle bundle = new Bundle(); bundle.putInt(KEY_CAMERA_PICTURE_RESOLUTION_MODE, i); if (point != null) { bundle.putIntArray(KEY_CAMERA_PICTURE_SIZE, new int[]{point.x, point.y}); } pictureResolutionDialogFragment.setArguments(bundle); return pictureResolutionDialogFragment; } public android.app.Dialog onCreateDialog(android.os.Bundle r7) { throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.PictureResolutionDialogFragment.onCreateDialog(android.os.Bundle):android.app.Dialog"); } public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); } private List getPictureSizeList() { List cameraPictureSizes = CameraPreviewControl.getInstance(getActivity()).getCameraPictureSizes(); if (cameraPictureSizes == null) { return null; } Collections.sort(cameraPictureSizes, new AreaComparator()); return cameraPictureSizes; } private int getListPoisition(int i, Point point, List list) { int indexOf; if (i != 1 || point == null || (indexOf = mSizeList.indexOf(point)) < 0) { return 0; } return indexOf + 1; } private CharSequence[] getPictureSizeStrList(List list) { String[] strArr = new String[((list != null ? list.size() : 0) + 1)]; strArr[0] = getActivity().getResources().getString(R.string.picture_size_auto); if (list == null) { return strArr; } int i = 1; for (Point next : list) { strArr[i] = CameraPreviewControl.getPictureSizeString(next.x, next.y); i++; } return strArr; } private void selectListItem(int i) { OnItemSelectedListener onItemSelectedListener = (OnItemSelectedListener) getActivity(); List list = mSizeList; if (list == null) { onItemSelectedListener.onItemSelected(false, -1, (Point) null); } else if (i == 0) { onItemSelectedListener.onItemSelected(true, 0, (Point) null); } else { try { onItemSelectedListener.onItemSelected(true, 1, list.get(i - 1)); } catch (IndexOutOfBoundsException unused) { } } } /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$MyAdapter */ static class MyAdapter extends ArrayAdapter { LayoutInflater mLayoutInflater; int mSelectNumber; public MyAdapter(Context context, int i, CharSequence[] charSequenceArr, int i2) { super(context, i, charSequenceArr); mLayoutInflater = (LayoutInflater) context.getSystemService(Service.LAYOUT_INFLATER_SERVICE); mSelectNumber = i2; } public View getView(int i, View view, ViewGroup viewGroup) { if (view == null) { view = mLayoutInflater.inflate(R.layout.select_list_row, viewGroup, false); } ((TextView) view.findViewById(R.id.docsize_name)).setText((CharSequence) getItem(i)); ImageView imageView = (ImageView) view.findViewById(R.id.current_docsize_image); if (i != mSelectNumber) { imageView.setVisibility(4); } else { imageView.setVisibility(View.VISIBLE); } return view; } } }