From 0095e00bc7611e9715de745cd442569b0b5c3af8 Mon Sep 17 00:00:00 2001 From: FeuRenard Date: Thu, 16 Feb 2017 21:28:06 +0100 Subject: [PATCH] Keep screen on during voice note recording Closes #6239 Fixes #4646 // FREEBIE --- src/org/thoughtcrime/securesms/ConversationActivity.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index d857aee8ff..85e184385d 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -55,6 +55,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.View.OnKeyListener; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.ImageButton; @@ -1646,6 +1647,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity public void onRecorderStarted() { Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(20); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); audioRecorder.startRecording(); } @@ -1654,6 +1656,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity public void onRecorderFinished() { Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(20); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); ListenableFuture> future = audioRecorder.stopRecording(); future.addListener(new ListenableFuture.Listener>() { @@ -1696,6 +1699,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity public void onRecorderCanceled() { Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(50); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); ListenableFuture> future = audioRecorder.stopRecording(); future.addListener(new ListenableFuture.Listener>() {