diff --git a/app/src/main/java/com/simplemobiletools/camera/Config.java b/app/src/main/java/com/simplemobiletools/camera/Config.java
index c7398a52..4035b44c 100644
--- a/app/src/main/java/com/simplemobiletools/camera/Config.java
+++ b/app/src/main/java/com/simplemobiletools/camera/Config.java
@@ -53,4 +53,12 @@ public class Config {
public void setMaxResolution(int maxRes) {
mPrefs.edit().putInt(Constants.MAX_RESOLUTION, maxRes).apply();
}
+
+ public boolean getIsSoundEnabled() {
+ return mPrefs.getBoolean(Constants.SOUND, true);
+ }
+
+ public void setIsSoundEnabled(boolean enabled) {
+ mPrefs.edit().putBoolean(Constants.SOUND, 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 32ef7666..5b0f5eda 100644
--- a/app/src/main/java/com/simplemobiletools/camera/Constants.java
+++ b/app/src/main/java/com/simplemobiletools/camera/Constants.java
@@ -10,6 +10,7 @@ public class Constants {
public static final String IS_FIRST_RUN = "is_first_run";
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";
public static final String MAX_RESOLUTION = "max_resolution";
}
diff --git a/app/src/main/java/com/simplemobiletools/camera/Preview.java b/app/src/main/java/com/simplemobiletools/camera/Preview.java
index a89cd3a9..d0525db6 100644
--- a/app/src/main/java/com/simplemobiletools/camera/Preview.java
+++ b/app/src/main/java/com/simplemobiletools/camera/Preview.java
@@ -223,7 +223,9 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O
mParameters.setPictureSize(maxSize.width, maxSize.height);
mParameters.setRotation(rotation % 360);
- MediaPlayer.create(getContext(), R.raw.camera_shutter).start();
+ if (Config.newInstance(getContext()).getIsSoundEnabled())
+ MediaPlayer.create(getContext(), R.raw.camera_shutter).start();
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
mCamera.enableShutterSound(false);
}
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 205526a8..b682dcd4 100644
--- a/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java
+++ b/app/src/main/java/com/simplemobiletools/camera/activities/SettingsActivity.java
@@ -16,6 +16,7 @@ import butterknife.OnItemSelected;
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_sound) SwitchCompat mSoundSwitch;
@BindView(R.id.settings_force_ratio) SwitchCompat mForceRatioSwitch;
@BindView(R.id.settings_max_resolution) AppCompatSpinner mMaxResolutionSpinner;
@@ -30,6 +31,7 @@ public class SettingsActivity extends AppCompatActivity {
setupLongTap();
setupFocusBeforeCapture();
+ setupSound();
setupForceRatio();
setupMaxResolution();
}
@@ -42,6 +44,10 @@ public class SettingsActivity extends AppCompatActivity {
mFocusBeforeCaptureSwitch.setChecked(mConfig.getFocusBeforeCaptureEnabled());
}
+ private void setupSound() {
+ mSoundSwitch.setChecked(mConfig.getIsSoundEnabled());
+ }
+
private void setupForceRatio() {
mForceRatioSwitch.setChecked(mConfig.getForceRatioEnabled());
}
@@ -62,6 +68,12 @@ public class SettingsActivity extends AppCompatActivity {
mConfig.setFocusBeforeCaptureEnabled(mFocusBeforeCaptureSwitch.isChecked());
}
+ @OnClick(R.id.settings_sound_holder)
+ public void handleSound() {
+ mSoundSwitch.setChecked(!mSoundSwitch.isChecked());
+ mConfig.setIsSoundEnabled(mSoundSwitch.isChecked());
+ }
+
@OnClick(R.id.settings_force_ratio_holder)
public void handleForceRatio() {
mForceRatioSwitch.setChecked(!mForceRatioSwitch.isChecked());
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index d0991e04..a844162b 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -58,6 +58,32 @@
+
+
+
+
+
+
+
+
Force 16:9 ratio
Photo resolution limit
none
+ Shutter sound
About