From 2af9e34b6477aa34d0587d3bb1f3b7f15b117cff Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 11 Sep 2018 21:13:56 +0200 Subject: make recording activity not crash if microphone was in use --- .../java/de/pixart/messenger/ui/RecordingActivity.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java index 15d193886..455bbf3c3 100644 --- a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java +++ b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java @@ -65,7 +65,8 @@ public class RecordingActivity extends Activity implements View.OnClickListener super.onStart(); if (!startRecording()) { this.binding.shareButton.setEnabled(false); - Toast.makeText(this, R.string.unable_to_start_recording, Toast.LENGTH_SHORT).show(); + this.binding.timer.setTextAppearance(this, R.style.TextAppearance_Conversations_Title); + this.binding.timer.setText(R.string.unable_to_start_recording); } } @@ -108,12 +109,15 @@ public class RecordingActivity extends Activity implements View.OnClickListener mShouldFinishAfterWrite = saveFile; try { mRecorder.stop(); - } catch (RuntimeException stopException) { - //handle cleanup here + mRecorder.release(); + } catch (Exception e) { + if (saveFile) { + Toast.makeText(this,R.string.unable_to_save_recording, Toast.LENGTH_SHORT).show(); + } + } finally { + mRecorder = null; + mStartTime = 0; } - mRecorder.release(); - mRecorder = null; - mStartTime = 0; if (!saveFile && mOutputFile != null) { if (mOutputFile.delete()) { Log.d(Config.LOGTAG,"deleted canceled recording"); -- cgit v1.2.3