From ab0c36dc0d6dd12b6f59aabc8a38639b027da199 Mon Sep 17 00:00:00 2001 From: Alexey Kuznetsov Date: Sat, 26 Mar 2016 18:40:16 +0300 Subject: [PATCH] increace stablerefresh --- .../audiorecorder/activities/RecordingActivity.java | 4 ++-- .../axet/audiorecorder/widgets/PitchView.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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; + } } }