make sure to torn of torch after taking a picture

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-11-10 00:12:53 +01:00
parent dd9501590b
commit d0f52c8eba
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 7 additions and 0 deletions

View file

@ -324,6 +324,7 @@ public class TakePhotoActivity extends AppCompatActivity {
binding.photoPreview.setImageBitmap(bitmap);
binding.photoPreview.setTag(savedUri);
viewModel.disableTorchIfEnabled();
}
public int getImageOrientation(File imageFile) {

View file

@ -64,6 +64,12 @@ public class TakePictureViewModel extends ViewModel {
}
}
public void disableTorchIfEnabled() {
if (this.torchEnabled.getValue()) {
toggleTorchEnabled();
}
}
public void toggleTorchEnabled() {
//noinspection ConstantConditions
this.torchEnabled.postValue(!this.torchEnabled.getValue());