From 89cd184c332b9b577831a56d5e03f1d9aa54de36 Mon Sep 17 00:00:00 2001 From: Dylan McIntyre Date: Tue, 14 Feb 2017 14:59:30 -0500 Subject: [PATCH] tap to focus toggle --- .../flurgle/camerakit/demo/MainActivity.java | 19 +++++++++++++++++++ demo/src/main/res/layout/activity_main.xml | 1 + 2 files changed, 20 insertions(+) diff --git a/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java b/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java index 7d0d62a3..8f43666c 100644 --- a/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java +++ b/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java @@ -43,6 +43,11 @@ public class MainActivity extends AppCompatActivity { @BindView(R.id.cropModeRadioGroup) RadioGroup cropModeRadioGroup; + // Tap to Focus: + + @BindView(R.id.tapToFocusModeRadioGroup) + RadioGroup tapToFocusModeRadioGroup; + // Width: @BindView(R.id.screenWidth) @@ -97,6 +102,7 @@ public class MainActivity extends AppCompatActivity { captureModeRadioGroup.setOnCheckedChangeListener(captureModeChangedListener); cropModeRadioGroup.setOnCheckedChangeListener(cropModeChangedListener); + tapToFocusModeRadioGroup.setOnCheckedChangeListener(tapToFocusModeChangedListener); } @Override @@ -199,6 +205,19 @@ public class MainActivity extends AppCompatActivity { } }; + RadioGroup.OnCheckedChangeListener tapToFocusModeChangedListener = new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + camera.setTapToFocus( + checkedId == R.id.modeTapToFocusVisible ? + CameraKit.Constants.TAP_TO_FOCUS_VISIBLE : + checkedId == R.id.modeTapToFocusInvisible ? + CameraKit.Constants.TAP_TO_FOCUS_INVISIBLE : + CameraKit.Constants.TAP_TO_FOCUS_OFF + ); + } + }; + @OnTextChanged(value = R.id.width, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void widthChanged() { if (String.valueOf(mCameraWidth).equals(width.getText().toString())) { diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index fd8b17b9..fd9c7991 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -214,6 +214,7 @@ android:textStyle="bold" />