all: reformat
This commit is contained in:
@@ -21,8 +21,8 @@ package org.oxycblt.auxio.detail
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ package org.oxycblt.auxio.playback
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
@@ -188,13 +188,14 @@ constructor(
|
|||||||
// Replace the previous position co-routine with a new one that uses the new
|
// Replace the previous position co-routine with a new one that uses the new
|
||||||
// state information.
|
// state information.
|
||||||
lastPositionJob?.cancel()
|
lastPositionJob?.cancel()
|
||||||
lastPositionJob = viewModelScope.launch(Dispatchers.Default) {
|
lastPositionJob =
|
||||||
while (true) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
positionDs.value = progression.calculateElapsedPositionMs().msToDs()
|
while (true) {
|
||||||
// Wait a deci-second for the next position tick.
|
positionDs.value = progression.calculateElapsedPositionMs().msToDs()
|
||||||
delay(100.milliseconds)
|
// Wait a deci-second for the next position tick.
|
||||||
|
delay(100.milliseconds)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRepeatModeChanged(repeatMode: RepeatMode) {
|
override fun onRepeatModeChanged(repeatMode: RepeatMode) {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ package org.oxycblt.auxio.search
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
@@ -101,9 +101,10 @@ constructor(
|
|||||||
|
|
||||||
// Searching is time-consuming, so do it in the background.
|
// Searching is time-consuming, so do it in the background.
|
||||||
L.d("Searching music library for $query")
|
L.d("Searching music library for $query")
|
||||||
currentSearchJob = viewModelScope.launch(Dispatchers.Default) {
|
currentSearchJob =
|
||||||
searchResults.value = searchImpl(library, query).also { yield() }
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
}
|
searchResults.value = searchImpl(library, query).also { yield() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun searchImpl(library: Library, query: String): List<Item> {
|
private suspend fun searchImpl(library: Library, query: String): List<Item> {
|
||||||
|
|||||||
Reference in New Issue
Block a user