|
|
|
@ -1,6 +1,7 @@
|
|
|
|
package org.koitharu.kotatsu.main.ui
|
|
|
|
package org.koitharu.kotatsu.main.ui
|
|
|
|
|
|
|
|
|
|
|
|
import android.Manifest
|
|
|
|
import android.Manifest
|
|
|
|
|
|
|
|
import android.app.BackgroundServiceStartNotAllowedException
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
|
|
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
|
|
import android.os.Build
|
|
|
|
import android.os.Build
|
|
|
|
@ -58,6 +59,7 @@ import org.koitharu.kotatsu.core.util.ext.consume
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.end
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.end
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.observe
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.observe
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.observeEvent
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.observeEvent
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.start
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.start
|
|
|
|
import org.koitharu.kotatsu.databinding.ActivityMainBinding
|
|
|
|
import org.koitharu.kotatsu.databinding.ActivityMainBinding
|
|
|
|
import org.koitharu.kotatsu.details.service.MangaPrefetchService
|
|
|
|
import org.koitharu.kotatsu.details.service.MangaPrefetchService
|
|
|
|
@ -288,7 +290,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), AppBarOwner, BottomNav
|
|
|
|
adjustFabVisibility(isResumeEnabled = isEnabled)
|
|
|
|
adjustFabVisibility(isResumeEnabled = isEnabled)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun onFirstStart() {
|
|
|
|
private fun onFirstStart() = try {
|
|
|
|
lifecycleScope.launch(Dispatchers.Main) { // not a default `Main.immediate` dispatcher
|
|
|
|
lifecycleScope.launch(Dispatchers.Main) { // not a default `Main.immediate` dispatcher
|
|
|
|
withContext(Dispatchers.Default) {
|
|
|
|
withContext(Dispatchers.Default) {
|
|
|
|
LocalStorageCleanupWorker.enqueue(applicationContext)
|
|
|
|
LocalStorageCleanupWorker.enqueue(applicationContext)
|
|
|
|
@ -303,6 +305,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), AppBarOwner, BottomNav
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e: BackgroundServiceStartNotAllowedException) {
|
|
|
|
|
|
|
|
e.printStackTraceDebug()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun adjustAppbar(topFragment: Fragment) {
|
|
|
|
private fun adjustAppbar(topFragment: Fragment) {
|
|
|
|
|