Skip to content

Commit

Permalink
Merge pull request #4 from KillerInk/master
Browse files Browse the repository at this point in the history
extend SetValue(int value,boolean setToCamera) to control if manualpa…
  • Loading branch information
Theliel authored Dec 14, 2017
2 parents 36579dc + 4f5948f commit 76ced3f
Show file tree
Hide file tree
Showing 60 changed files with 233 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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()
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
*/
public interface ManualParameterAEHandlerInterface extends ParameterInterface
{
void setValue(int value);
void setValue(int value, boolean setToCamera);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -69,7 +69,7 @@ public void setValue(int valueToSet)
}
}

public void SetValue(int value)
public void SetValue(int value, boolean setToCamera)
{

if (value == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 76ced3f

Please sign in to comment.