diff --git a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/activities/SettingsActivity.java b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/activities/SettingsActivity.java index e5065b3f..706e12db 100644 --- a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/activities/SettingsActivity.java +++ b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/activities/SettingsActivity.java @@ -218,6 +218,9 @@ else if (SystemUtil.isAppInstalled(Application.getResourceString(R.string.packag PreferenceUtil.setAllHints(!showTips); // always show tips for first use PreferenceUtil.setSharedPreferenceBoolean(R.string.key_tip_firstuse, false); + // always show hint on max volume for external LED + PreferenceUtil.setSharedPreferenceBoolean(R.string.key_tip_external_flash, false); + PreferenceUtil.setSharedPreferenceBoolean(R.string.key_internal_initialized_hints, true); } diff --git a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/AudioUtil.java b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/AudioUtil.java index 96bd7b26..67c9c978 100644 --- a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/AudioUtil.java +++ b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/AudioUtil.java @@ -64,8 +64,8 @@ public static AudioTrack generateTone(final double freqHz, final int durationMs) public static AudioTrack generateHighFreqTone(final int durationMs) { int count = (int) (BITRATE * 2.0 * (durationMs / MILLIS_IN_SECOND)) & ~1; short[] samples = new short[count]; - for (int i = 0; i < count; i += 2) { - short sample = TONE_MAP[(i / 2) % 4]; // MAGIC_NUMBER + for (int i = 0; i < count; i += 2) { // MAGIC_NUMBER + short sample = TONE_MAP[(i / 4) % 4]; // MAGIC_NUMBER samples[i] = sample; samples[i + 1] = sample; } diff --git a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera1Handler.java b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera1Handler.java index 5ff64f79..f4a17b22 100644 --- a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera1Handler.java +++ b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera1Handler.java @@ -355,7 +355,7 @@ public final void takePicture() { } } - mCamera.takePicture(mShutterCallback, null, mPhotoCallback); + mCamera.takePicture(mShutterCallback, mRawCallback, mPhotoCallback); } /** @@ -432,10 +432,19 @@ public void onPictureTaken(final byte[] data, final Camera photoCamera) { private final ShutterCallback mShutterCallback = new ShutterCallback() { @Override public void onShutter() { + mCameraCallback.onTakingPicture(); + } + }; + + /** + * The callback called when pictures are taken. + */ + private final PictureCallback mRawCallback = new PictureCallback() { + @Override + public void onPictureTaken(final byte[] data, final Camera photoCamera) { if (mUseExternalFlash && mExternalFlashBeep != null) { mExternalFlashBeep.stop(); } - mCameraCallback.onTakingPicture(); } }; diff --git a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera2Handler.java b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera2Handler.java index bd9f953a..ba0672ee 100644 --- a/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera2Handler.java +++ b/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/Camera2Handler.java @@ -284,6 +284,10 @@ public void onError(@NonNull final CameraDevice cameraDevice, final int error) { private final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(@NonNull final ImageReader reader) { + if (mUseExternalFlash && mExternalFlashBeep != null) { + mExternalFlashBeep.stop(); + } + Image image = reader.acquireNextImage(); ByteBuffer buffer = image.getPlanes()[0].getBuffer(); byte[] data = new byte[buffer.remaining()]; @@ -352,9 +356,6 @@ else if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState } break; case STATE_TAKING_PICTURE_END: - if (mUseExternalFlash && mExternalFlashBeep != null) { - mExternalFlashBeep.stop(); - } mCameraCallback.onTakingPicture(); mState = CameraState.STATE_PICTURE_TAKEN; break;