Skip to content

Commit

Permalink
Fix rotation for waveform
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Dec 2, 2020
1 parent 74dca6c commit b515435
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Expand Up @@ -37,8 +37,16 @@ private void init(Context context) {
}

public void addAmplitude(int amplitude) {
lastAmplitude = amplitude;
audioRecordView.update(amplitude);
/*
AudioRecordView can't handle updates when its height is 0 (which can happens early in
the view lifecycle). In this case it ends up storing an incorrect max height for each
one of its "chunks" and so the waveform is just a straight bar. This probably needs to
be fixed within the view itself: https://github.com/Armen101/AudioRecordView/issues/11
*/
if (audioRecordView.getHeight() > 0) {
lastAmplitude = amplitude;
audioRecordView.update(amplitude);
}
}

@Nullable
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/layout/waveform_layout.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.visualizer.amplitude.AudioRecordView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/waveform"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:chunkAlignTo="bottom"
Expand Down

0 comments on commit b515435

Please sign in to comment.