all: reformat

This commit is contained in:
Alexander Capehart
2026-11-01 15:48:55 -07:00
parent 2aa7e0a50a
commit 4044f62dfb
4 changed files with 15 additions and 13 deletions
@@ -21,8 +21,8 @@ package org.oxycblt.auxio.detail
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import javax.inject.Inject
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
@@ -21,9 +21,9 @@ package org.oxycblt.auxio.playback
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
@@ -188,13 +188,14 @@ constructor(
// Replace the previous position co-routine with a new one that uses the new
// state information.
lastPositionJob?.cancel()
lastPositionJob = viewModelScope.launch(Dispatchers.Default) {
while (true) {
positionDs.value = progression.calculateElapsedPositionMs().msToDs()
// Wait a deci-second for the next position tick.
delay(100.milliseconds)
lastPositionJob =
viewModelScope.launch(Dispatchers.Default) {
while (true) {
positionDs.value = progression.calculateElapsedPositionMs().msToDs()
// Wait a deci-second for the next position tick.
delay(100.milliseconds)
}
}
}
}
override fun onRepeatModeChanged(repeatMode: RepeatMode) {
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.auxio.playback.ui.swiper
import android.graphics.RectF
@@ -21,8 +21,8 @@ package org.oxycblt.auxio.search
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import javax.inject.Inject
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -101,9 +101,10 @@ constructor(
// Searching is time-consuming, so do it in the background.
L.d("Searching music library for $query")
currentSearchJob = viewModelScope.launch(Dispatchers.Default) {
searchResults.value = searchImpl(library, query).also { yield() }
}
currentSearchJob =
viewModelScope.launch(Dispatchers.Default) {
searchResults.value = searchImpl(library, query).also { yield() }
}
}
private suspend fun searchImpl(library: Library, query: String): List<Item> {