diff --git a/app/src/main/java/com/simplemobiletools/camera/Config.java b/app/src/main/java/com/simplemobiletools/camera/Config.java index 200d8c19..b2ebb740 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Config.java +++ b/app/src/main/java/com/simplemobiletools/camera/Config.java @@ -30,14 +30,6 @@ public class Config { mPrefs.edit().putBoolean(Constants.IS_DARK_THEME, isDarkTheme).apply(); } - public boolean getLongTapEnabled() { - return mPrefs.getBoolean(Constants.LONG_TAP, true); - } - - public void setLongTapEnabled(boolean enabled) { - mPrefs.edit().putBoolean(Constants.LONG_TAP, enabled).apply(); - } - public boolean getFocusBeforeCaptureEnabled() { return mPrefs.getBoolean(Constants.FOCUS_BEFORE_CAPTURE, false); } diff --git a/app/src/main/java/com/simplemobiletools/camera/Constants.java b/app/src/main/java/com/simplemobiletools/camera/Constants.java index 86ac9fb7..3cb308e0 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Constants.java +++ b/app/src/main/java/com/simplemobiletools/camera/Constants.java @@ -9,7 +9,6 @@ public class Constants { public static final String PREFS_KEY = "Camera"; public static final String IS_FIRST_RUN = "is_first_run"; public static final String IS_DARK_THEME = "is_dark_theme"; - public static final String LONG_TAP = "long_tap"; public static final String FOCUS_BEFORE_CAPTURE = "focus_before_capture"; public static final String SOUND = "sound"; public static final String FORCE_RATIO = "force_ratio"; diff --git a/app/src/main/java/com/simplemobiletools/camera/Preview.java b/app/src/main/java/com/simplemobiletools/camera/Preview.java index 427ca70e..48fadae5 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Preview.java +++ b/app/src/main/java/com/simplemobiletools/camera/Preview.java @@ -16,7 +16,6 @@ import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; -import android.view.View.OnLongClickListener; import android.view.ViewGroup; import com.simplemobiletools.camera.activities.MainActivity; @@ -29,8 +28,8 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.OnTouchListener, OnLongClickListener, View.OnClickListener, - MediaScannerConnection.OnScanCompletedListener { +public class Preview extends ViewGroup + implements SurfaceHolder.Callback, View.OnTouchListener, View.OnClickListener, MediaScannerConnection.OnScanCompletedListener { private static final String TAG = Preview.class.getSimpleName(); private static final int FOCUS_AREA_SIZE = 100; private static final int PHOTO_PREVIEW_LENGTH = 1000; @@ -48,6 +47,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O private static String mCurVideoPath; private static Point mScreenSize; private static Uri mTargetUri; + private static Context mContext; private static boolean mCanTakePicture; private static boolean mIsFlashEnabled; @@ -85,6 +85,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O mSetupPreviewAfterMeasure = false; mCurVideoPath = ""; mScreenSize = Utils.getScreenSize(mActivity); + mContext = getContext(); } public void trySwitchToVideo() { @@ -102,7 +103,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O newCamera = Camera.open(cameraId); mCallback.setIsCameraAvailable(true); } catch (Exception e) { - Utils.showToast(getContext(), R.string.camera_open_error); + Utils.showToast(mContext, R.string.camera_open_error); Log.e(TAG, "setCamera open " + e.getMessage()); mCallback.setIsCameraAvailable(false); return false; @@ -146,10 +147,9 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O initRecorder(); } - final Config config = Config.newInstance(getContext()); + final Config config = Config.newInstance(mContext); mFocusBeforeCapture = config.getFocusBeforeCaptureEnabled(); mForceAspectRatio = config.getForceRatioEnabled(); - mSurfaceView.setOnLongClickListener(config.getLongTapEnabled() ? this : null); return true; } @@ -222,7 +222,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O mParameters.setPictureSize(maxSize.width, maxSize.height); mParameters.setRotation(rotation % 360); - if (Config.newInstance(getContext()).getIsSoundEnabled()) { + if (Config.newInstance(mContext).getIsSoundEnabled()) { new MediaActionSound().play(MediaActionSound.SHUTTER_CLICK); } @@ -276,7 +276,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O } private int getMaxPhotoResolution() { - final int maxRes = Config.newInstance(getContext()).getMaxPhotoResolution(); + final int maxRes = Config.newInstance(mContext).getMaxPhotoResolution(); switch (maxRes) { case 0: return 6000000; @@ -292,7 +292,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O } private int getMaxVideoResolution() { - final int maxRes = Config.newInstance(getContext()).getMaxVideoResolution(); + final int maxRes = Config.newInstance(mContext).getMaxVideoResolution(); switch (maxRes) { case 0: return 400000; @@ -330,7 +330,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O } if (i == cnt - 1) { - Utils.showToast(getContext(), R.string.no_valid_resolution_found); + Utils.showToast(mContext, R.string.no_valid_resolution_found); } } return maxSize; @@ -601,9 +601,9 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O mRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); mRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); - mCurVideoPath = Utils.getOutputMediaFile(getContext(), false); + mCurVideoPath = Utils.getOutputMediaFile(mContext, false); if (mCurVideoPath.isEmpty()) { - Utils.showToast(getContext(), R.string.video_creating_error); + Utils.showToast(mContext, R.string.video_creating_error); return false; } @@ -622,7 +622,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O try { mRecorder.prepare(); } catch (Exception e) { - Utils.showToast(getContext(), R.string.video_setup_error); + Utils.showToast(mContext, R.string.video_setup_error); Log.e(TAG, "initRecorder " + e.getMessage()); releaseCamera(); return false; @@ -651,7 +651,7 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O mRecorder.start(); mIsRecording = true; } catch (Exception e) { - Utils.showToast(getContext(), R.string.video_setup_error); + Utils.showToast(mContext, R.string.video_setup_error); Log.e(TAG, "toggleRecording " + e.getMessage()); releaseCamera(); } @@ -662,10 +662,10 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O try { mRecorder.stop(); final String[] paths = {mCurVideoPath}; - MediaScannerConnection.scanFile(getContext(), paths, null, this); + MediaScannerConnection.scanFile(mContext, paths, null, this); } catch (RuntimeException e) { new File(mCurVideoPath).delete(); - Utils.showToast(getContext(), R.string.video_saving_error); + Utils.showToast(mContext, R.string.video_saving_error); Log.e(TAG, "stopRecording " + e.getMessage()); mRecorder = null; mIsRecording = false; @@ -682,12 +682,6 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O } } - @Override - public boolean onLongClick(View v) { - mCallback.activateShutter(); - return true; - } - @Override public void onClick(View v) { focusArea(false); @@ -712,8 +706,6 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O void setIsCameraAvailable(boolean available); - void activateShutter(); - int getCurrentOrientation(); void videoSaved(Uri uri); diff --git a/app/src/main/java/com/simplemobiletools/camera/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/camera/activities/MainActivity.java index ec038ec2..118c57a0 100644 --- a/app/src/main/java/com/simplemobiletools/camera/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/camera/activities/MainActivity.java @@ -590,11 +590,6 @@ public class MainActivity extends SimpleActivity mIsCameraAvailable = available; } - @Override - public void activateShutter() { - handleShutter(); - } - @Override public int getCurrentOrientation() { return mOrientation; diff --git a/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java b/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java index 4978abf0..d6f28d7f 100644 --- a/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java +++ b/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java @@ -18,7 +18,6 @@ import butterknife.OnItemSelected; public class SettingsActivity extends SimpleActivity { @BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch; - @BindView(R.id.settings_long_tap) SwitchCompat mLongTapSwitch; @BindView(R.id.settings_focus_before_capture) SwitchCompat mFocusBeforeCaptureSwitch; @BindView(R.id.settings_sound) SwitchCompat mSoundSwitch; @BindView(R.id.settings_force_ratio) SwitchCompat mForceRatioSwitch; @@ -35,7 +34,6 @@ public class SettingsActivity extends SimpleActivity { ButterKnife.bind(this); setupDarkTheme(); - setupLongTap(); setupFocusBeforeCapture(); setupSound(); setupForceRatio(); @@ -65,10 +63,6 @@ public class SettingsActivity extends SimpleActivity { mDarkThemeSwitch.setChecked(mConfig.getIsDarkTheme()); } - private void setupLongTap() { - mLongTapSwitch.setChecked(mConfig.getLongTapEnabled()); - } - private void setupFocusBeforeCapture() { mFocusBeforeCaptureSwitch.setChecked(mConfig.getFocusBeforeCaptureEnabled()); } @@ -96,12 +90,6 @@ public class SettingsActivity extends SimpleActivity { restartActivity(); } - @OnClick(R.id.settings_long_tap_holder) - public void handleLongTapToTrigger() { - mLongTapSwitch.setChecked(!mLongTapSwitch.isChecked()); - mConfig.setLongTapEnabled(mLongTapSwitch.isChecked()); - } - @OnClick(R.id.settings_focus_before_capture_holder) public void handleFocusBeforeCapture() { mFocusBeforeCaptureSwitch.setChecked(!mFocusBeforeCaptureSwitch.isChecked()); diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index d7de5950..ac5096d2 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -38,32 +38,6 @@ - - - - - - - - Impostazioni Tema scuro - Tocco prolungato per la cattura Messa a fuoco prima della cattura Forza proporzione 16:9 Limite risoluzione foto diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 3427859a..33ef652b 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -18,7 +18,6 @@ 設定 ダークテーマ - 長押ししてキャプチャする キャプチャ前に再度焦点を合わせる 強制的に 16:9 レシオにする 写真解像度の限度 diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e9708e5f..0fa192d5 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -18,7 +18,6 @@ Настройки темная тема - Длинное нажатие для захвата Перефокусировка перед захватом Принудительное соотношение сторон 16:9 Лимит разрешения фото diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index f0e3b03b..5b8c30e6 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -18,7 +18,6 @@ Inställningar Mörkt tema - Långtryck för bildtagning Fokusera om innan bildtagning Tvinga 16:9-förhållande Bildupplösningsgräns diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e5cef336..2043917c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -18,7 +18,6 @@ Settings Dark theme - Long tap to capture Refocus before capture Force 16:9 ratio Photo resolution limit