diff --git a/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameter.java b/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameter.java index 0809680be..372175e98 100644 --- a/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameter.java +++ b/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameter.java @@ -80,7 +80,10 @@ public void handleMessage(Message msg) { switch (msg.what) { case MSG_SET_INT: - setValue(msg.arg1); + if (msg.arg2 == 0) + setValue(msg.arg1, false); + else + setValue(msg.arg1, true); break; case MSG_SET_STRING: if (msg.arg1 == 1) @@ -298,19 +301,24 @@ public String GetStringValue() * set value to camera async override that when you need dont need to run in it background * @param valueToSet the int value to set + * @param setToCamera */ @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { - backHandler.sendMessage(backHandler.obtainMessage(MSG_SET_INT,valueToSet,0)); + if (setToCamera) + backHandler.sendMessage(backHandler.obtainMessage(MSG_SET_INT,valueToSet,1)); + else + backHandler.sendMessage(backHandler.obtainMessage(MSG_SET_INT,valueToSet,0)); } /** * runs async gets called from SetValue * override that when you want to set stuff in background * @param valueToSet + * @param setToCamera */ - protected void setValue(int valueToSet) + protected void setValue(int valueToSet, boolean setToCamera) { fireIntValueChanged(valueToSet); currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameterHandler.java b/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameterHandler.java index 40b6eb3cd..338bf1cff 100644 --- a/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameterHandler.java +++ b/app/src/main/java/freed/cam/apis/basecamera/parameters/AbstractParameterHandler.java @@ -75,6 +75,7 @@ public AbstractParameterHandler(CameraWrapperInterface cameraUiWrapper) { public void add(Settings parameters, ParameterInterface parameterInterface) { + Log.d(TAG, "add "+parameters.name()); parameterHashMap.put(parameters, parameterInterface); } @@ -96,66 +97,67 @@ public ParameterInterface get(Settings parameters) public void SetAppSettingsToParameters() { setMode(get(Settings.locationParameter), SettingsManager.getInstance().SETTING_LOCATION); - setAppSettingsToCamera(Settings.ColorMode); - setAppSettingsToCamera(Settings.ExposureMode); - setAppSettingsToCamera(Settings.FlashMode); - setAppSettingsToCamera(Settings.IsoMode); - setAppSettingsToCamera(Settings.AntiBandingMode); - setAppSettingsToCamera(Settings.WhiteBalanceMode); - setAppSettingsToCamera(Settings.PictureSize); - setAppSettingsToCamera(Settings.PictureFormat); - setAppSettingsToCamera(Settings.bayerformat); - setAppSettingsToCamera(Settings.oismode); - setAppSettingsToCamera(Settings.JpegQuality); - setAppSettingsToCamera(Settings.GuideList); - setAppSettingsToCamera(Settings.ImagePostProcessing); - setAppSettingsToCamera(Settings.SceneMode); - setAppSettingsToCamera(Settings.FocusMode); - setAppSettingsToCamera(Settings.RedEye); - setAppSettingsToCamera(Settings.LensShade); - setAppSettingsToCamera(Settings.ZSL); - setAppSettingsToCamera(Settings.SceneDetect); - setAppSettingsToCamera(Settings.Denoise); - setAppSettingsToCamera(Settings.DigitalImageStabilization); - setAppSettingsToCamera(Settings.MemoryColorEnhancement); + setAppSettingsToCamera(Settings.ColorMode,false); + setAppSettingsToCamera(Settings.FlashMode,false); + setAppSettingsToCamera(Settings.IsoMode,false); + setAppSettingsToCamera(Settings.AntiBandingMode,false); + setAppSettingsToCamera(Settings.WhiteBalanceMode,false); + setAppSettingsToCamera(Settings.PictureSize,false); + setAppSettingsToCamera(Settings.PictureFormat,false); + setAppSettingsToCamera(Settings.bayerformat,false); + setAppSettingsToCamera(Settings.oismode,false); + setAppSettingsToCamera(Settings.JpegQuality,false); + setAppSettingsToCamera(Settings.GuideList,false); + setAppSettingsToCamera(Settings.ImagePostProcessing,false); + setAppSettingsToCamera(Settings.SceneMode,false); + setAppSettingsToCamera(Settings.FocusMode,false); + setAppSettingsToCamera(Settings.RedEye,false); + setAppSettingsToCamera(Settings.LensShade,false); + setAppSettingsToCamera(Settings.ZSL,false); + setAppSettingsToCamera(Settings.SceneDetect,false); + setAppSettingsToCamera(Settings.Denoise,false); + setAppSettingsToCamera(Settings.DigitalImageStabilization,false); + setAppSettingsToCamera(Settings.MemoryColorEnhancement,false); setMode(get(Settings.NightMode), SettingsManager.getInstance().NIGHTMODE); - setAppSettingsToCamera(Settings.NonZslManualMode); - - setAppSettingsToCamera(Settings.VideoProfiles); - setAppSettingsToCamera(Settings.VideoHDR); - setAppSettingsToCamera(Settings.VideoSize); - setAppSettingsToCamera(Settings.VideoStabilization); - setAppSettingsToCamera(Settings.VideoHighFramerate); - setAppSettingsToCamera(Settings.WhiteBalanceMode); - setAppSettingsToCamera(Settings.ColorCorrectionMode); - setAppSettingsToCamera(Settings.EdgeMode); - setAppSettingsToCamera(Settings.HotPixelMode); - setAppSettingsToCamera(Settings.ToneMapMode); - setAppSettingsToCamera(Settings.ControlMode); - setAppSettingsToCamera(Settings.IntervalDuration); - setAppSettingsToCamera(Settings.IntervalShutterSleep); + setAppSettingsToCamera(Settings.NonZslManualMode,false); + + setAppSettingsToCamera(Settings.VideoProfiles,false); + setAppSettingsToCamera(Settings.VideoHDR,false); + setAppSettingsToCamera(Settings.VideoSize,false); + setAppSettingsToCamera(Settings.VideoStabilization,false); + setAppSettingsToCamera(Settings.VideoHighFramerate,false); + setAppSettingsToCamera(Settings.WhiteBalanceMode,false); + setAppSettingsToCamera(Settings.ColorCorrectionMode,false); + setAppSettingsToCamera(Settings.EdgeMode,false); + setAppSettingsToCamera(Settings.HotPixelMode,false); + setAppSettingsToCamera(Settings.ToneMapMode,false); + setAppSettingsToCamera(Settings.ControlMode,false); + setAppSettingsToCamera(Settings.IntervalDuration,false); + setAppSettingsToCamera(Settings.IntervalShutterSleep,false); setMode(get(Settings.HorizontLvl), SettingsManager.getInstance().SETTING_HORIZONT); - setAppSettingsToCamera(Settings.HDRMode); + setAppSettingsToCamera(Settings.HDRMode,false); - setAppSettingsToCamera(Settings.matrixChooser); - setAppSettingsToCamera(Settings.dualPrimaryCameraMode); - setAppSettingsToCamera(Settings.RDI); - setAppSettingsToCamera(Settings.Ae_TargetFPS); + setAppSettingsToCamera(Settings.matrixChooser,false); + setAppSettingsToCamera(Settings.dualPrimaryCameraMode,false); + setAppSettingsToCamera(Settings.RDI,false); + setAppSettingsToCamera(Settings.Ae_TargetFPS,false); + + setAppSettingsToCamera(Settings.ExposureMode,true); } public void setManualSettingsToParameters() { - setManualMode(Settings.M_Contrast); - setManualMode(Settings.M_3D_Convergence); - setManualMode(Settings.M_ExposureCompensation); - setManualMode(Settings.M_Focus); - setManualMode(Settings.M_Sharpness); - setManualMode(Settings.M_ExposureTime); - setManualMode(Settings.M_Brightness); - setManualMode(Settings.M_ManualIso); - setManualMode(Settings.M_Saturation); - setManualMode(Settings.M_Whitebalance); + setManualMode(Settings.M_Contrast,false); + setManualMode(Settings.M_3D_Convergence,false); + setManualMode(Settings.M_Focus,false); + setManualMode(Settings.M_Sharpness,false); + setManualMode(Settings.M_ExposureTime,false); + setManualMode(Settings.M_Brightness,false); + setManualMode(Settings.M_ManualIso,false); + setManualMode(Settings.M_Saturation,false); + setManualMode(Settings.M_Whitebalance,false); + setManualMode(Settings.M_ExposureCompensation,true); } protected void SetParameters() @@ -181,7 +183,7 @@ protected void setMode(ParameterInterface parameter, String settings_key) } } - protected void setAppSettingsToCamera(Settings parametertolook) + protected void setAppSettingsToCamera(Settings parametertolook, boolean setToCamera) { ParameterInterface parameter = get(parametertolook); SettingsManager.SettingMode settingMode = SettingsManager.get(parametertolook); @@ -194,12 +196,12 @@ protected void setAppSettingsToCamera(Settings parametertolook) if (TextUtils.isEmpty(toset) || toset.equals("none")) settingMode.set(parameter.GetStringValue()); else - parameter.SetValue(toset,false); + parameter.SetValue(toset,setToCamera); parameter.fireStringValueChanged(toset); } } - protected void setManualMode(Settings parametertolook) + protected void setManualMode(Settings parametertolook, boolean setToCamera) { ParameterInterface parameter = get(parametertolook); SettingsManager.SettingMode settingMode = SettingsManager.get(parametertolook); @@ -215,7 +217,7 @@ protected void setManualMode(Settings parametertolook) { try { int tmp = Integer.parseInt(settingMode.get()); - parameter.SetValue(tmp); + parameter.SetValue(tmp, setToCamera); } catch (NumberFormatException ex) { diff --git a/app/src/main/java/freed/cam/apis/basecamera/parameters/ParameterInterface.java b/app/src/main/java/freed/cam/apis/basecamera/parameters/ParameterInterface.java index 340914c73..0dd131ee0 100644 --- a/app/src/main/java/freed/cam/apis/basecamera/parameters/ParameterInterface.java +++ b/app/src/main/java/freed/cam/apis/basecamera/parameters/ParameterInterface.java @@ -64,8 +64,9 @@ public interface ParameterInterface /** * Set the int value to the parameters * @param valueToSet the int value to set + * @param setToCamera */ - void SetValue(int valueToSet); + void SetValue(int valueToSet, boolean setToCamera); /** * diff --git a/app/src/main/java/freed/cam/apis/camera1/modules/BracketModule.java b/app/src/main/java/freed/cam/apis/camera1/modules/BracketModule.java index 4f5af9b84..900053d9e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/modules/BracketModule.java +++ b/app/src/main/java/freed/cam/apis/camera1/modules/BracketModule.java @@ -114,7 +114,7 @@ else if (hdrCount == 2) Log.d(TAG, "Set HDR Exposure to :" + value + "for image count " + hdrCount); int toset = value + cameraUiWrapper.getParameterHandler().get(Settings.M_ExposureTime).getStringValues().length / 2; - cameraUiWrapper.getParameterHandler().get(Settings.M_ExposureTime).SetValue(toset); + cameraUiWrapper.getParameterHandler().get(Settings.M_ExposureTime).SetValue(toset, true); Log.d(TAG, "HDR Exposure SET"); } diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/AE_Handler_Abstract.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/AE_Handler_Abstract.java index 4bec2352c..86e1984bd 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/AE_Handler_Abstract.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/AE_Handler_Abstract.java @@ -96,11 +96,11 @@ public void onManualChanged(AeManual fromManual, boolean automode, int value) { switch (fromManual) { case shutter: currentIso = iso.GetValue(); - iso.setValue(0); + iso.setValue(0, true); break; case iso: currentShutter = shutter.GetValue(); - shutter.setValue(0); + shutter.setValue(0,true); shutter.fireIsReadOnlyChanged(false); break; } @@ -113,11 +113,11 @@ public void onManualChanged(AeManual fromManual, boolean automode, int value) { auto = false; switch (fromManual) { case shutter: - iso.setValue(currentIso); + iso.setValue(currentIso,true); break; case iso: if (currentShutter == 0) currentShutter = 9; - shutter.setValue(currentShutter); + shutter.setValue(currentShutter,true); shutter.fireIsReadOnlyChanged(true); break; } @@ -127,11 +127,11 @@ public void onManualChanged(AeManual fromManual, boolean automode, int value) { Log.d(TAG, "Automode Deactivated, set UserValues"); switch (fromManual) { case shutter: - shutter.setValue(value); + shutter.setValue(value,true); break; case iso: - iso.setValue(value); + iso.setValue(value,true); break; } diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/BaseManualParameter.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/BaseManualParameter.java index 5aa44a7d6..b02b89412 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/BaseManualParameter.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/BaseManualParameter.java @@ -69,7 +69,7 @@ public void ResetToDefault() if (isSupported) { Log.d(TAG,"Reset Back from:" + currentInt + " to:" + default_value); - SetValue(default_value); + SetValue(default_value, true); fireIntValueChanged(default_value); } } @@ -159,7 +159,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToset) + public void setValue(int valueToset, boolean setToCamera) { currentInt = valueToset; Log.d(TAG, "set " + key_value + " to " + valueToset); diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ExposureManualParameter.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ExposureManualParameter.java index 90b9e180f..cf37a3cdc 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ExposureManualParameter.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ExposureManualParameter.java @@ -61,7 +61,7 @@ protected String[] createStringArray(int min,int max, float step) } @Override - public void setValue(int valueToset) + public void setValue(int valueToset, boolean setToCamera) { if(stringvalues == null || stringvalues.length == 0) return; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualIsoSony.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualIsoSony.java index dcc9588cd..8ba1203f7 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualIsoSony.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualIsoSony.java @@ -35,7 +35,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (currentInt == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualParameterAEHandlerInterface.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualParameterAEHandlerInterface.java index cd14e5e18..ad6fe97e7 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualParameterAEHandlerInterface.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ManualParameterAEHandlerInterface.java @@ -26,5 +26,5 @@ */ public interface ManualParameterAEHandlerInterface extends ParameterInterface { - void setValue(int value); + void setValue(int value, boolean setToCamera); } diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ZoomManualParameter.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ZoomManualParameter.java index 95dc1ae97..d2d8583bb 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ZoomManualParameter.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/ZoomManualParameter.java @@ -48,7 +48,7 @@ public ZoomManualParameter(Parameters parameters, CameraWrapperInterface cameraU } @Override - public void setValue(int valueToset) { + public void setValue(int valueToset, boolean setToCamera) { currentInt = valueToset; parameters.set(key_value, valueToset); ((ParametersHandler) cameraUiWrapper.getParameterHandler()).SetParametersToCamera(parameters); diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/BaseFocusManual.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/BaseFocusManual.java index ce20dc779..182a98504 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/BaseFocusManual.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/BaseFocusManual.java @@ -58,7 +58,7 @@ public BaseFocusManual(Parameters parameters, CameraWrapperInterface cameraUiWra @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualHuawei.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualHuawei.java index f42daadb9..49cc65fc0 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualHuawei.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualHuawei.java @@ -39,7 +39,7 @@ public FocusManualHuawei(Parameters parameters, CameraWrapperInterface cameraUiW } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualParameterHTC.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualParameterHTC.java index 0aa05405c..6bbb56e2e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualParameterHTC.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/focus/FocusManualParameterHTC.java @@ -44,7 +44,7 @@ public FocusManualParameterHTC(Parameters parameters, CameraWrapperInterface cam @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { parameters.set(key_value, valueToSet+""); ((ParametersHandler) cameraUiWrapper.getParameterHandler()).SetParametersToCamera(parameters); diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualAperture.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualAperture.java index db55b436b..197a74c6e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualAperture.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualAperture.java @@ -29,7 +29,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet == 0) { diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualIsoKrilin.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualIsoKrilin.java index 5728bfa1a..34578004e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualIsoKrilin.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ManualIsoKrilin.java @@ -31,7 +31,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet == 0) { diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ShutterManualKrilin.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ShutterManualKrilin.java index b7711bafa..e7e16ec26 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ShutterManualKrilin.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/krilin/ShutterManualKrilin.java @@ -49,7 +49,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet == 0) { diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/lg/ISOManualParameterG4.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/lg/ISOManualParameterG4.java index 75ef9d3cf..104508fe5 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/lg/ISOManualParameterG4.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/lg/ISOManualParameterG4.java @@ -56,7 +56,7 @@ public ISOManualParameterG4(Parameters parameters, CameraWrapperInterface camera } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet == 0) @@ -69,7 +69,7 @@ public void setValue(int valueToSet) } } - public void SetValue(int value) + public void SetValue(int value, boolean setToCamera) { if (value == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/FocusManualMTK.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/FocusManualMTK.java index 14bfb7c6a..729562d68 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/FocusManualMTK.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/FocusManualMTK.java @@ -43,7 +43,7 @@ public FocusManualMTK(Parameters parameters, CameraWrapperInterface cameraUiWrap } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/ISOManualParameterMTK.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/ISOManualParameterMTK.java index bd2b38acd..faebd9bf0 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/ISOManualParameterMTK.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/mtk/ISOManualParameterMTK.java @@ -54,7 +54,7 @@ public ISOManualParameterMTK(Parameters parameters, CameraWrapperInterface camer } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet == 0) @@ -68,7 +68,7 @@ public void setValue(int valueToSet) } @Override - public void SetValue(int value) + public void SetValue(int value, boolean setToCamera) { if (value == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BaseISOManual.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BaseISOManual.java index c8c125150..f177e832c 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BaseISOManual.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BaseISOManual.java @@ -51,7 +51,7 @@ public int GetValue() { } @Override - public void setValue(int valueToSet) { + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; //set to auto if (currentInt == 0) { diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BurstManualParam.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BurstManualParam.java index 2bc4ff4d4..8646e689d 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BurstManualParam.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/BurstManualParam.java @@ -74,7 +74,7 @@ public int GetValue() } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/SkintoneManualPrameter.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/SkintoneManualPrameter.java index 7715c62bc..d4879f983 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/SkintoneManualPrameter.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/qcom/SkintoneManualPrameter.java @@ -57,7 +57,7 @@ public boolean IsSupported() { } @Override - public void setValue(int valueToSet) { + public void setValue(int valueToSet, boolean setToCamera) { cameraUiWrapper.getParameterHandler().get(Settings.SceneMode).SetValue("portrait", true); parameters.set("skinToneEnhancement",valueToSet + ""); if (valueToSet == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MicroSec.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MicroSec.java index 5c2816b14..87b724a3e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MicroSec.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MicroSec.java @@ -37,7 +37,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToset) + public void setValue(int valueToset, boolean setToCamera) { currentInt = valueToset; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MilliSec.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MilliSec.java index 8f4a6923e..7a0aa17de 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MilliSec.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ExposureTime_MilliSec.java @@ -39,7 +39,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToset) + public void setValue(int valueToset, boolean setToCamera) { currentInt = valueToset; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualG2pro.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualG2pro.java index 5662f7040..40d2c9ae1 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualG2pro.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualG2pro.java @@ -63,7 +63,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMeizu.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMeizu.java index 2f061cb66..b6ddc8d56 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMeizu.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMeizu.java @@ -61,7 +61,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMtk.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMtk.java index 207b49ed7..02132e57b 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMtk.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualMtk.java @@ -49,12 +49,12 @@ public ShutterManualMtk(Parameters parameters, CameraWrapperInterface cameraUiWr @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { manualevent.onManualChanged(AE_Handler_Abstract.AeManual.shutter, false, valueToSet); } @Override - public void setValue(int value) + public void setValue(int value, boolean setToCamera) { if (value == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterG4.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterG4.java index 81ba321b8..1637a96d6 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterG4.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterG4.java @@ -68,12 +68,12 @@ public int GetValue() { } @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { manualevent.onManualChanged(AE_Handler_Abstract.AeManual.shutter, false, valueToSet); } - public void setValue(int value) + public void setValue(int value, boolean setToCamera) { if (value == 0) diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterHTC.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterHTC.java index f99fa9adc..3582c1279 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterHTC.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualParameterHTC.java @@ -58,7 +58,7 @@ public boolean IsVisible() { @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualSony.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualSony.java index d6d56fcf6..864997d66 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualSony.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualSony.java @@ -57,7 +57,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; ParameterInterface miso =cameraUiWrapper.getParameterHandler().get(Settings.M_ManualIso); diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualZTE.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualZTE.java index e843179af..067f4435e 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualZTE.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/shutter/ShutterManualZTE.java @@ -60,7 +60,7 @@ public boolean IsSetSupported() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; String shutterstring = stringvalues[currentInt]; diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/whitebalance/BaseCCTManual.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/whitebalance/BaseCCTManual.java index 202d5f4ae..b27be5939 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/whitebalance/BaseCCTManual.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/whitebalance/BaseCCTManual.java @@ -105,7 +105,7 @@ public BaseCCTManual(Parameters parameters, String value, String maxValue, Strin @Override - public void setValue(int valueToSet) { + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; //set to auto if (currentInt == 0) { diff --git a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/zte/FXManualParameter.java b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/zte/FXManualParameter.java index f22f9dc05..57e091f1f 100644 --- a/app/src/main/java/freed/cam/apis/camera1/parameters/manual/zte/FXManualParameter.java +++ b/app/src/main/java/freed/cam/apis/camera1/parameters/manual/zte/FXManualParameter.java @@ -72,7 +72,7 @@ public int GetValue() } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { parameters.set(cameraUiWrapper.getResString(R.string.morpho_effect_type), String.valueOf(valueToSet)); ((ParametersHandler) cameraUiWrapper.getParameterHandler()).SetParametersToCamera(parameters); diff --git a/app/src/main/java/freed/cam/apis/camera2/Camera2Fragment.java b/app/src/main/java/freed/cam/apis/camera2/Camera2Fragment.java index 3ebd8a0df..60f199809 100644 --- a/app/src/main/java/freed/cam/apis/camera2/Camera2Fragment.java +++ b/app/src/main/java/freed/cam/apis/camera2/Camera2Fragment.java @@ -48,7 +48,7 @@ * Created by troop on 06.06.2015. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) -public class Camera2Fragment extends CameraFragmentAbstract implements TextureView.SurfaceTextureListener +public class Camera2Fragment extends CameraFragmentAbstract implements TextureView.SurfaceTextureListener, CameraHolderApi2.WaitForFirstFrameCallback { private AutoFitTextureView textureView; private MyHistogram histogram; @@ -87,6 +87,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa moduleHandler = new ModuleHandlerApi2(Camera2Fragment.this); Focus = new FocusHandler(Camera2Fragment.this); cameraHolder = new CameraHolderApi2(Camera2Fragment.this); + ((CameraHolderApi2)cameraHolder).setWaitForFirstFrameCallback(this); ((CameraHolderApi2)cameraHolder).captureSessionHandler = new CaptureSessionHandler(Camera2Fragment.this, ((CameraHolderApi2)cameraHolder).cameraBackroundValuesChangedListner); mProcessor = new FocuspeakProcessorApi2(renderScriptManager,histogram); @@ -129,9 +130,6 @@ public void onCameraClose(String message) @Override public void onPreviewOpen(String message) { Log.d(TAG, "onPreviewOpen"); - //workaround, that seem to kill front camera when switching picformat - if (!SettingsManager.getInstance().getIsFrontCamera()) - parametersHandler.setManualSettingsToParameters(); } @Override @@ -261,4 +259,12 @@ protected void handleBackgroundMessage(Message message) { } } + + @Override + public void onFirstFrame() { + Log.d(TAG,"onFirstFrame"); + //workaround, that seem to kill front camera when switching picformat + if (!SettingsManager.getInstance().getIsFrontCamera()) + parametersHandler.setManualSettingsToParameters(); + } } diff --git a/app/src/main/java/freed/cam/apis/camera2/CameraHolderApi2.java b/app/src/main/java/freed/cam/apis/camera2/CameraHolderApi2.java index 01f255a93..be787ba21 100644 --- a/app/src/main/java/freed/cam/apis/camera2/CameraHolderApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/CameraHolderApi2.java @@ -80,6 +80,11 @@ public interface AeCompensationListner void onAeCompensationChanged(int aecompensation); } + public interface WaitForFirstFrameCallback + { + void onFirstFrame(); + } + public boolean isWorking; public CameraManager manager; @@ -99,6 +104,9 @@ public interface AeCompensationListner private Pair focusRanges; private float focus_distance; + private boolean waitForFirstFrame = false; + private WaitForFirstFrameCallback waitForFirstFrameCallback; + boolean errorRecieved; public void SetAeCompensationListner(AeCompensationListner aeCompensationListner) @@ -117,6 +125,17 @@ public CameraHolderApi2(CameraWrapperInterface cameraUiWrapper) } + + public void setWaitForFirstFrame() + { + waitForFirstFrame = true; + } + + public void setWaitForFirstFrameCallback(WaitForFirstFrameCallback callback) + { + this.waitForFirstFrameCallback = callback; + } + //########################### public camera methods //########################### //########################### @@ -387,6 +406,12 @@ public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest requ { if (result == null) return; + if (waitForFirstFrame) + { + if (waitForFirstFrameCallback != null) + waitForFirstFrameCallback.onFirstFrame(); + waitForFirstFrame = false; + } ParameterInterface expotime = cameraUiWrapper.getParameterHandler().get(Settings.M_ExposureTime); ParameterInterface iso = cameraUiWrapper.getParameterHandler().get(Settings.M_ManualIso); @@ -483,13 +508,13 @@ public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest requ break; case 4: state = "FOCUSED_LOCKED"; - captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); + captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE,true); if (cameraUiWrapper.getFocusHandler().focusEvent != null) cameraUiWrapper.getFocusHandler().focusEvent.FocusFinished(true); break; case 5: state = "NOT_FOCUSED_LOCKED"; - captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); + captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE,true); if (cameraUiWrapper.getFocusHandler().focusEvent != null) cameraUiWrapper.getFocusHandler().focusEvent.FocusFinished(false); break; diff --git a/app/src/main/java/freed/cam/apis/camera2/CaptureSessionHandler.java b/app/src/main/java/freed/cam/apis/camera2/CaptureSessionHandler.java index f84d184e3..4aba67fc5 100644 --- a/app/src/main/java/freed/cam/apis/camera2/CaptureSessionHandler.java +++ b/app/src/main/java/freed/cam/apis/camera2/CaptureSessionHandler.java @@ -242,6 +242,7 @@ public void CreateCaptureSession() return; isHighSpeedSession = false; Log.d(TAG, "CreateCaptureSession:"); + cameraHolderApi2.setWaitForFirstFrame(); try { cameraHolderApi2.mCameraDevice.createCaptureSession(surfaces, previewStateCallBackRestart, null); } catch (CameraAccessException | SecurityException ex) { @@ -257,6 +258,7 @@ public void CreateHighSpeedCaptureSession(CameraCaptureSession.StateCallback cus if(cameraHolderApi2.mCameraDevice == null) return; isHighSpeedSession = true; + cameraHolderApi2.setWaitForFirstFrame(); Log.d(TAG, "CreateCaptureSession: Surfaces Count:" + surfaces.size()); try { cameraHolderApi2.mCameraDevice.createConstrainedHighSpeedCaptureSession(surfaces, customCallback, null); @@ -414,7 +416,7 @@ public void CloseCaptureSession() } - public void SetParameterRepeating(@NonNull CaptureRequest.Key key, T value) + public void SetParameterRepeating(@NonNull CaptureRequest.Key key, T value, boolean setToCamera) { if (mPreviewRequestBuilder == null ) return; @@ -422,22 +424,27 @@ public void SetParameterRepeating(@NonNull CaptureRequest.Key key, T valu mPreviewRequestBuilder.set(key,value); if (mImageCaptureRequestBuilder != null) mImageCaptureRequestBuilder.set(key,value); - if (isHighSpeedSession) - StartHighspeedCaptureSession(); - else - StartRepeatingCaptureSession(); + if (setToCamera) + { + if (isHighSpeedSession) + StartHighspeedCaptureSession(); + else + StartRepeatingCaptureSession(); + } } - public void SetPreviewParameterRepeating(@NonNull CaptureRequest.Key key, T value) + public void SetPreviewParameterRepeating(@NonNull CaptureRequest.Key key, T value, boolean apply) { if (mPreviewRequestBuilder == null ) return; Log.d(TAG, "Set :" + key.getName() + " to " + value); mPreviewRequestBuilder.set(key,value); - if (isHighSpeedSession) - StartHighspeedCaptureSession(); - else - StartRepeatingCaptureSession(); + if (apply) { + if (isHighSpeedSession) + StartHighspeedCaptureSession(); + else + StartRepeatingCaptureSession(); + } } public void SetPreviewParameter(@NonNull CaptureRequest.Key key, T value) diff --git a/app/src/main/java/freed/cam/apis/camera2/modules/AeBracketApi2.java b/app/src/main/java/freed/cam/apis/camera2/modules/AeBracketApi2.java index 023e132a4..757d73f2e 100644 --- a/app/src/main/java/freed/cam/apis/camera2/modules/AeBracketApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/modules/AeBracketApi2.java @@ -71,7 +71,7 @@ public String LongName() { public void InitModule() { super.InitModule(); cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).fireIsReadOnlyChanged(false); - cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(3-1); + cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(3-1, true); changeCaptureState(ModuleHandlerAbstract.CaptureStates.image_capture_stop); } diff --git a/app/src/main/java/freed/cam/apis/camera2/modules/AfBracketApi2.java b/app/src/main/java/freed/cam/apis/camera2/modules/AfBracketApi2.java index 0cd29543c..5f4a7e32e 100644 --- a/app/src/main/java/freed/cam/apis/camera2/modules/AfBracketApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/modules/AfBracketApi2.java @@ -62,7 +62,7 @@ public String LongName() { @Override public void InitModule() { super.InitModule(); - cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(PICSTOTAKE-1); + cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(PICSTOTAKE-1, true); focuslength = parameterHandler.get(Settings.M_Focus).getStringValues().length -1; focusStep = focuslength/PICSTOTAKE; currentFocusPos = 1; diff --git a/app/src/main/java/freed/cam/apis/camera2/modules/PictureModuleApi2.java b/app/src/main/java/freed/cam/apis/camera2/modules/PictureModuleApi2.java index e8630abaa..80adcf44e 100644 --- a/app/src/main/java/freed/cam/apis/camera2/modules/PictureModuleApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/modules/PictureModuleApi2.java @@ -107,7 +107,7 @@ public void InitModule() super.InitModule(); Log.d(TAG, "InitModule"); changeCaptureState(CaptureStates.image_capture_stop); - cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(0); + cameraUiWrapper.getParameterHandler().get(Settings.M_Burst).SetValue(0, true); if (cameraHolder.captureSessionHandler.getSurfaceTexture() != null) startPreview(); } @@ -559,9 +559,9 @@ public void onRdy() { if (cameraHolder.captureSessionHandler.getPreviewParameter(CaptureRequest.CONTROL_AF_MODE) == CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE || cameraHolder.captureSessionHandler.getPreviewParameter(CaptureRequest.CONTROL_AF_MODE) == CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO) { cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, - CaptureRequest.CONTROL_AF_TRIGGER_CANCEL); + CaptureRequest.CONTROL_AF_TRIGGER_CANCEL,true); cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, - CaptureRequest.CONTROL_AF_TRIGGER_IDLE); + CaptureRequest.CONTROL_AF_TRIGGER_IDLE,true); } } }; diff --git a/app/src/main/java/freed/cam/apis/camera2/modules/VideoModuleApi2.java b/app/src/main/java/freed/cam/apis/camera2/modules/VideoModuleApi2.java index 3db865675..de236b2b8 100644 --- a/app/src/main/java/freed/cam/apis/camera2/modules/VideoModuleApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/modules/VideoModuleApi2.java @@ -281,7 +281,7 @@ else if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED) mediaRecorder.setVideoEncodingBitRate(currentVideoProfile.videoBitRate); try { - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, new Range<>(currentVideoProfile.videoFrameRate, currentVideoProfile.videoFrameRate)); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, new Range<>(currentVideoProfile.videoFrameRate, currentVideoProfile.videoFrameRate),true); }catch (Exception e) { Log.WriteEx(e); diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/AeHandler.java b/app/src/main/java/freed/cam/apis/camera2/parameters/AeHandler.java index 9cc06af9e..a689d9b8e 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/AeHandler.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/AeHandler.java @@ -74,7 +74,7 @@ protected void setManualItemsSetSupport(boolean off) manualExposureApi2.fireIsSupportedChanged(false); //turn flash off when ae is off. else on some devices it applys only manual stuff only for a few frames //apply it direct to the preview that old value can get loaded from FocusModeParameter when Ae gets set back to auto - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF,true); //hide flash ui item its not supported in manual mode cameraUiWrapper.getParameterHandler().get(Settings.FlashMode).fireIsSupportedChanged(false); //enable manualiso item in ui @@ -140,13 +140,13 @@ public int GetValue() { @TargetApi(VERSION_CODES.LOLLIPOP) @Override - public void setValue(int valueToSet) { + public void setValue(int valueToSet, boolean setToCamera) { if (cameraHolder == null || cameraHolder.captureSessionHandler.GetActiveCameraCaptureSession() == null) return; currentInt = valueToSet; if (expocompvalues == null || expocompvalues.getSize() == 0) return; - setExpoCompensation(valueToSet); + setExpoCompensation(valueToSet,setToCamera); } @Override @@ -176,9 +176,9 @@ public boolean IsVisible() { } - protected void setExpoCompensation(int valueToSet) { + protected void setExpoCompensation(int valueToSet,boolean setToCamera) { int t = valueToSet - manualExposureApi2.getStringValues().length / 2; - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, t); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, t,setToCamera); } protected boolean isExposureCompSetSupported() @@ -222,14 +222,14 @@ public String[] getStringValues() { @TargetApi(VERSION_CODES.LOLLIPOP) @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { if (cameraHolder == null) return; if (valueToSet >= manualExposureTimeApi2.getStringValues().length) valueToSet = manualExposureTimeApi2.getStringValues().length - 1; currentInt = valueToSet; - setExposureTime(valueToSet); + setExposureTime(valueToSet,setToCamera); } @@ -250,7 +250,7 @@ public boolean IsSetSupported() { } } - protected void setExposureTime(int valueToSet) + protected void setExposureTime(int valueToSet,boolean setToCamera) { if (valueToSet > 0) { long val = AbstractManualShutter.getMilliSecondStringFromShutterString(manualExposureTimeApi2.getStringValues()[valueToSet]) * 1000; @@ -261,7 +261,7 @@ protected void setExposureTime(int valueToSet) val = MAX_PREVIEW_EXPOSURETIME; } - cameraHolder.captureSessionHandler.SetPreviewParameterRepeating(CaptureRequest.SENSOR_EXPOSURE_TIME, val); + cameraHolder.captureSessionHandler.SetPreviewParameterRepeating(CaptureRequest.SENSOR_EXPOSURE_TIME, val,setToCamera); manualExposureTimeApi2.fireIntValueChanged(valueToSet); } } @@ -292,7 +292,7 @@ public boolean IsVisible() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { //workaround when value was -1 to avoid outofarray ex Log.d(TAG, "set Manual Iso: " +valueToSet); @@ -300,7 +300,7 @@ public void setValue(int valueToSet) valueToSet = 0; ////////////////////// currentInt = valueToSet; - setIso(valueToSet); + setIso(valueToSet,setToCamera); } @Override @@ -309,19 +309,19 @@ public boolean IsSetSupported() { } } - protected void setIso(int valueToSet) + protected void setIso(int valueToSet,boolean setToCamera) { if (cameraHolder == null || cameraHolder.captureSessionHandler.GetActiveCameraCaptureSession() == null) return; if (valueToSet == 0) { - aeModeApi2.SetValue(SettingsManager.get(Settings.ExposureMode).get(),true); + aeModeApi2.SetValue(SettingsManager.get(Settings.ExposureMode).get(),setToCamera); } else { if (ae_active) - aeModeApi2.SetValue(cameraUiWrapper.getContext().getString(R.string.off),true); - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.SENSOR_SENSITIVITY, Integer.parseInt(manualISoApi2.getStringValues()[valueToSet])); + aeModeApi2.SetValue(cameraUiWrapper.getContext().getString(R.string.off),setToCamera); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.SENSOR_SENSITIVITY, Integer.parseInt(manualISoApi2.getStringValues()[valueToSet]),setToCamera); } } diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/ParameterHandlerApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/ParameterHandlerApi2.java index 69dd3811f..f02612d38 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/ParameterHandlerApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/ParameterHandlerApi2.java @@ -189,7 +189,7 @@ public void SetPictureOrientation(int orientation) try { Log.d(TAG, "Set Orientation to:" + orientation); - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.JPEG_ORIENTATION, orientation); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequest.JPEG_ORIENTATION, orientation,true); } catch (NullPointerException ex) { diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/WbHandler.java b/app/src/main/java/freed/cam/apis/camera2/parameters/WbHandler.java index 2d23caf52..3489a10e3 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/WbHandler.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/WbHandler.java @@ -168,9 +168,9 @@ public String[] getStringValues() { //rgb 255,255,255 6000k //rgb(181,205, 255) 15000k @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { - super.setValue(valueToSet); + super.setValue(valueToSet, setToCamera); if (valueToSet == 0) // = auto return; currentInt =valueToSet; @@ -192,7 +192,7 @@ public void setValue(int valueToSet) Log.d(TAG, "r:" +rgb[0] +" g:"+rgb[1] +" b:"+rgb[2]); Log.d(TAG, "ColorTemp=" + valueToSet + " WBCT = r:" +rf +" g:"+gf +" b:"+bf); wbChannelVector = new RggbChannelVector(rf,gf,gf,bf); - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.COLOR_CORRECTION_GAINS, wbChannelVector); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.COLOR_CORRECTION_GAINS, wbChannelVector,setToCamera); } @@ -263,7 +263,7 @@ public boolean IsSupported() { @Override public void setValue(String valueToSet, boolean setToCamera) { - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.COLOR_CORRECTION_MODE, parameterValues.get(valueToSet)); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.COLOR_CORRECTION_MODE, parameterValues.get(valueToSet),setToCamera); fireStringValueChanged(valueToSet); } diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/huawei/HuaweiAeHandler.java b/app/src/main/java/freed/cam/apis/camera2/parameters/huawei/HuaweiAeHandler.java index 7e02a5b91..e14439ae3 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/huawei/HuaweiAeHandler.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/huawei/HuaweiAeHandler.java @@ -26,8 +26,8 @@ protected void setManualItemsSetSupport(boolean off) { @Override - protected void setExposureTime(int valueToSet) { - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE,CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE_ENABLED); + protected void setExposureTime(int valueToSet,boolean setToCamera) { + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE,CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE_ENABLED,setToCamera); if (valueToSet > 0) { String shutter = manualExposureTimeApi2.getStringValues()[valueToSet]; Rational rational; @@ -47,14 +47,14 @@ else if (shutter.contains(".")) rational = new Rational(Integer.parseInt(shutter),1); } int val = (int) AbstractManualShutter.getMilliSecondStringFromShutterString(manualExposureTimeApi2.getStringValues()[valueToSet]); - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_EXPOSURE_TIME, val); - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROF_EXPOSURE_TIME, rational); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_EXPOSURE_TIME, val,setToCamera); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROF_EXPOSURE_TIME, rational,setToCamera); manualExposureTimeApi2.fireIntValueChanged(valueToSet); } else { - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_EXPOSURE_TIME, 0); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_EXPOSURE_TIME, 0,setToCamera); } } @@ -64,24 +64,24 @@ protected boolean isExposureTimeSetSupported() { } @Override - protected void setIso(int valueToSet) { + protected void setIso(int valueToSet,boolean setToCamera) { if (cameraHolder == null || cameraHolder.captureSessionHandler.GetActiveCameraCaptureSession() == null) return; - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE,CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE_ENABLED); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE,CaptureRequestEx.HUAWEI_PROFESSIONAL_MODE_ENABLED,setToCamera); if (valueToSet == 0) { - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_ISO_VALUE, 0); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_ISO_VALUE, 0,setToCamera); } else { - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_ISO_VALUE, Integer.parseInt(manualISoApi2.getStringValues()[valueToSet])); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_SENSOR_ISO_VALUE, Integer.parseInt(manualISoApi2.getStringValues()[valueToSet]),setToCamera); } } @Override - protected void setExpoCompensation(int valueToSet) { + protected void setExpoCompensation(int valueToSet,boolean setToCamera) { float t = Float.parseFloat(manualExposureApi2.getStringValues()[valueToSet].replace(",",".")); - cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_EXPOSURE_COMP_VALUE, t); + cameraHolder.captureSessionHandler.SetParameterRepeating(CaptureRequestEx.HUAWEI_EXPOSURE_COMP_VALUE, t,setToCamera); } @Override diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/BurstApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/BurstApi2.java index ac99fbe65..46c4e6e14 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/BurstApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/BurstApi2.java @@ -68,7 +68,7 @@ public String[] getStringValues() { } @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { current = valueToSet; } diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualFocus.java b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualFocus.java index 0b1963b9c..5fc6cc67d 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualFocus.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualFocus.java @@ -74,26 +74,26 @@ public String GetStringValue() @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if(valueToSet == 0) { - cameraUiWrapper.getParameterHandler().get(Settings.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.auto), true); - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); + cameraUiWrapper.getParameterHandler().get(Settings.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.auto), setToCamera); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE,setToCamera); } else { if (!cameraUiWrapper.getParameterHandler().get(Settings.FocusMode).GetStringValue().equals(cameraUiWrapper.getContext().getString(R.string.off))) { - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_CANCEL); - cameraUiWrapper.getParameterHandler().get(Settings.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.off), true); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_CANCEL,setToCamera); + cameraUiWrapper.getParameterHandler().get(Settings.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.off), setToCamera); } if (currentInt > focusvalues.getSize()) currentInt = focusvalues.getSize() -1; float valtoset= focusvalues.getValue(currentInt); Log.d(TAG, "Set MF TO: " + valtoset+ " ValueTOSET: " + valueToSet); - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.LENS_FOCUS_DISTANCE, valtoset); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.LENS_FOCUS_DISTANCE, valtoset,setToCamera); } } diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualToneMapCurveApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualToneMapCurveApi2.java index 15716d72a..836d1b693 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualToneMapCurveApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ManualToneMapCurveApi2.java @@ -175,7 +175,7 @@ public int GetValue() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { Log.d(TAG, "Contrast value to set:" + valueToSet); if (valueToSet == -1) @@ -261,7 +261,7 @@ public int GetValue() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { valueToSet = valueToSet *4; currentInt = valueToSet; @@ -337,7 +337,7 @@ public int GetValue() { } @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; float toset = Float.parseFloat(stringvalues[valueToSet]) / 100; @@ -392,7 +392,7 @@ private void setTonemap() float[]tonemap = {blackpoint[0], blackpoint[1], shadows[0], shadows[1], midtones[0], midtones[1], highlights[0], highlights[1], whitepoint[0], whitepoint[1]}; TonemapCurve tonemapCurve = new TonemapCurve(tonemap,tonemap,tonemap); Log.d(TAG,"ToSet Curve:" + tonemapCurve.toString()); - ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve); + ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve,true); } public class ToneCurveParameter extends AbstractParameter @@ -402,14 +402,14 @@ public void setCurveToCamera(float[] curve) toneCurve = curve; TonemapCurve tonemapCurve = new TonemapCurve(curve,curve,curve); Log.d(TAG,"ToSet Curve:" + tonemapCurve.toString()); - ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve); + ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve,true); } public void setCurveToCamera(float[] r, float[] g,float[] b) { TonemapCurve tonemapCurve = new TonemapCurve(r,g,b); Log.d(TAG,"ToSet Curve:" + tonemapCurve.toString()); - ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve); + ((CameraHolderApi2) cameraWrapperInterface.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.TONEMAP_CURVE, tonemapCurve,true); } public float[] getToneCurve() diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ZoomApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ZoomApi2.java index 13ba37ab5..8a50a9058 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ZoomApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/manual/ZoomApi2.java @@ -81,7 +81,7 @@ public int GetValue() { @TargetApi(VERSION_CODES.LOLLIPOP) @Override - public void setValue(int valueToSet) + public void setValue(int valueToSet, boolean setToCamera) { zoom = valueToSet; @@ -93,7 +93,7 @@ public void setValue(int valueToSet) /*cropW -= cropW & 3; cropH -= cropH & 3;*/ Rect zoom = new Rect(cropW, cropH,sensorSize.width()-cropW, sensorSize.height() - cropH); - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.SCALER_CROP_REGION, zoom); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.SCALER_CROP_REGION, zoom,setToCamera); } public Rect getZoomRect(float zoom, int imgWidth, int imgHeight) diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeLockModeApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeLockModeApi2.java index 073a19a18..136fc567e 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeLockModeApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeLockModeApi2.java @@ -40,9 +40,9 @@ public String[] getStringValues() { @Override public void setValue(String valueToSet, boolean setToCamera) { if (valueToSet.equals(cameraUiWrapper.getResString(R.string.true_))) - ((CameraHolderApi2)cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_LOCK,true); + ((CameraHolderApi2)cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_LOCK,true,setToCamera); else - ((CameraHolderApi2)cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_LOCK,false); + ((CameraHolderApi2)cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AE_LOCK,false,setToCamera); //onValueHasChanged(valueToSet); } } diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeTargetRangeApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeTargetRangeApi2.java index 12ff78b1f..79a809dfe 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeTargetRangeApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/AeTargetRangeApi2.java @@ -34,7 +34,7 @@ public void setValue(String valueToSet, boolean setToCamera) fireStringValueChanged(valueToSet); String[] toset = valueToSet.split(","); Range t = new Range(Integer.parseInt(toset[0]), Integer.parseInt(toset[1])); - captureSessionHandler.SetParameterRepeating(key, t); + captureSessionHandler.SetParameterRepeating(key, t,setToCamera); } @Override diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/BaseModeApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/BaseModeApi2.java index b02b6e14d..5d32f662b 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/BaseModeApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/BaseModeApi2.java @@ -90,7 +90,7 @@ protected void setValue(String valueToSet, boolean setToCamera) { super.setValue(valueToSet, setToCamera); try { int toset = parameterValues.get(valueToSet); - captureSessionHandler.SetParameterRepeating(parameterKey, toset); + captureSessionHandler.SetParameterRepeating(parameterKey, toset,setToCamera); } catch (NullPointerException ex) { diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/DualCameraModeHuaweiApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/DualCameraModeHuaweiApi2.java index c2d142746..15b4eb028 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/DualCameraModeHuaweiApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/DualCameraModeHuaweiApi2.java @@ -24,7 +24,7 @@ public DualCameraModeHuaweiApi2(CameraWrapperInterface cameraUiWrapper, Settings super(cameraUiWrapper, settingMode, null); this.parameterKey = parameterKey; isSupported = settingMode.isSupported(); - captureSessionHandler.SetParameterRepeating(parameterKey,(byte)0); + captureSessionHandler.SetParameterRepeating(parameterKey,(byte)0,true); if (isSupported) parameterValues = StringUtils.StringArrayToIntHashmap(settingMode.getValues()); else settingMode = null; @@ -40,7 +40,7 @@ public boolean IsSupported() public void setValue(String valueToSet, boolean setToCamera) { int toset = parameterValues.get(valueToSet); - captureSessionHandler.SetParameterRepeating(parameterKey, Byte.valueOf((byte)toset)); + captureSessionHandler.SetParameterRepeating(parameterKey, Byte.valueOf((byte)toset),setToCamera); fireStringValueChanged(valueToSet); diff --git a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/JpegQualityModeApi2.java b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/JpegQualityModeApi2.java index a3b1f445b..8a62d8a00 100644 --- a/app/src/main/java/freed/cam/apis/camera2/parameters/modes/JpegQualityModeApi2.java +++ b/app/src/main/java/freed/cam/apis/camera2/parameters/modes/JpegQualityModeApi2.java @@ -55,7 +55,7 @@ public String[] getStringValues() { @Override public void setValue(String valueToSet, boolean setToCamera) { - ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.JPEG_QUALITY, (byte)Integer.parseInt(valueToSet)); + ((CameraHolderApi2) cameraUiWrapper.getCameraHolder()).captureSessionHandler.SetParameterRepeating(CaptureRequest.JPEG_QUALITY, (byte)Integer.parseInt(valueToSet),setToCamera); fireStringValueChanged(valueToSet); } } diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/BaseManualParameterSony.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/BaseManualParameterSony.java index 126ff98a6..0585b1aa2 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/BaseManualParameterSony.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/BaseManualParameterSony.java @@ -134,7 +134,7 @@ public void run() @Override - public void SetValue(final int valueToSet) + public void SetValue(final int valueToSet, boolean setToCamera) { sendLog("Set Value to " + valueToSet); currentInt = valueToSet; diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ExposureCompManualParameterSony.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ExposureCompManualParameterSony.java index 7c304caba..6503d1410 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ExposureCompManualParameterSony.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ExposureCompManualParameterSony.java @@ -42,7 +42,7 @@ public ExposureCompManualParameterSony(CameraWrapperInterface cameraUiWrapper) { } @Override - public void SetValue(final int valueToSet) + public void SetValue(final int valueToSet, boolean setToCamera) { currentInt = valueToSet; FreeDPool.Execute(new Runnable() { diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/PreviewZoomManual.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/PreviewZoomManual.java index fc7f33e55..24926f394 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/PreviewZoomManual.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/PreviewZoomManual.java @@ -67,7 +67,7 @@ public String[] getStringValues() { } @Override - public void SetValue(int valueToSet) { + public void SetValue(int valueToSet, boolean setToCamera) { int zoomFactor = Integer.parseInt(stringvalues[valueToSet]); surfaceView.PreviewZOOMFactor = zoomFactor; fireIntValueChanged(valueToSet); diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ProgramShiftManualSony.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ProgramShiftManualSony.java index 36ee04665..acb573eaa 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ProgramShiftManualSony.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ProgramShiftManualSony.java @@ -144,7 +144,7 @@ public void run() } @Override - public void SetValue(final int valueToSet) + public void SetValue(final int valueToSet, boolean setToCamera) { currentInt = valueToSet; FreeDPool.Execute(new Runnable() { diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/WbCTManualSony.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/WbCTManualSony.java index bfd1cf447..8cd2ceb99 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/WbCTManualSony.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/WbCTManualSony.java @@ -83,7 +83,7 @@ public void run() { } @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { currentInt = valueToSet; if (valueToSet > values.length) diff --git a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ZoomManualSony.java b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ZoomManualSony.java index eb805d0fb..ce5506128 100644 --- a/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ZoomManualSony.java +++ b/app/src/main/java/freed/cam/apis/sonyremote/parameters/manual/ZoomManualSony.java @@ -96,7 +96,7 @@ public void run() { } @Override - public void SetValue(int valueToSet) + public void SetValue(int valueToSet, boolean setToCamera) { zoomToSet = valueToSet; if (!isZooming) @@ -132,7 +132,7 @@ public void setZoomsHasChanged(int zoom) if (zoomToSet != currentInt && fromUser) { if (!checkIfIntIsInRange(zoomToSet, currentInt)) - SetValue(zoomToSet); + SetValue(zoomToSet, true); else { zoomToSet = currentInt; fromUser = false; diff --git a/app/src/main/java/freed/cam/ui/themesample/cameraui/ManualButton.java b/app/src/main/java/freed/cam/ui/themesample/cameraui/ManualButton.java index edebdc7fe..4eeae6cb3 100644 --- a/app/src/main/java/freed/cam/ui/themesample/cameraui/ManualButton.java +++ b/app/src/main/java/freed/cam/ui/themesample/cameraui/ManualButton.java @@ -289,7 +289,7 @@ public int getCurrentItem() public void setValueToParameters(final int value) { - parameter.SetValue(value); + parameter.SetValue(value, true); handler.setON_UPDATE_SETTING(value); }