PictureResolutionDialogFragment.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package com.epson.cameracopy.ui;
  2. import android.app.Service;
  3. import android.content.Context;
  4. import android.graphics.Point;
  5. import android.os.Bundle;
  6. import android.view.LayoutInflater;
  7. import android.view.View;
  8. import android.view.ViewGroup;
  9. import android.widget.ArrayAdapter;
  10. import android.widget.ImageView;
  11. import android.widget.TextView;
  12. import com.epson.cameracopy.device.CameraPreviewControl;
  13. import java.util.Collections;
  14. import java.util.List;
  15. import epson.print.R;
  16. /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment */
  17. public class PictureResolutionDialogFragment extends DialogFragment {
  18. private static final String KEY_CAMERA_PICTURE_RESOLUTION_MODE = "picture_resolution_mode";
  19. private static final String KEY_CAMERA_PICTURE_SIZE = "picture_size";
  20. private static final int MANUAL_SIZE_START_INDEX = 1;
  21. private List<Point> mSizeList;
  22. /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$OnItemSelectedListener */
  23. interface OnItemSelectedListener {
  24. void onItemSelected(boolean z, int i, Point point);
  25. }
  26. public static PictureResolutionDialogFragment newInstance(int i, Point point) {
  27. PictureResolutionDialogFragment pictureResolutionDialogFragment = new PictureResolutionDialogFragment();
  28. Bundle bundle = new Bundle();
  29. bundle.putInt(KEY_CAMERA_PICTURE_RESOLUTION_MODE, i);
  30. if (point != null) {
  31. bundle.putIntArray(KEY_CAMERA_PICTURE_SIZE, new int[]{point.x, point.y});
  32. }
  33. pictureResolutionDialogFragment.setArguments(bundle);
  34. return pictureResolutionDialogFragment;
  35. }
  36. public android.app.Dialog onCreateDialog(android.os.Bundle r7) {
  37. throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.PictureResolutionDialogFragment.onCreateDialog(android.os.Bundle):android.app.Dialog");
  38. }
  39. public void onActivityCreated(Bundle bundle) {
  40. super.onActivityCreated(bundle);
  41. }
  42. private List<Point> getPictureSizeList() {
  43. List<Point> cameraPictureSizes = CameraPreviewControl.getInstance(getActivity()).getCameraPictureSizes();
  44. if (cameraPictureSizes == null) {
  45. return null;
  46. }
  47. Collections.sort(cameraPictureSizes, new AreaComparator());
  48. return cameraPictureSizes;
  49. }
  50. private int getListPoisition(int i, Point point, List<Point> list) {
  51. int indexOf;
  52. if (i != 1 || point == null || (indexOf = mSizeList.indexOf(point)) < 0) {
  53. return 0;
  54. }
  55. return indexOf + 1;
  56. }
  57. private CharSequence[] getPictureSizeStrList(List<Point> list) {
  58. String[] strArr = new String[((list != null ? list.size() : 0) + 1)];
  59. strArr[0] = getActivity().getResources().getString(R.string.picture_size_auto);
  60. if (list == null) {
  61. return strArr;
  62. }
  63. int i = 1;
  64. for (Point next : list) {
  65. strArr[i] = CameraPreviewControl.getPictureSizeString(next.x, next.y);
  66. i++;
  67. }
  68. return strArr;
  69. }
  70. private void selectListItem(int i) {
  71. OnItemSelectedListener onItemSelectedListener = (OnItemSelectedListener) getActivity();
  72. List<Point> list = mSizeList;
  73. if (list == null) {
  74. onItemSelectedListener.onItemSelected(false, -1, (Point) null);
  75. } else if (i == 0) {
  76. onItemSelectedListener.onItemSelected(true, 0, (Point) null);
  77. } else {
  78. try {
  79. onItemSelectedListener.onItemSelected(true, 1, list.get(i - 1));
  80. } catch (IndexOutOfBoundsException unused) {
  81. }
  82. }
  83. }
  84. /* renamed from: com.epson.cameracopy.ui.PictureResolutionDialogFragment$MyAdapter */
  85. static class MyAdapter extends ArrayAdapter<CharSequence> {
  86. LayoutInflater mLayoutInflater;
  87. int mSelectNumber;
  88. public MyAdapter(Context context, int i, CharSequence[] charSequenceArr, int i2) {
  89. super(context, i, charSequenceArr);
  90. mLayoutInflater = (LayoutInflater) context.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
  91. mSelectNumber = i2;
  92. }
  93. public View getView(int i, View view, ViewGroup viewGroup) {
  94. if (view == null) {
  95. view = mLayoutInflater.inflate(R.layout.select_list_row, viewGroup, false);
  96. }
  97. ((TextView) view.findViewById(R.id.docsize_name)).setText((CharSequence) getItem(i));
  98. ImageView imageView = (ImageView) view.findViewById(R.id.current_docsize_image);
  99. if (i != mSelectNumber) {
  100. imageView.setVisibility(4);
  101. } else {
  102. imageView.setVisibility(View.VISIBLE);
  103. }
  104. return view;
  105. }
  106. }
  107. }