Skip to content

Commit

Permalink
add touch to capture
Browse files Browse the repository at this point in the history
  • Loading branch information
KillerInk committed Jan 5, 2018
1 parent 4a0676d commit 2fcac61
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import freed.cam.ui.themesample.cameraui.FocusSelector;
import freed.cam.ui.themesample.handler.ImageViewTouchAreaHandler.I_TouchListnerEvent;
import freed.settings.SettingKeys;
import freed.settings.SettingsManager;


/**
Expand Down Expand Up @@ -158,10 +159,9 @@ public void FocusFinished(final boolean success)
public void run() {
focusImageView.setFocusCheck(success);
focusImageView.getFocus(wrapper.getParameterHandler().getFocusDistances());
/*if (success)
focusImageView.setBackgroundResource(R.drawable.crosshair_circle_success);
else
focusImageView.setBackgroundResource(R.drawable.crosshair_circle_failed);*/
if (success && SettingsManager.get(SettingKeys.TouchToCapture).get() && !wrapper.getModuleHandler().getCurrentModule().ModuleName().equals(wrapper.getResString(R.string.module_video)))
wrapper.getModuleHandler().startWork();


focusImageView.setAnimation(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import freed.cam.ui.themesample.settings.childs.SettingsChildMenuVideoHDR;
import freed.cam.ui.themesample.settings.childs.SettingsChildMenuVideoProfile;
import freed.cam.ui.themesample.settings.childs.SettingsChildMenu_VideoProfEditor;
import freed.cam.ui.themesample.settings.childs.SettingsChild_BooleanSetting;
import freed.settings.SettingKeys;
import freed.settings.SettingsManager;

Expand Down Expand Up @@ -246,10 +247,6 @@ public void setCameraToUi(CameraWrapperInterface wrapper) {
guide.SetUiItemClickListner(this);
globalSettingGroup.addView(guide);

SettingsChildMenuSaveCamParams saveCamParams = new SettingsChildMenuSaveCamParams(getContext(),R.string.setting_savecamparams_header,R.string.setting_savecamparams_description,cameraUiWrapper);
saveCamParams.setCameraUiWrapper(cameraUiWrapper);
globalSettingGroup.addView(saveCamParams);

SettingsChildMenu horizont = new SettingsChildMenu(getContext(), R.string.setting_horizont_header, R.string.setting_horizont_description);
horizont.SetStuff(fragment_activityInterface, SettingsManager.SETTING_HORIZONT);
horizont.SetParameter(cameraUiWrapper.getParameterHandler().get(SettingKeys.HorizontLvl));
Expand All @@ -261,6 +258,14 @@ public void setCameraToUi(CameraWrapperInterface wrapper) {
nightoverlay.SetParameter(cameraUiWrapper.getParameterHandler().get(SettingKeys.NightOverlay));
globalSettingGroup.addView(nightoverlay);

SettingsChild_BooleanSetting booleanSetting = new SettingsChild_BooleanSetting(getContext(),SettingsManager.get(SettingKeys.TouchToCapture),R.string.setting_touchtocapture_header, R.string.setting_touchtocapture_description);
globalSettingGroup.addView(booleanSetting);


SettingsChildMenuSaveCamParams saveCamParams = new SettingsChildMenuSaveCamParams(getContext(),R.string.setting_savecamparams_header,R.string.setting_savecamparams_description,cameraUiWrapper);
saveCamParams.setCameraUiWrapper(cameraUiWrapper);
globalSettingGroup.addView(saveCamParams);

if (!(cameraUiWrapper instanceof SonyCameraRemoteFragment))
{
SettingsChildFeatureDetect fd = new SettingsChildFeatureDetect(getContext(),R.string.setting_featuredetector_header,R.string.setting_featuredetector_description, fragment_activityInterface);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package freed.cam.ui.themesample.settings.childs;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;

import com.troop.freedcam.R;

import freed.settings.SettingKeys;
import freed.settings.SettingsManager;
import freed.settings.mode.ApiBooleanSettingMode;
import freed.settings.mode.GlobalBooleanSettingMode;

/**
* Created by KillerInk on 05.01.2018.
*/

public class SettingsChild_BooleanSetting extends LinearLayout
{
private TextView description;

private TextView headerText;
private Switch aSwitch;
private GlobalBooleanSettingMode booleanSettingMode;

public SettingsChild_BooleanSetting(Context context, final GlobalBooleanSettingMode booleanSettingMode, int headerid, int descriptionid) {
super(context);
this.booleanSettingMode = booleanSettingMode;
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.settings_booleansettingschild, this);
headerText = (TextView) findViewById(R.id.header);
aSwitch = (Switch) findViewById(R.id.switch1);
aSwitch.setChecked(booleanSettingMode.get());
aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
booleanSettingMode.set(isChecked);
}
});
description = (TextView) findViewById(R.id.description);
headerText.setText(getResources().getText(headerid));
description.setText(getResources().getText(descriptionid));
}
}
1 change: 1 addition & 0 deletions app/src/main/java/freed/settings/SettingKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class SettingKeys{
public final static Key<GlobalBooleanSettingMode> forceRawToDng = new Key(GlobalBooleanSettingMode.class, R.string.aps_forcerawtondng);
public final static Key<GlobalBooleanSettingMode> areFeaturesDetected = new Key(GlobalBooleanSettingMode.class, R.string.aps_arefeaturesdetected);
public final static Key<GlobalBooleanSettingMode> NightOverlay = new Key(GlobalBooleanSettingMode.class, R.string.aps_nightoverlay);
public final static Key<GlobalBooleanSettingMode> TouchToCapture = new Key(GlobalBooleanSettingMode.class, R.string.aps_touchtocapture);

public final static Key<ApiBooleanSettingMode> useQcomFocus = new Key(ApiBooleanSettingMode.class, R.string.aps_qcomfocus);
public final static Key<ApiBooleanSettingMode> support12bitRaw = new Key(ApiBooleanSettingMode.class, R.string.aps_support12bitraw);
Expand Down
41 changes: 41 additions & 0 deletions app/src/main/res/layout/settings_booleansettingschild.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/uiSettingsBackground"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView"
android:textSize="@dimen/settings_menu_item_header"
android:textColor="@android:color/holo_green_dark"
android:textStyle="bold"/>

<Switch
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="" />

</LinearLayout>

<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="TextView"
android:textSize="@dimen/settings_menu_item_header_value"
android:textColor="@color/uiSettingsTextColor"/>

</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/appsettings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@
<string name="aps_tonecurve" translatable="false">tonecurve</string>
<string name="aps_location" translatable="false">location</string>
<string name="aps_bayformat" translatable="false">bayerformat</string>
<string name="aps_touchtocapture" translatable="false">touchtocapture</string>

</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<string name="setting_focuspeak_header">Focuspeak: </string>
<string name="setting_nightoverlay_description">shows a red Overlay</string>
<string name="setting_nightoverlay_header">NightOverlay: </string>
<string name="setting_touchtocapture_description">When enabled, a image capture starts.</string>
<string name="setting_touchtocapture_header">Touch to Capture: </string>
<string name="setting_orientation_header">Orientation Correction: </string>
<string name="setting_orientation_description">Rotates the Camera 180° if ON</string>
<string name="setting_featuredetector_header">Run FeatureDetector</string>
Expand Down

0 comments on commit 2fcac61

Please sign in to comment.