updating gradle, kotlin and some crashfixes

This commit is contained in:
tibbi 2020-04-17 22:23:34 +02:00
parent 85882c5304
commit 2eef96b8f0
5 changed files with 21 additions and 14 deletions

View file

@ -4,7 +4,7 @@
package="com.simplemobiletools.voicerecorder" package="com.simplemobiletools.voicerecorder"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission <uses-permission

View file

@ -49,7 +49,10 @@ class MainActivity : SimpleActivity() {
Intent(this@MainActivity, RecorderService::class.java).apply { Intent(this@MainActivity, RecorderService::class.java).apply {
action = STOP_AMPLITUDE_UPDATE action = STOP_AMPLITUDE_UPDATE
startService(this) try {
startService(this)
} catch (ignored: Exception) {
}
} }
} }

View file

@ -309,8 +309,8 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
private fun getProgressUpdateTask() = object : TimerTask() { private fun getProgressUpdateTask() = object : TimerTask() {
override fun run() { override fun run() {
if (player != null) { Handler(Looper.getMainLooper()).post {
Handler(Looper.getMainLooper()).post { if (player != null) {
val progress = Math.round(player!!.currentPosition / 1000.toDouble()).toInt() val progress = Math.round(player!!.currentPosition / 1000.toDouble()).toInt()
updateCurrentProgress(progress) updateCurrentProgress(progress)
player_progressbar.progress = progress player_progressbar.progress = progress

View file

@ -111,16 +111,20 @@ class RecorderService : Service() {
isRecording = false isRecording = false
recorder?.apply { recorder?.apply {
stop() try {
release() stop()
release()
ensureBackgroundThread { ensureBackgroundThread {
if (isQPlus()) { if (isQPlus()) {
addFileInNewMediaStore() addFileInNewMediaStore()
} else { } else {
addFileInLegacyMediaStore() addFileInLegacyMediaStore()
}
EventBus.getDefault().post(Events.RecordingCompleted())
} }
EventBus.getDefault().post(Events.RecordingCompleted()) } catch (e: Exception) {
showErrorToast(e)
} }
} }
recorder = null recorder = null

View file

@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.71' ext.kotlin_version = '1.3.72'
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.1' classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong