123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- package com.epson.cameracopy.p006ui;
- import android.content.Intent;
- import android.graphics.Point;
- import android.os.Bundle;
- import android.support.p000v4.app.Fragment;
- import android.view.LayoutInflater;
- import android.view.Menu;
- import android.view.MenuInflater;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.CompoundButton;
- import android.widget.LinearLayout;
- import android.widget.Switch;
- import android.widget.TextView;
- import com.epson.cameracopy.device.CameraPreviewControl;
- import com.epson.cameracopy.p006ui.PictureResolutionDialogFragment;
- import epson.print.ActivityIACommon;
- import epson.print.C2135R;
- import java.io.File;
- /* renamed from: com.epson.cameracopy.ui.CameraPreviewOptionActivity */
- public class CameraPreviewOptionActivity extends ActivityIACommon implements PictureResolutionDialogFragment.OnItemSelectedListener {
- private static final int CODE_DIRECTORY_SELECT = 1;
- PlaceholderFragment mFragment;
- /* access modifiers changed from: protected */
- public void onCreate(Bundle bundle) {
- super.onCreate(bundle);
- setContentView((int) C2135R.layout.activity_camera_preview_option);
- setActionBar((int) C2135R.string.camera_option_title, true);
- if (bundle == null) {
- this.mFragment = new PlaceholderFragment();
- getSupportFragmentManager().beginTransaction().add((int) C2135R.C2137id.container, (Fragment) this.mFragment).commit();
- }
- }
- public void onItemSelected(boolean z, int i, Point point) {
- PlaceholderFragment placeholderFragment;
- if (z && (placeholderFragment = this.mFragment) != null) {
- placeholderFragment.changeSelectedCameraPictureResolution(i, point);
- }
- }
- /* renamed from: com.epson.cameracopy.ui.CameraPreviewOptionActivity$PlaceholderFragment */
- public static class PlaceholderFragment extends Fragment {
- Switch mAutoPhotoToggleButton;
- private int mCameraPictureResolutionMode;
- private Point mCameraPictureSize;
- private CameraPreviewControl mCameraPreviewControl;
- Switch mGuideToggleButton;
- private TextView mPictureResolutionText;
- String mSaveDirectoryName;
- private TextView mSaveDirectoryText;
- public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
- View inflate = layoutInflater.inflate(C2135R.layout.fragment_camera_preview_option, viewGroup, false);
- this.mCameraPreviewControl = CameraPreviewControl.getInstance(getActivity());
- setHasOptionsMenu(true);
- this.mGuideToggleButton = (Switch) inflate.findViewById(C2135R.C2137id.guideToggleButton);
- this.mGuideToggleButton.setChecked(this.mCameraPreviewControl.getGuideMode());
- this.mGuideToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
- PlaceholderFragment.this.changeAutoPhotoToggleButtonStatus(z);
- }
- });
- this.mAutoPhotoToggleButton = (Switch) inflate.findViewById(C2135R.C2137id.autoPictureToggleButton);
- this.mAutoPhotoToggleButton.setChecked(this.mCameraPreviewControl.getAutoPictureMode());
- changeAutoPhotoToggleButtonStatus(this.mGuideToggleButton.isChecked());
- ((LinearLayout) inflate.findViewById(C2135R.C2137id.save_directory_layout)).setOnClickListener(new View.OnClickListener() {
- public void onClick(View view) {
- PlaceholderFragment.this.startSaveDirectoryActivity();
- }
- });
- this.mSaveDirectoryText = (TextView) inflate.findViewById(C2135R.C2137id.saveDirectoryText);
- setSaveDirectoryText(this.mCameraPreviewControl.getSaveDirecotry());
- inflate.findViewById(C2135R.C2137id.picture_resolution_layout).setOnClickListener(new View.OnClickListener() {
- public void onClick(View view) {
- PlaceholderFragment.this.openPictureResolutionDialog();
- }
- });
- this.mPictureResolutionText = (TextView) inflate.findViewById(C2135R.C2137id.pictureResolutionText);
- setCameraPictureResolutionModeFromCameraPreviewControl();
- setPictureResolutionText();
- return inflate;
- }
- public void changeSelectedCameraPictureResolution(int i, Point point) {
- this.mCameraPictureResolutionMode = i;
- if (this.mCameraPictureResolutionMode == 0) {
- this.mCameraPictureSize = null;
- } else {
- this.mCameraPictureSize = point;
- }
- setPictureResolutionText();
- }
- private void setPictureResolutionText() {
- if (this.mCameraPictureResolutionMode == 0) {
- this.mPictureResolutionText.setText(C2135R.string.picture_size_auto);
- return;
- }
- Point point = this.mCameraPictureSize;
- if (point == null || point.x <= 0 || this.mCameraPictureSize.y <= 0) {
- this.mPictureResolutionText.setText("");
- return;
- }
- this.mPictureResolutionText.setText(CameraPreviewControl.getPictureSizeString(this.mCameraPictureSize.x, this.mCameraPictureSize.y));
- }
- private void setCameraPictureResolutionModeFromCameraPreviewControl() {
- this.mCameraPictureResolutionMode = this.mCameraPreviewControl.getPictureResolutionMode();
- this.mCameraPictureSize = null;
- if (this.mCameraPictureResolutionMode == 1) {
- this.mCameraPictureSize = this.mCameraPreviewControl.getPictureSize();
- }
- }
- /* access modifiers changed from: private */
- public void openPictureResolutionDialog() {
- PictureResolutionDialogFragment.newInstance(this.mCameraPictureResolutionMode, this.mCameraPictureSize).show(getActivity().getSupportFragmentManager(), "picture-resolution");
- }
- private void changeValueAndFinish() {
- this.mCameraPreviewControl.setGuideMode(this.mGuideToggleButton.isChecked());
- this.mCameraPreviewControl.setAutoPictureMode(Boolean.valueOf(this.mAutoPhotoToggleButton.isChecked()));
- this.mCameraPreviewControl.setSaveDirecotry(this.mSaveDirectoryName);
- if (this.mCameraPictureResolutionMode == 0) {
- this.mCameraPreviewControl.setPictureResolutionModeAuto();
- } else {
- this.mCameraPreviewControl.setPictureSize(this.mCameraPictureSize);
- }
- getActivity().finish();
- }
- /* access modifiers changed from: private */
- public void changeAutoPhotoToggleButtonStatus(boolean z) {
- if (z && this.mCameraPreviewControl.hasAutoPictureHardware(getActivity())) {
- this.mAutoPhotoToggleButton.setEnabled(true);
- return;
- }
- this.mAutoPhotoToggleButton.setChecked(false);
- this.mAutoPhotoToggleButton.setEnabled(false);
- }
- private void setSaveDirectoryText(String str) {
- this.mSaveDirectoryName = str;
- this.mSaveDirectoryText.setText(new File(this.mSaveDirectoryName).getName());
- }
- public void startSaveDirectoryActivity() {
- startActivityForResult(new Intent(getActivity(), FolderSelectActivity.class), 1);
- }
- public void onActivityResult(int i, int i2, Intent intent) {
- if (i == 1) {
- if (i2 == -1 && intent != null) {
- String stringExtra = intent.getStringExtra("SELECT_Folder");
- if (stringExtra != null) {
- setSaveDirectoryText(stringExtra);
- }
- } else if (i2 == 1) {
- SimpleMessageDialogFragment.newInstance(C2135R.string.file_save_error_message).show(getFragmentManager(), "error-dialog");
- }
- }
- }
- public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
- menuInflater.inflate(C2135R.C2138menu.menu_done, menu);
- super.onCreateOptionsMenu(menu, menuInflater);
- }
- public boolean onOptionsItemSelected(MenuItem menuItem) {
- if (menuItem.getItemId() != C2135R.C2137id.menuSettingsDone) {
- return super.onOptionsItemSelected(menuItem);
- }
- changeValueAndFinish();
- return true;
- }
- }
- }
|