tap to focus toggle

pull/1/head
Dylan McIntyre 8 years ago
parent cce7661ab2
commit 89cd184c33
  1. 19
      demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java
  2. 1
      demo/src/main/res/layout/activity_main.xml

@ -43,6 +43,11 @@ public class MainActivity extends AppCompatActivity {
@BindView(R.id.cropModeRadioGroup) @BindView(R.id.cropModeRadioGroup)
RadioGroup cropModeRadioGroup; RadioGroup cropModeRadioGroup;
// Tap to Focus:
@BindView(R.id.tapToFocusModeRadioGroup)
RadioGroup tapToFocusModeRadioGroup;
// Width: // Width:
@BindView(R.id.screenWidth) @BindView(R.id.screenWidth)
@ -97,6 +102,7 @@ public class MainActivity extends AppCompatActivity {
captureModeRadioGroup.setOnCheckedChangeListener(captureModeChangedListener); captureModeRadioGroup.setOnCheckedChangeListener(captureModeChangedListener);
cropModeRadioGroup.setOnCheckedChangeListener(cropModeChangedListener); cropModeRadioGroup.setOnCheckedChangeListener(cropModeChangedListener);
tapToFocusModeRadioGroup.setOnCheckedChangeListener(tapToFocusModeChangedListener);
} }
@Override @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) @OnTextChanged(value = R.id.width, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void widthChanged() { void widthChanged() {
if (String.valueOf(mCameraWidth).equals(width.getText().toString())) { if (String.valueOf(mCameraWidth).equals(width.getText().toString())) {

@ -214,6 +214,7 @@
android:textStyle="bold" /> android:textStyle="bold" />
<RadioGroup <RadioGroup
android:id="@+id/tapToFocusModeRadioGroup"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"

Loading…
Cancel
Save