Skip to content

Commit

Permalink
apply last used focusmode when mf get set to auto
Browse files Browse the repository at this point in the history
  • Loading branch information
KillerInk committed Mar 4, 2018
1 parent 9853fdd commit d677a63
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,21 @@ public String GetStringValue()
public void setValue(int valueToSet, boolean setToCamera)
{
currentInt = valueToSet;
//set to auto
if(valueToSet == 0)
{
cameraUiWrapper.getParameterHandler().get(SettingKeys.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.auto), setToCamera);
//apply last used focuse mode
cameraUiWrapper.getParameterHandler().get(SettingKeys.FocusMode).SetValue(SettingsManager.get(SettingKeys.FocusMode).get(), setToCamera);
((Camera2Fragment) cameraUiWrapper).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE,setToCamera);
}
else
else // set to manual
{
//if focusmode is in any other mode, turn af off
if (!cameraUiWrapper.getParameterHandler().get(SettingKeys.FocusMode).GetStringValue().equals(cameraUiWrapper.getContext().getString(R.string.off)))
{
//apply turn off direct to the capturesession, else it get stored in settings.
((Camera2Fragment) cameraUiWrapper).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_CANCEL,setToCamera);
cameraUiWrapper.getParameterHandler().get(SettingKeys.FocusMode).SetValue(cameraUiWrapper.getContext().getString(R.string.off), setToCamera);
((Camera2Fragment) cameraUiWrapper).captureSessionHandler.SetParameterRepeating(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_OFF,setToCamera);
}
if (currentInt > focusvalues.getSize())
currentInt = focusvalues.getSize() -1;
Expand Down

0 comments on commit d677a63

Please sign in to comment.