remove the Focus before capture feature

This commit is contained in:
tibbi 2016-09-20 20:35:03 +02:00
parent 1c113e5472
commit 276c47d4f0
12 changed files with 2 additions and 65 deletions

View File

@ -38,14 +38,6 @@ public class Config {
mPrefs.edit().putBoolean(Constants.USE_DCIM, useDCIM).apply(); mPrefs.edit().putBoolean(Constants.USE_DCIM, useDCIM).apply();
} }
public boolean getFocusBeforeCaptureEnabled() {
return mPrefs.getBoolean(Constants.FOCUS_BEFORE_CAPTURE, false);
}
public void setFocusBeforeCaptureEnabled(boolean enabled) {
mPrefs.edit().putBoolean(Constants.FOCUS_BEFORE_CAPTURE, enabled).apply();
}
public boolean getForceRatioEnabled() { public boolean getForceRatioEnabled() {
return mPrefs.getBoolean(Constants.FORCE_RATIO, true); return mPrefs.getBoolean(Constants.FORCE_RATIO, true);
} }

View File

@ -10,7 +10,6 @@ public class Constants {
public static final String IS_FIRST_RUN = "is_first_run"; public static final String IS_FIRST_RUN = "is_first_run";
public static final String IS_DARK_THEME = "is_dark_theme"; public static final String IS_DARK_THEME = "is_dark_theme";
public static final String USE_DCIM = "use_dcim"; public static final String USE_DCIM = "use_dcim";
public static final String FOCUS_BEFORE_CAPTURE = "focus_before_capture";
public static final String SOUND = "sound"; public static final String SOUND = "sound";
public static final String FORCE_RATIO = "force_ratio"; public static final String FORCE_RATIO = "force_ratio";
public static final String MAX_RESOLUTION = "max_resolution"; public static final String MAX_RESOLUTION = "max_resolution";

View File

@ -59,7 +59,6 @@ public class Preview extends ViewGroup
private static boolean mIsSurfaceCreated; private static boolean mIsSurfaceCreated;
private static boolean mSwitchToVideoAsap; private static boolean mSwitchToVideoAsap;
private static boolean mSetupPreviewAfterMeasure; private static boolean mSetupPreviewAfterMeasure;
private static boolean mFocusBeforeCapture;
private static boolean mForceAspectRatio; private static boolean mForceAspectRatio;
private static boolean mWasZooming; private static boolean mWasZooming;
private static int mLastClickX; private static int mLastClickX;
@ -156,7 +155,6 @@ public class Preview extends ViewGroup
} }
final Config config = Config.newInstance(mContext); final Config config = Config.newInstance(mContext);
mFocusBeforeCapture = config.getFocusBeforeCaptureEnabled();
mForceAspectRatio = config.getForceRatioEnabled(); mForceAspectRatio = config.getForceRatioEnabled();
return true; return true;
@ -258,15 +256,7 @@ public class Preview extends ViewGroup
} }
} }
public void tryTakePicture() { public void takePicture() {
if (mFocusBeforeCapture) {
focusArea(true);
} else {
takePicture();
}
}
private void takePicture() {
if (mCanTakePicture) { if (mCanTakePicture) {
if (mIsFlashEnabled) { if (mIsFlashEnabled) {
mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);

View File

@ -291,7 +291,7 @@ public class MainActivity extends SimpleActivity
private void handleShutter() { private void handleShutter() {
if (mIsInPhotoMode) { if (mIsInPhotoMode) {
mShutterBtn.animate().rotationBy(90).start(); mShutterBtn.animate().rotationBy(90).start();
mPreview.tryTakePicture(); mPreview.takePicture();
} else { } else {
final Resources res = getResources(); final Resources res = getResources();
final boolean isRecording = mPreview.toggleRecording(); final boolean isRecording = mPreview.toggleRecording();

View File

@ -19,7 +19,6 @@ import butterknife.OnItemSelected;
public class SettingsActivity extends SimpleActivity { public class SettingsActivity extends SimpleActivity {
@BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch; @BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch;
@BindView(R.id.settings_use_dcim) SwitchCompat mUseDCIMSwitch; @BindView(R.id.settings_use_dcim) SwitchCompat mUseDCIMSwitch;
@BindView(R.id.settings_focus_before_capture) SwitchCompat mFocusBeforeCaptureSwitch;
@BindView(R.id.settings_sound) SwitchCompat mSoundSwitch; @BindView(R.id.settings_sound) SwitchCompat mSoundSwitch;
@BindView(R.id.settings_force_ratio) SwitchCompat mForceRatioSwitch; @BindView(R.id.settings_force_ratio) SwitchCompat mForceRatioSwitch;
@BindView(R.id.settings_max_photo_resolution) AppCompatSpinner mMaxPhotoResolutionSpinner; @BindView(R.id.settings_max_photo_resolution) AppCompatSpinner mMaxPhotoResolutionSpinner;
@ -36,7 +35,6 @@ public class SettingsActivity extends SimpleActivity {
setupDarkTheme(); setupDarkTheme();
setupUseDCIM(); setupUseDCIM();
setupFocusBeforeCapture();
setupSound(); setupSound();
setupForceRatio(); setupForceRatio();
setupMaxPhotoResolution(); setupMaxPhotoResolution();
@ -69,10 +67,6 @@ public class SettingsActivity extends SimpleActivity {
mUseDCIMSwitch.setChecked(mConfig.getUseDCIMFolder()); mUseDCIMSwitch.setChecked(mConfig.getUseDCIMFolder());
} }
private void setupFocusBeforeCapture() {
mFocusBeforeCaptureSwitch.setChecked(mConfig.getFocusBeforeCaptureEnabled());
}
private void setupSound() { private void setupSound() {
mSoundSwitch.setChecked(mConfig.getIsSoundEnabled()); mSoundSwitch.setChecked(mConfig.getIsSoundEnabled());
} }
@ -102,12 +96,6 @@ public class SettingsActivity extends SimpleActivity {
mConfig.setUseDCIMFolder(mUseDCIMSwitch.isChecked()); mConfig.setUseDCIMFolder(mUseDCIMSwitch.isChecked());
} }
@OnClick(R.id.settings_focus_before_capture_holder)
public void handleFocusBeforeCapture() {
mFocusBeforeCaptureSwitch.setChecked(!mFocusBeforeCaptureSwitch.isChecked());
mConfig.setFocusBeforeCaptureEnabled(mFocusBeforeCaptureSwitch.isChecked());
}
@OnClick(R.id.settings_sound_holder) @OnClick(R.id.settings_sound_holder)
public void handleSound() { public void handleSound() {
mSoundSwitch.setChecked(!mSoundSwitch.isChecked()); mSoundSwitch.setChecked(!mSoundSwitch.isChecked());

View File

@ -64,32 +64,6 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_focus_before_capture_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<TextView
android:id="@+id/settings_focus_before_capture_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding"
android:text="@string/focus_before_capture"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/settings_focus_before_capture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@null"
android:clickable="false"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_sound_holder" android:id="@+id/settings_sound_holder"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -19,7 +19,6 @@
<string name="settings">Einstellungen</string> <string name="settings">Einstellungen</string>
<string name="dark_theme">Dunkles Thema</string> <string name="dark_theme">Dunkles Thema</string>
<string name="use_dcim_folder">Speichere Dateien im vorgegebenen DCIM Ordner</string> <string name="use_dcim_folder">Speichere Dateien im vorgegebenen DCIM Ordner</string>
<string name="focus_before_capture">Vor der Aufnahme fokussieren</string>
<string name="force_ratio">Erzwinge 16:9 Format</string> <string name="force_ratio">Erzwinge 16:9 Format</string>
<string name="max_photo_size">Maximale Fotoauflösung</string> <string name="max_photo_size">Maximale Fotoauflösung</string>
<string name="max_video_size">Maximale Videoauflösung</string> <string name="max_video_size">Maximale Videoauflösung</string>

View File

@ -19,7 +19,6 @@
<string name="settings">Impostazioni</string> <string name="settings">Impostazioni</string>
<string name="dark_theme">Tema scuro</string> <string name="dark_theme">Tema scuro</string>
<string name="use_dcim_folder">Store media in the default DCIM folder</string> <string name="use_dcim_folder">Store media in the default DCIM folder</string>
<string name="focus_before_capture">Messa a fuoco prima della cattura</string>
<string name="force_ratio">Forza proporzione 16:9</string> <string name="force_ratio">Forza proporzione 16:9</string>
<string name="max_photo_size">Limite risoluzione foto</string> <string name="max_photo_size">Limite risoluzione foto</string>
<string name="max_video_size">Video resolution limit</string> <string name="max_video_size">Video resolution limit</string>

View File

@ -19,7 +19,6 @@
<string name="settings">設定</string> <string name="settings">設定</string>
<string name="dark_theme">ダークテーマ</string> <string name="dark_theme">ダークテーマ</string>
<string name="use_dcim_folder">Store media in the default DCIM folder</string> <string name="use_dcim_folder">Store media in the default DCIM folder</string>
<string name="focus_before_capture">キャプチャ前に再度焦点を合わせる</string>
<string name="force_ratio">強制的に 16:9 レシオにする</string> <string name="force_ratio">強制的に 16:9 レシオにする</string>
<string name="max_photo_size">写真解像度の限度</string> <string name="max_photo_size">写真解像度の限度</string>
<string name="max_video_size">Video resolution limit</string> <string name="max_video_size">Video resolution limit</string>

View File

@ -19,7 +19,6 @@
<string name="settings">Настройки</string> <string name="settings">Настройки</string>
<string name="dark_theme">темная тема</string> <string name="dark_theme">темная тема</string>
<string name="use_dcim_folder">Store media in the default DCIM folder</string> <string name="use_dcim_folder">Store media in the default DCIM folder</string>
<string name="focus_before_capture">Перефокусировка перед захватом</string>
<string name="force_ratio">Принудительное соотношение сторон 16:9</string> <string name="force_ratio">Принудительное соотношение сторон 16:9</string>
<string name="max_photo_size">Лимит разрешения фото</string> <string name="max_photo_size">Лимит разрешения фото</string>
<string name="max_video_size">Video resolution limit</string> <string name="max_video_size">Video resolution limit</string>

View File

@ -19,7 +19,6 @@
<string name="settings">Inställningar</string> <string name="settings">Inställningar</string>
<string name="dark_theme">Mörkt tema</string> <string name="dark_theme">Mörkt tema</string>
<string name="use_dcim_folder">Store media in the default DCIM folder</string> <string name="use_dcim_folder">Store media in the default DCIM folder</string>
<string name="focus_before_capture">Fokusera om innan bildtagning</string>
<string name="force_ratio">Tvinga 16:9-förhållande</string> <string name="force_ratio">Tvinga 16:9-förhållande</string>
<string name="max_photo_size">Bildupplösningsgräns</string> <string name="max_photo_size">Bildupplösningsgräns</string>
<string name="max_video_size">Video resolution limit</string> <string name="max_video_size">Video resolution limit</string>

View File

@ -19,7 +19,6 @@
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="dark_theme">Dark theme</string> <string name="dark_theme">Dark theme</string>
<string name="use_dcim_folder">Store media in the default DCIM folder</string> <string name="use_dcim_folder">Store media in the default DCIM folder</string>
<string name="focus_before_capture">Refocus before capture</string>
<string name="force_ratio">Use 16:9 ratio</string> <string name="force_ratio">Use 16:9 ratio</string>
<string name="max_photo_size">Photo resolution limit</string> <string name="max_photo_size">Photo resolution limit</string>
<string name="max_video_size">Video resolution limit</string> <string name="max_video_size">Video resolution limit</string>