diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-09-11 21:13:56 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-09-11 21:13:56 +0200 |
commit | 2af9e34b6477aa34d0587d3bb1f3b7f15b117cff (patch) | |
tree | 5d20f3ba52bdfcb776908c79822d61881ffa5a7a /src/main | |
parent | 8c6030e0bf8e90a3ba67dbc6155adb2ff9000d1c (diff) |
make recording activity not crash if microphone was in use
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/RecordingActivity.java | 16 | ||||
-rw-r--r-- | src/main/res/layout/activity_recording.xml | 1 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values/themes.xml | 1 |
4 files changed, 13 insertions, 6 deletions
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"); diff --git a/src/main/res/layout/activity_recording.xml b/src/main/res/layout/activity_recording.xml index 35097fef4..e9dd345c6 100644 --- a/src/main/res/layout/activity_recording.xml +++ b/src/main/res/layout/activity_recording.xml @@ -46,6 +46,7 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" + android:layout_margin="8dp" android:text="0:00.0" android:textColor="?attr/colorAccent" android:textSize="50sp" diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 0c471ca79..1481bc6cc 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -813,4 +813,5 @@ <string name="pref_use_quick_share_attachment_choice_summary">Replace send button with attachment choice if no message is typed. Otherwise show quick actions, which can be cofigured in the following setting.</string> <string name="pref_quick_share_attachment_choice">Attachment choice</string> <string name="phone_book">Address book</string> + <string name="unable_to_save_recording">Unable to save recording</string> </resources> diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index c8a0a97a1..c17bb820f 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -284,6 +284,7 @@ <item name="colorAccent">@color/accent</item> <item name="color_background_primary">@color/grey50</item> <item name="divider">@color/black12</item> + <item name="TextSizeTitle">18sp</item> <item name="TextSizeBody2">14sp</item> <item name="TextSizeDisplay2">45sp</item> <item name="android:windowNoTitle">true</item> |