[BugFix]声音签名优化

This commit is contained in:
wushaocheng
2023-01-17 11:29:20 +08:00
parent 3bc593b9e9
commit 701040913d
3 changed files with 6 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.statistic.StatisticManager import com.yizhuan.xchat_android_core.statistic.StatisticManager
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol
import com.yizhuan.xchat_android_core.user.bean.UserInfo.SoundBean import com.yizhuan.xchat_android_core.user.bean.UserInfo.SoundBean
import com.yizhuan.xchat_android_core.utils.Logger
import com.yizhuan.xchat_android_library.utils.ResUtil import com.yizhuan.xchat_android_library.utils.ResUtil
import com.yizhuan.xchat_android_library.utils.SingleToastUtil import com.yizhuan.xchat_android_library.utils.SingleToastUtil
import io.reactivex.SingleObserver import io.reactivex.SingleObserver
@@ -417,15 +418,15 @@ class SoundSignatureActivity : BaseViewBindingActivity<ActivitySoundSignatureBin
timer?.schedule(object : TimerTask() { timer?.schedule(object : TimerTask() {
override fun run() { override fun run() {
runOnUiThread { runOnUiThread {
progress += 10 progress += 16
if (progress <= MAX_RECORD_VOICE_DURATION * 1000) { if (progress <= MAX_RECORD_VOICE_DURATION * 1000) {
if(mCountDownTime != 60) { if(mCountDownTime != 60 && soundViewModel.audioState == 1) {
binding.roundProgress.setProgress(progress) binding.roundProgress.setProgress(progress)
} }
} }
} }
} }
}, 0, 10) //间隔时间(单位为毫秒) }, 0, 16) //间隔时间(单位为毫秒)
} }
/** /**
@@ -444,6 +445,7 @@ class SoundSignatureActivity : BaseViewBindingActivity<ActivitySoundSignatureBin
binding.roundProgress.setProgress(0) binding.roundProgress.setProgress(0)
binding.roundProgress.setTotalProgress(mCountDownTime * 1000) binding.roundProgress.setTotalProgress(mCountDownTime * 1000)
MAX_RECORD_VOICE_DURATION = mCountDownTime MAX_RECORD_VOICE_DURATION = mCountDownTime
soundViewModel.audioState = SoundViewModel.STATE_RECORD_SUCCESS
} }
/** /**

View File

@@ -12,14 +12,12 @@ import com.yizhuan.xchat_android_library.utils.ResUtil;
import java.io.IOException; import java.io.IOException;
import lombok.Getter;
/** /**
* create by lvzebiao @2019/6/14 * create by lvzebiao @2019/6/14
*/ */
public class AudioPlayerHelper { public class AudioPlayerHelper {
private final static long mIntervalTime = 10L; private final static long mIntervalTime = 16L;
public interface WHAT_STATUS { public interface WHAT_STATUS {
int ERROR = 1; int ERROR = 1;

View File

@@ -302,11 +302,6 @@ class SoundViewModel : BaseViewModel() {
"duration = $currDuration" "duration = $currDuration"
) )
_showCountDownLiveData.value = currDuration.toInt() _showCountDownLiveData.value = currDuration.toInt()
// if (60000L - currDuration <= 500) {
// _showCountDownLiveData.value = (currDuration / 1000).toInt() + 1
// } else {
// _showCountDownLiveData.value = (currDuration / 1000).toInt()
// }
} }
override fun onCompletion() { override fun onCompletion() {