remove the "Long tap to activate shutter" feature
This commit is contained in:
parent
e27b2bfd38
commit
2a11b98a17
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -590,11 +590,6 @@ public class MainActivity extends SimpleActivity
|
|||
mIsCameraAvailable = available;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateShutter() {
|
||||
handleShutter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentOrientation() {
|
||||
return mOrientation;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -38,32 +38,6 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_long_tap_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_padding"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_long_tap_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="@dimen/settings_padding"
|
||||
android:text="@string/long_tap_capture"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/settings_long_tap"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@null"
|
||||
android:clickable="false"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_focus_before_capture_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!-- Settings -->
|
||||
<string name="settings">Impostazioni</string>
|
||||
<string name="dark_theme">Tema scuro</string>
|
||||
<string name="long_tap_capture">Tocco prolungato per la cattura</string>
|
||||
<string name="focus_before_capture">Messa a fuoco prima della cattura</string>
|
||||
<string name="force_ratio">Forza proporzione 16:9</string>
|
||||
<string name="max_photo_size">Limite risoluzione foto</string>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!-- Settings -->
|
||||
<string name="settings">設定</string>
|
||||
<string name="dark_theme">ダークテーマ</string>
|
||||
<string name="long_tap_capture">長押ししてキャプチャする</string>
|
||||
<string name="focus_before_capture">キャプチャ前に再度焦点を合わせる</string>
|
||||
<string name="force_ratio">強制的に 16:9 レシオにする</string>
|
||||
<string name="max_photo_size">写真解像度の限度</string>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!-- Settings -->
|
||||
<string name="settings">Настройки</string>
|
||||
<string name="dark_theme">темная тема</string>
|
||||
<string name="long_tap_capture">Длинное нажатие для захвата</string>
|
||||
<string name="focus_before_capture">Перефокусировка перед захватом</string>
|
||||
<string name="force_ratio">Принудительное соотношение сторон 16:9</string>
|
||||
<string name="max_photo_size">Лимит разрешения фото</string>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!-- Settings -->
|
||||
<string name="settings">Inställningar</string>
|
||||
<string name="dark_theme">Mörkt tema</string>
|
||||
<string name="long_tap_capture">Långtryck för bildtagning</string>
|
||||
<string name="focus_before_capture">Fokusera om innan bildtagning</string>
|
||||
<string name="force_ratio">Tvinga 16:9-förhållande</string>
|
||||
<string name="max_photo_size">Bildupplösningsgräns</string>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!-- Settings -->
|
||||
<string name="settings">Settings</string>
|
||||
<string name="dark_theme">Dark theme</string>
|
||||
<string name="long_tap_capture">Long tap to capture</string>
|
||||
<string name="focus_before_capture">Refocus before capture</string>
|
||||
<string name="force_ratio">Force 16:9 ratio</string>
|
||||
<string name="max_photo_size">Photo resolution limit</string>
|
||||
|
|
Loading…
Reference in New Issue