diff --git a/app/src/main/java/com/github/axet/audiorecorder/activities/RecordingActivity.java b/app/src/main/java/com/github/axet/audiorecorder/activities/RecordingActivity.java index fec624e..ab53317 100644 --- a/app/src/main/java/com/github/axet/audiorecorder/activities/RecordingActivity.java +++ b/app/src/main/java/com/github/axet/audiorecorder/activities/RecordingActivity.java @@ -532,6 +532,8 @@ public class RecordingActivity extends AppCompatActivity { thread.interrupt(); } + pitch.record(); + thread = new Thread(new Runnable() { @Override public void run() { @@ -640,8 +642,6 @@ public class RecordingActivity extends AppCompatActivity { }, "RecordingThread"); thread.start(); - pitch.record(); - showNotificationAlarm(true); } diff --git a/app/src/main/java/com/github/axet/audiorecorder/widgets/PitchView.java b/app/src/main/java/com/github/axet/audiorecorder/widgets/PitchView.java index 2ace271..a56962b 100644 --- a/app/src/main/java/com/github/axet/audiorecorder/widgets/PitchView.java +++ b/app/src/main/java/com/github/axet/audiorecorder/widgets/PitchView.java @@ -479,6 +479,7 @@ public class PitchView extends ViewGroup { draw = new Runnable() { long start = System.currentTimeMillis(); + int count = 0; @Override public void run() { @@ -493,7 +494,13 @@ public class PitchView extends ViewGroup { start = cur; - stableRefresh = true; + synchronized (this) { + if (count > 10) + stableRefresh = true; + } + + count += 1; + if (delay > 0) handler.postDelayed(draw, delay); else @@ -559,6 +566,8 @@ public class PitchView extends ViewGroup { } public boolean stableRefresh() { - return stableRefresh; + synchronized (this) { + return stableRefresh; + } } }