From ac77afd80cbae99188a7c983ffcacc03af9ca115 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 29 Jun 2016 13:53:18 +0200 Subject: [PATCH] add a Setting for forcing 16:9 ratio --- .../com/simplemobiletools/camera/Config.java | 8 ++++++ .../simplemobiletools/camera/Constants.java | 1 + .../camera/activities/SettingsActivity.java | 12 +++++++++ app/src/main/res/layout/activity_settings.xml | 26 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 48 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/camera/Config.java b/app/src/main/java/com/simplemobiletools/camera/Config.java index de5c6180..5a93ce63 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Config.java +++ b/app/src/main/java/com/simplemobiletools/camera/Config.java @@ -29,4 +29,12 @@ public class Config { public void setFocusBeforeCaptureEnabled(boolean enabled) { mPrefs.edit().putBoolean(Constants.FOCUS_BEFORE_CAPTURE, enabled).apply(); } + + public boolean getForceRatioEnabled() { + return mPrefs.getBoolean(Constants.FORCE_RATIO, true); + } + + public void setForceRatioEnabled(boolean enabled) { + mPrefs.edit().putBoolean(Constants.FORCE_RATIO, enabled).apply(); + } } diff --git a/app/src/main/java/com/simplemobiletools/camera/Constants.java b/app/src/main/java/com/simplemobiletools/camera/Constants.java index 3f58b22a..dc6be245 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Constants.java +++ b/app/src/main/java/com/simplemobiletools/camera/Constants.java @@ -9,4 +9,5 @@ public class Constants { public static final String PREFS_KEY = "Camera"; public static final String LONG_TAP = "long_tap"; public static final String FOCUS_BEFORE_CAPTURE = "focus_before_capture"; + public static final String FORCE_RATIO = "force_ratio"; } 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 b67dae62..85c2b559 100644 --- a/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java +++ b/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java @@ -14,6 +14,7 @@ import butterknife.OnClick; public class SettingsActivity extends AppCompatActivity { @BindView(R.id.settings_long_tap) SwitchCompat mLongTapSwitch; @BindView(R.id.settings_focus_before_capture) SwitchCompat mFocusBeforeCaptureSwitch; + @BindView(R.id.settings_force_ratio) SwitchCompat mForceRatioSwitch; private static Config mConfig; @@ -26,6 +27,7 @@ public class SettingsActivity extends AppCompatActivity { setupLongTap(); setupFocusBeforeCapture(); + setupForceRatio(); } private void setupLongTap() { @@ -36,6 +38,10 @@ public class SettingsActivity extends AppCompatActivity { mFocusBeforeCaptureSwitch.setChecked(mConfig.getFocusBeforeCaptureEnabled()); } + private void setupForceRatio() { + mForceRatioSwitch.setChecked(mConfig.getForceRatioEnabled()); + } + @OnClick(R.id.settings_long_tap_holder) public void handleLongTapToTrigger() { mLongTapSwitch.setChecked(!mLongTapSwitch.isChecked()); @@ -47,4 +53,10 @@ public class SettingsActivity extends AppCompatActivity { mFocusBeforeCaptureSwitch.setChecked(!mFocusBeforeCaptureSwitch.isChecked()); mConfig.setFocusBeforeCaptureEnabled(mFocusBeforeCaptureSwitch.isChecked()); } + + @OnClick(R.id.settings_force_ratio_holder) + public void handleForceRatio() { + mForceRatioSwitch.setChecked(!mForceRatioSwitch.isChecked()); + mConfig.setForceRatioEnabled(mForceRatioSwitch.isChecked()); + } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 7d4c2efb..7f78a7e9 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -57,4 +57,30 @@ android:clickable="false"/> + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3cb13773..4e926dfe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ Settings Long tap to capture Refocus before capture + Force 16:9 ratio About