Эх сурвалжийг харах

make sure to torn of torch after taking a picture

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 3 жил өмнө
parent
commit
d0f52c8eba

+ 1 - 0
app/src/main/java/com/nextcloud/talk/activities/TakePhotoActivity.java

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

+ 6 - 0
app/src/main/java/com/nextcloud/talk/models/TakePictureViewModel.java

@@ -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());