mirror of
https://github.com/FossifyOrg/Camera.git
synced 2026-06-13 10:42:09 -04:00
add a Setting for forcing 16:9 ratio
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user