diff --git a/.editorconfig b/.editorconfig index 0a3635c146..1c8e0374e6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,5 @@ indent_size = 2 continuation_indent_size = 2 trim_trailing_whitespace = true max_line_length = 140 - -# noinspection EditorConfigKeyCorrectness -[*.{kt, kts}] -disabled_rules = import-ordering, trailing-comma +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true diff --git a/app/src/main/kotlin/voice/app/AppController.kt b/app/src/main/kotlin/voice/app/AppController.kt index d81f815896..56e8b03680 100644 --- a/app/src/main/kotlin/voice/app/AppController.kt +++ b/app/src/main/kotlin/voice/app/AppController.kt @@ -48,7 +48,7 @@ class AppController : ComposeController() { FolderPicker( onCloseClick = { navController.popBackStack() - } + }, ) } } diff --git a/app/src/main/kotlin/voice/app/features/MainActivity.kt b/app/src/main/kotlin/voice/app/features/MainActivity.kt index 33afade274..d28a53d817 100644 --- a/app/src/main/kotlin/voice/app/features/MainActivity.kt +++ b/app/src/main/kotlin/voice/app/features/MainActivity.kt @@ -75,7 +75,7 @@ class MainActivity : AppCompatActivity() { from: Controller?, isPush: Boolean, container: ViewGroup, - handler: ControllerChangeHandler + handler: ControllerChangeHandler, ) { from?.setOptionsMenuHidden(true) } @@ -85,11 +85,11 @@ class MainActivity : AppCompatActivity() { from: Controller?, isPush: Boolean, container: ViewGroup, - handler: ControllerChangeHandler + handler: ControllerChangeHandler, ) { from?.setOptionsMenuHidden(false) } - } + }, ) lifecycleScope.launch { diff --git a/app/src/main/kotlin/voice/app/features/audio/PlaybackSpeedDialogController.kt b/app/src/main/kotlin/voice/app/features/audio/PlaybackSpeedDialogController.kt index 41087cdb4d..2596512c95 100644 --- a/app/src/main/kotlin/voice/app/features/audio/PlaybackSpeedDialogController.kt +++ b/app/src/main/kotlin/voice/app/features/audio/PlaybackSpeedDialogController.kt @@ -49,7 +49,7 @@ class PlaybackSpeedDialogController : DialogController() { Slider.OnChangeListener { _, value, _ -> binding.textView.text = "${activity!!.getString(R.string.playback_speed)}: ${speedFormatter.format(value)}" playerController.setSpeed(value) - } + }, ) binding.slider.value = speed diff --git a/app/src/main/kotlin/voice/app/features/bookOverview/EditCoverDialogController.kt b/app/src/main/kotlin/voice/app/features/bookOverview/EditCoverDialogController.kt index 96d7a9f203..3c8e73c655 100644 --- a/app/src/main/kotlin/voice/app/features/bookOverview/EditCoverDialogController.kt +++ b/app/src/main/kotlin/voice/app/features/bookOverview/EditCoverDialogController.kt @@ -33,7 +33,7 @@ class EditCoverDialogController(bundle: Bundle) : DialogController(bundle) { constructor(args: Arguments) : this( Bundle().apply { putParcelable(NI_ARGS, args) - } + }, ) @Inject @@ -69,7 +69,7 @@ class EditCoverDialogController(bundle: Bundle) : DialogController(bundle) { ImageRequest.Builder(context) .data(arguments.coverUri) .transformations(CropTransformation(binding.cropOverlay, binding.coverImage)) - .build() + .build(), ) .drawable!!.toBitmap() @@ -87,6 +87,6 @@ class EditCoverDialogController(bundle: Bundle) : DialogController(bundle) { @Parcelize data class Arguments( val coverUri: Uri, - val bookId: BookId + val bookId: BookId, ) : Parcelable } diff --git a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterDialog.kt b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterDialog.kt index 30363043c9..ba283b2a32 100644 --- a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterDialog.kt +++ b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterDialog.kt @@ -30,7 +30,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) { constructor(bookId: BookId) : this( Bundle().apply { putBookId(NI_BOOK_ID, bookId) - } + }, ) init { @@ -47,7 +47,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) { BindingItem( mark, R.layout.select_chapter_row, - SelectChapterRowBinding::bind + SelectChapterRowBinding::bind, ) { data, position -> root.setOnClickListener(listener) @Suppress("SetTextI18n") @@ -56,7 +56,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) { 0, 0, if (position == viewState.selectedIndex) R.drawable.ic_equalizer else 0, - 0 + 0, ) } } diff --git a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewModel.kt b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewModel.kt index b143d5031b..ff5f69bdfd 100644 --- a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewModel.kt +++ b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewModel.kt @@ -14,7 +14,7 @@ import javax.inject.Inject class SelectChapterViewModel @Inject constructor( private val bookRepository: BookRepository, - private val player: PlayerController + private val player: PlayerController, ) { private val scope = MainScope() diff --git a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewState.kt b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewState.kt index 885f68ab39..1cc110ed74 100644 --- a/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewState.kt +++ b/app/src/main/kotlin/voice/app/features/bookPlaying/selectchapter/SelectChapterViewState.kt @@ -4,5 +4,5 @@ import voice.data.ChapterMark data class SelectChapterViewState( val chapters: List, - val selectedIndex: Int? + val selectedIndex: Int?, ) diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkController.kt b/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkController.kt index fb79af3ab6..5f92ad2cc6 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkController.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkController.kt @@ -39,7 +39,7 @@ class BookmarkController(args: Bundle) : constructor(bookId: BookId) : this( Bundle().apply { putBookId(NI_BOOK_ID, bookId) - } + }, ) private val bookId = args.getBookId(NI_BOOK_ID)!! @@ -108,7 +108,7 @@ class BookmarkController(args: Bundle) : override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + target: RecyclerView.ViewHolder, ): Boolean { return false } diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkPresenter.kt b/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkPresenter.kt index baf904f35f..d6946c533c 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkPresenter.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/BookmarkPresenter.kt @@ -20,7 +20,7 @@ class BookmarkPresenter private val repo: BookRepository, private val bookmarkRepo: BookmarkRepo, private val playStateManager: PlayStateManager, - private val playerController: PlayerController + private val playerController: PlayerController, ) : Presenter() { lateinit var bookId: BookId @@ -33,7 +33,7 @@ class BookmarkPresenter bookmarks.clear() bookmarks.addAll( bookmarkRepo.bookmarks(book.content) - .sortedByDescending { it.addedAt } + .sortedByDescending { it.addedAt }, ) chapters.clear() chapters.addAll(book.chapters) @@ -90,7 +90,7 @@ class BookmarkPresenter val addedBookmark = bookmarkRepo.addBookmarkAtBookPosition( book = book, title = name, - setBySleepTimer = false + setBySleepTimer = false, ) bookmarks.add(addedBookmark) if (attached) renderView() diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/dialogs/EditBookmarkDialog.kt b/app/src/main/kotlin/voice/app/features/bookmarks/dialogs/EditBookmarkDialog.kt index d078ad895e..8f4c22dd44 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/dialogs/EditBookmarkDialog.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/dialogs/EditBookmarkDialog.kt @@ -34,7 +34,7 @@ class EditBookmarkDialog(args: Bundle) : DialogController(args) { hintRes = R.string.bookmark_edit_hint, prefill = bookmarkTitle, allowEmpty = false, - inputType = inputType + inputType = inputType, ) { _, charSequence -> val callback = targetController as Callback val newTitle = charSequence.toString() @@ -66,7 +66,7 @@ class EditBookmarkDialog(args: Bundle) : DialogController(args) { operator fun invoke( target: T, - bookmark: Bookmark + bookmark: Bookmark, ): EditBookmarkDialog where T : Controller, T : Callback { val args = Bundle().apply { putBookmarkId(NI_BOOKMARK_ID, bookmark.id) diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookMarkHolder.kt b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookMarkHolder.kt index 3c41c43fb9..a18fe6277c 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookMarkHolder.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookMarkHolder.kt @@ -17,7 +17,7 @@ import kotlin.time.Duration.Companion.minutes class BookMarkHolder( parent: ViewGroup, - private val listener: BookmarkClickListener + private val listener: BookmarkClickListener, ) : ViewBindingHolder(parent, BookmarkRowLayoutBinding::inflate) { var boundBookmark: Bookmark? = null @@ -51,7 +51,7 @@ class BookMarkHolder( bookmark.addedAt.toEpochMilli(), justNowThreshold.inWholeMilliseconds, 2.days.inWholeMilliseconds, - 0 + 0, ) } } diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkAdapter.kt b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkAdapter.kt index cfe5d133b1..49428cfd22 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkAdapter.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkAdapter.kt @@ -10,7 +10,7 @@ import voice.data.Chapter * Adapter for displaying a list of bookmarks. */ class BookmarkAdapter( - private val listener: BookmarkClickListener + private val listener: BookmarkClickListener, ) : RecyclerView.Adapter() { private val bookmarks = ArrayList() diff --git a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkDiffUtilCallback.kt b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkDiffUtilCallback.kt index ad91909fd8..cf8b321b1a 100644 --- a/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkDiffUtilCallback.kt +++ b/app/src/main/kotlin/voice/app/features/bookmarks/list/BookmarkDiffUtilCallback.kt @@ -8,7 +8,7 @@ import voice.data.Bookmark */ class BookmarkDiffUtilCallback( private val oldItems: List, - private val newItems: List + private val newItems: List, ) : DiffUtil.Callback() { override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { diff --git a/app/src/main/kotlin/voice/app/features/imagepicker/CoverFromInternetController.kt b/app/src/main/kotlin/voice/app/features/imagepicker/CoverFromInternetController.kt index 5ff418b46f..eb41cb4b5f 100644 --- a/app/src/main/kotlin/voice/app/features/imagepicker/CoverFromInternetController.kt +++ b/app/src/main/kotlin/voice/app/features/imagepicker/CoverFromInternetController.kt @@ -32,7 +32,7 @@ class CoverFromInternetController(bundle: Bundle) : ViewBindingController diff --git a/app/src/main/kotlin/voice/app/features/widget/BaseWidgetProvider.kt b/app/src/main/kotlin/voice/app/features/widget/BaseWidgetProvider.kt index 9a3d58a1f4..02a3a9f9eb 100644 --- a/app/src/main/kotlin/voice/app/features/widget/BaseWidgetProvider.kt +++ b/app/src/main/kotlin/voice/app/features/widget/BaseWidgetProvider.kt @@ -21,7 +21,7 @@ class BaseWidgetProvider : AppWidgetProvider() { override fun onUpdate( context: Context, appWidgetManager: AppWidgetManager, - appWidgetIds: IntArray + appWidgetIds: IntArray, ) { widgetUpdater.update() } @@ -30,7 +30,7 @@ class BaseWidgetProvider : AppWidgetProvider() { context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int, - newOptions: Bundle + newOptions: Bundle, ) { widgetUpdater.update() } diff --git a/app/src/main/kotlin/voice/app/features/widget/TriggerWidgetOnChange.kt b/app/src/main/kotlin/voice/app/features/widget/TriggerWidgetOnChange.kt index 752994d052..8bdb0f0a74 100644 --- a/app/src/main/kotlin/voice/app/features/widget/TriggerWidgetOnChange.kt +++ b/app/src/main/kotlin/voice/app/features/widget/TriggerWidgetOnChange.kt @@ -23,7 +23,7 @@ class TriggerWidgetOnChange private val currentBook: DataStore, private val repo: BookRepository, private val playStateManager: PlayStateManager, - private val widgetUpdater: WidgetUpdater + private val widgetUpdater: WidgetUpdater, ) { fun init() { diff --git a/app/src/main/kotlin/voice/app/features/widget/WidgetUpdater.kt b/app/src/main/kotlin/voice/app/features/widget/WidgetUpdater.kt index 73e644b2dc..9116c4cbde 100644 --- a/app/src/main/kotlin/voice/app/features/widget/WidgetUpdater.kt +++ b/app/src/main/kotlin/voice/app/features/widget/WidgetUpdater.kt @@ -106,7 +106,7 @@ class WidgetUpdater @Inject constructor( context, System.currentTimeMillis().toInt(), wholeWidgetClickI, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) remoteViews.setImageViewResource(R.id.imageView, R.drawable.album_art) remoteViews.setOnClickPendingIntent(R.id.wholeWidget, wholeWidgetClickPI) @@ -146,7 +146,7 @@ class WidgetUpdater @Inject constructor( context, System.currentTimeMillis().toInt(), wholeWidgetClickI, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) val coverFile = book.content.cover @@ -159,7 +159,7 @@ class WidgetUpdater @Inject constructor( .fallback(R.drawable.album_art) .error(R.drawable.album_art) .allowHardware(false) - .build() + .build(), ) .drawable!!.toBitmap() remoteViews.setImageViewBitmap(R.id.imageView, bitmap) @@ -174,7 +174,7 @@ class WidgetUpdater @Inject constructor( remoteViews: RemoteViews, width: Int, height: Int, - singleChapter: Boolean + singleChapter: Boolean, ) { setHorizontalVisibility(remoteViews, width, height) setVerticalVisibility(remoteViews, height, singleChapter) @@ -211,7 +211,7 @@ class WidgetUpdater @Inject constructor( private fun setVerticalVisibility( remoteViews: RemoteViews, widgetHeight: Int, - singleChapter: Boolean + singleChapter: Boolean, ) { val buttonSize = context.dpToPxRounded(8F + 36F + 8F) val titleSize = context.resources.getDimensionPixelSize(R.dimen.list_text_primary_size) diff --git a/app/src/main/kotlin/voice/app/injection/App.kt b/app/src/main/kotlin/voice/app/injection/App.kt index 6ddfb2efdd..30df139334 100644 --- a/app/src/main/kotlin/voice/app/injection/App.kt +++ b/app/src/main/kotlin/voice/app/injection/App.kt @@ -45,7 +45,7 @@ class App : Application(), PlaybackComponentFactoryProvider { Coil.setImageLoader( ImageLoader.Builder(this) .addLastModifiedToFileCacheKey(false) - .build() + .build(), ) DynamicColors.applyToActivitiesIfAvailable(this) diff --git a/app/src/main/kotlin/voice/app/injection/AppComponent.kt b/app/src/main/kotlin/voice/app/injection/AppComponent.kt index 0023fce725..dde4ff3b4d 100644 --- a/app/src/main/kotlin/voice/app/injection/AppComponent.kt +++ b/app/src/main/kotlin/voice/app/injection/AppComponent.kt @@ -19,7 +19,7 @@ import javax.inject.Singleton @Singleton @MergeComponent( - scope = AppScope::class + scope = AppScope::class, ) interface AppComponent { diff --git a/app/src/main/kotlin/voice/app/injection/PrefsModule.kt b/app/src/main/kotlin/voice/app/injection/PrefsModule.kt index a23f50e4aa..74a897c514 100644 --- a/app/src/main/kotlin/voice/app/injection/PrefsModule.kt +++ b/app/src/main/kotlin/voice/app/injection/PrefsModule.kt @@ -110,7 +110,7 @@ object PrefsModule { return factory.create( serializer = ListSerializer(UriSerializer), fileName = "audiobookFolders", - defaultValue = emptyList() + defaultValue = emptyList(), ) } @@ -121,7 +121,7 @@ object PrefsModule { return factory.create( serializer = BookId.serializer().nullable, fileName = "currentBook", - defaultValue = null + defaultValue = null, ) } diff --git a/app/src/main/kotlin/voice/app/misc/conductor/ChangeHandlerCoordinatorLayout.kt b/app/src/main/kotlin/voice/app/misc/conductor/ChangeHandlerCoordinatorLayout.kt index b7f2d580bd..893e56f218 100644 --- a/app/src/main/kotlin/voice/app/misc/conductor/ChangeHandlerCoordinatorLayout.kt +++ b/app/src/main/kotlin/voice/app/misc/conductor/ChangeHandlerCoordinatorLayout.kt @@ -21,7 +21,7 @@ class ChangeHandlerCoordinatorLayout : constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super( context, attrs, - defStyleAttr + defStyleAttr, ) override fun onInterceptTouchEvent(ev: MotionEvent): Boolean = @@ -32,7 +32,7 @@ class ChangeHandlerCoordinatorLayout : from: Controller?, isPush: Boolean, container: ViewGroup, - handler: ControllerChangeHandler + handler: ControllerChangeHandler, ) { inProgressTransactionCount++ } @@ -42,7 +42,7 @@ class ChangeHandlerCoordinatorLayout : from: Controller?, isPush: Boolean, container: ViewGroup, - handler: ControllerChangeHandler + handler: ControllerChangeHandler, ) { inProgressTransactionCount-- } diff --git a/app/src/main/kotlin/voice/app/misc/conductor/Conductor.kt b/app/src/main/kotlin/voice/app/misc/conductor/Conductor.kt index 0fb717d99d..bbfa260fd5 100644 --- a/app/src/main/kotlin/voice/app/misc/conductor/Conductor.kt +++ b/app/src/main/kotlin/voice/app/misc/conductor/Conductor.kt @@ -9,7 +9,7 @@ import voice.app.uitools.VerticalChangeHandler // convenient way to setup a router transaction fun Controller.asTransaction( pushChangeHandler: ControllerChangeHandler? = VerticalChangeHandler(), - popChangeHandler: ControllerChangeHandler? = VerticalChangeHandler() + popChangeHandler: ControllerChangeHandler? = VerticalChangeHandler(), ) = RouterTransaction.with(this).apply { pushChangeHandler?.let { pushChangeHandler(it) } popChangeHandler?.let { popChangeHandler(it) } diff --git a/app/src/main/kotlin/voice/app/misc/groupie/BindingItem.kt b/app/src/main/kotlin/voice/app/misc/groupie/BindingItem.kt index 45feafd0bf..45e881c266 100644 --- a/app/src/main/kotlin/voice/app/misc/groupie/BindingItem.kt +++ b/app/src/main/kotlin/voice/app/misc/groupie/BindingItem.kt @@ -12,7 +12,7 @@ class BindingItem( private val data: D, @LayoutRes private val layoutId: Int, private val bindLayout: BindLayout, - private val bind: B.(D, Int) -> Unit + private val bind: B.(D, Int) -> Unit, ) : Item>() { override fun getLayout(): Int = layoutId diff --git a/app/src/main/kotlin/voice/app/mvp/MvpController.kt b/app/src/main/kotlin/voice/app/mvp/MvpController.kt index 5c494e96f3..e082ad7742 100644 --- a/app/src/main/kotlin/voice/app/mvp/MvpController.kt +++ b/app/src/main/kotlin/voice/app/mvp/MvpController.kt @@ -13,7 +13,7 @@ import voice.common.conductor.ViewBindingController */ abstract class MvpController( inflateBinding: InflateBinding, - args: Bundle = Bundle() + args: Bundle = Bundle(), ) : ViewBindingController(args, inflateBinding) where P : Presenter { private var internalPresenter: P? = null @@ -50,7 +50,7 @@ abstract class MvpController( override fun postDestroy(controller: Controller) { internalPresenter = null } - } + }, ) } diff --git a/app/src/main/kotlin/voice/app/serialization/KotlinxDataStoreSerializer.kt b/app/src/main/kotlin/voice/app/serialization/KotlinxDataStoreSerializer.kt index 4d5bd78774..07e3649d08 100644 --- a/app/src/main/kotlin/voice/app/serialization/KotlinxDataStoreSerializer.kt +++ b/app/src/main/kotlin/voice/app/serialization/KotlinxDataStoreSerializer.kt @@ -13,7 +13,7 @@ import java.io.OutputStream class KotlinxDataStoreSerializer( override val defaultValue: T, private val json: Json, - private val serializer: KSerializer + private val serializer: KSerializer, ) : Serializer { override suspend fun readFrom(input: InputStream): T = json.decodeFromStream(serializer, input) diff --git a/app/src/main/kotlin/voice/app/serialization/SerializableDataStoreFactory.kt b/app/src/main/kotlin/voice/app/serialization/SerializableDataStoreFactory.kt index 7c0c6a3de4..9d4ba38b59 100644 --- a/app/src/main/kotlin/voice/app/serialization/SerializableDataStoreFactory.kt +++ b/app/src/main/kotlin/voice/app/serialization/SerializableDataStoreFactory.kt @@ -17,14 +17,14 @@ class SerializableDataStoreFactory fun create( serializer: KSerializer, defaultValue: T, - fileName: String + fileName: String, ): DataStore { return DataStoreFactory.create( serializer = KotlinxDataStoreSerializer( defaultValue = defaultValue, json = json, - serializer = serializer - ) + serializer = serializer, + ), ) { context.dataStoreFile(fileName) } diff --git a/app/src/main/kotlin/voice/app/uitools/AnimateFloat.kt b/app/src/main/kotlin/voice/app/uitools/AnimateFloat.kt index 097fae431d..eba22ee140 100644 --- a/app/src/main/kotlin/voice/app/uitools/AnimateFloat.kt +++ b/app/src/main/kotlin/voice/app/uitools/AnimateFloat.kt @@ -5,7 +5,7 @@ import android.animation.ValueAnimator /** simplifies value animation */ fun animateFloat( vararg values: Float, - action: (value: Float, fraction: Float) -> Unit + action: (value: Float, fraction: Float) -> Unit, ): ValueAnimator { val valueAnimator = ValueAnimator() valueAnimator.setFloatValues(*values) diff --git a/app/src/main/kotlin/voice/app/uitools/CropTransformation.kt b/app/src/main/kotlin/voice/app/uitools/CropTransformation.kt index b6029db223..1a5a55b01a 100644 --- a/app/src/main/kotlin/voice/app/uitools/CropTransformation.kt +++ b/app/src/main/kotlin/voice/app/uitools/CropTransformation.kt @@ -29,6 +29,6 @@ class CropTransformation(cropOverlay: CropOverlay, private val cropSource: Image (rect.left * scaleFactor).toInt(), (rect.top * scaleFactor).toInt(), (rect.right * scaleFactor).toInt(), - (rect.bottom * scaleFactor).toInt() + (rect.bottom * scaleFactor).toInt(), ) } diff --git a/app/src/main/kotlin/voice/app/uitools/VerticalChangeHandler.kt b/app/src/main/kotlin/voice/app/uitools/VerticalChangeHandler.kt index 8c0ba7aa9a..4a7177365a 100644 --- a/app/src/main/kotlin/voice/app/uitools/VerticalChangeHandler.kt +++ b/app/src/main/kotlin/voice/app/uitools/VerticalChangeHandler.kt @@ -19,7 +19,7 @@ class VerticalChangeHandler : AnimatorChangeHandler() { from: View?, to: View?, isPush: Boolean, - toAddedToContainer: Boolean + toAddedToContainer: Boolean, ): Animator { return if (isPush && to != null) { animateFloat(to.height / 2F, 0F) { value, fraction -> diff --git a/app/src/main/kotlin/voice/app/uitools/ViewBindingHolder.kt b/app/src/main/kotlin/voice/app/uitools/ViewBindingHolder.kt index 43b2c77c31..cf876786e1 100644 --- a/app/src/main/kotlin/voice/app/uitools/ViewBindingHolder.kt +++ b/app/src/main/kotlin/voice/app/uitools/ViewBindingHolder.kt @@ -9,6 +9,6 @@ import voice.common.conductor.InflateBinding abstract class ViewBindingHolder(val binding: B) : RecyclerView.ViewHolder(binding.root) { constructor(parent: ViewGroup, inflateBinding: InflateBinding) : this( - inflateBinding(LayoutInflater.from(parent.context), parent, false) + inflateBinding(LayoutInflater.from(parent.context), parent, false), ) } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/GridCount.kt b/bookOverview/src/main/kotlin/voice/bookOverview/GridCount.kt index 8dda693d6a..dcb50a7821 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/GridCount.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/GridCount.kt @@ -5,7 +5,7 @@ import javax.inject.Inject class GridCount @Inject constructor( - private val context: Context + private val context: Context, ) { fun useGridAsDefault(): Boolean { diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetContent.kt b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetContent.kt index 37bd973056..9a86dbf541 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetContent.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetContent.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.unit.dp @Composable internal fun BottomSheetContent( state: EditBookBottomSheetState, - onItemClicked: (BottomSheetItem) -> Unit + onItemClicked: (BottomSheetItem) -> Unit, ) { Column(Modifier.padding(vertical = 8.dp)) { state.items.forEach { item -> @@ -31,12 +31,12 @@ internal fun BottomSheetContent( } .padding(horizontal = 16.dp) .fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Icon( imageVector = item.icon, contentDescription = stringResource(item.titleRes), - modifier = Modifier.size(24.dp) + modifier = Modifier.size(24.dp), ) Spacer(modifier = Modifier.size(32.dp)) Text(text = stringResource(item.titleRes)) diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetViewModel.kt index 53aabdcf75..5da211230b 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/BottomSheetViewModel.kt @@ -12,7 +12,7 @@ import javax.inject.Inject @BookOverviewScope class BottomSheetViewModel @Inject constructor( - private val viewModels: Set<@JvmSuppressWildcards BottomSheetItemViewModel> + private val viewModels: Set<@JvmSuppressWildcards BottomSheetItemViewModel>, ) { private val scope = MainScope() diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/EditBookBottomSheetState.kt b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/EditBookBottomSheetState.kt index b3f640abb8..e4266eaf56 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/EditBookBottomSheetState.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/bottomSheet/EditBookBottomSheetState.kt @@ -13,12 +13,12 @@ import androidx.compose.ui.graphics.vector.ImageVector import voice.bookOverview.R internal data class EditBookBottomSheetState( - val items: List + val items: List, ) enum class BottomSheetItem( @StringRes val titleRes: Int, - val icon: ImageVector + val icon: ImageVector, ) { Title(R.string.change_book_name, Icons.Outlined.Title), InternetCover(R.string.download_book_cover, Icons.Outlined.Download), diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookDialog.kt b/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookDialog.kt index 1dd240f8ce..ad80b3eda8 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookDialog.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookDialog.kt @@ -24,7 +24,7 @@ internal fun DeleteBookDialog( viewState: DeleteBookViewState, onDismiss: () -> Unit, onConfirmDeletion: () -> Unit, - onDeleteCheckBoxChecked: (Boolean) -> Unit + onDeleteCheckBoxChecked: (Boolean) -> Unit, ) { AlertDialog( onDismissRequest = onDismiss, @@ -37,7 +37,7 @@ internal fun DeleteBookDialog( enabled = viewState.deleteCheckBoxChecked, colors = ButtonDefaults.buttonColors( containerColor = MaterialTheme.colorScheme.errorContainer, - contentColor = MaterialTheme.colorScheme.error + contentColor = MaterialTheme.colorScheme.error, ), ) { Text(stringResource(id = R.string.delete)) @@ -60,15 +60,15 @@ internal fun DeleteBookDialog( .fillMaxWidth() .clickable { onDeleteCheckBoxChecked(!viewState.deleteCheckBoxChecked) - } + }, ) { Checkbox( checked = viewState.deleteCheckBoxChecked, - onCheckedChange = onDeleteCheckBoxChecked + onCheckedChange = onDeleteCheckBoxChecked, ) Text(stringResource(id = R.string.delete_book_dialog_deletion_confirmation)) } } - } + }, ) } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookViewModel.kt index 812c67c36f..1b6393f797 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/deleteBook/DeleteBookViewModel.kt @@ -17,7 +17,7 @@ import javax.inject.Inject @BookOverviewScope @ContributesMultibinding( scope = BookOverviewScope::class, - boundType = BottomSheetItemViewModel::class + boundType = BottomSheetItemViewModel::class, ) class DeleteBookViewModel @Inject diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/editBookCategory/EditBookCategoryViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/editBookCategory/EditBookCategoryViewModel.kt index 50d03595c2..7dbe8a232f 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/editBookCategory/EditBookCategoryViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/editBookCategory/EditBookCategoryViewModel.kt @@ -14,7 +14,7 @@ import javax.inject.Inject @BookOverviewScope @ContributesMultibinding( scope = BookOverviewScope::class, - boundType = BottomSheetItemViewModel::class + boundType = BottomSheetItemViewModel::class, ) class EditBookCategoryViewModel @Inject @@ -27,15 +27,15 @@ constructor( return when (book.category) { BookOverviewCategory.CURRENT -> listOf( BottomSheetItem.BookCategoryMarkAsNotStarted, - BottomSheetItem.BookCategoryMarkAsCompleted + BottomSheetItem.BookCategoryMarkAsCompleted, ) BookOverviewCategory.NOT_STARTED -> listOf( BottomSheetItem.BookCategoryMarkAsCurrent, - BottomSheetItem.BookCategoryMarkAsCompleted + BottomSheetItem.BookCategoryMarkAsCompleted, ) BookOverviewCategory.FINISHED -> listOf( BottomSheetItem.BookCategoryMarkAsCurrent, - BottomSheetItem.BookCategoryMarkAsNotStarted + BottomSheetItem.BookCategoryMarkAsNotStarted, ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleDialog.kt b/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleDialog.kt index c972636282..5382acd3d7 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleDialog.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleDialog.kt @@ -14,7 +14,7 @@ internal fun EditBookTitleDialog( onDismissEditTitleClick: () -> Unit, onConfirmEditTitle: () -> Unit, viewState: EditBookTitleState, - onUpdateEditTitle: (String) -> Unit + onUpdateEditTitle: (String) -> Unit, ) { AlertDialog( onDismissRequest = onDismissEditTitleClick, @@ -24,7 +24,7 @@ internal fun EditBookTitleDialog( confirmButton = { Button( onClick = onConfirmEditTitle, - enabled = viewState.confirmButtonEnabled + enabled = viewState.confirmButtonEnabled, ) { Text(stringResource(id = R.string.dialog_confirm)) } @@ -40,8 +40,8 @@ internal fun EditBookTitleDialog( onValueChange = onUpdateEditTitle, label = { Text(stringResource(R.string.change_book_name)) - } + }, ) - } + }, ) } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleViewModel.kt index 0f8979f1ac..6d24ae0631 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/editTitle/EditBookTitleViewModel.kt @@ -15,7 +15,7 @@ import javax.inject.Inject @BookOverviewScope @ContributesMultibinding( scope = BookOverviewScope::class, - boundType = BottomSheetItemViewModel::class + boundType = BottomSheetItemViewModel::class, ) class EditBookTitleViewModel @Inject diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/fileCover/FileCoverViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/fileCover/FileCoverViewModel.kt index a2c75d83e9..6f1be30eef 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/fileCover/FileCoverViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/fileCover/FileCoverViewModel.kt @@ -15,7 +15,7 @@ import javax.inject.Inject class FileCoverViewModel @Inject constructor( - private val navigator: Navigator + private val navigator: Navigator, ) : BottomSheetItemViewModel { private var bookId: BookId? = null diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/internetCover/InternetCoverViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/internetCover/InternetCoverViewModel.kt index 5234cc6f7e..83144727e8 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/internetCover/InternetCoverViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/internetCover/InternetCoverViewModel.kt @@ -14,7 +14,7 @@ import javax.inject.Inject class InternetCoverViewModel @Inject constructor( - private val navigator: Navigator + private val navigator: Navigator, ) : BottomSheetItemViewModel { override suspend fun items(bookId: BookId): List { diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewCategory.kt b/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewCategory.kt index 5ccfda5330..1404d3c286 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewCategory.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewCategory.kt @@ -8,19 +8,19 @@ import java.util.concurrent.TimeUnit.SECONDS enum class BookOverviewCategory( @StringRes val nameRes: Int, - val comparator: Comparator + val comparator: Comparator, ) { CURRENT( nameRes = R.string.book_header_current, - comparator = BookComparator.ByLastPlayed + comparator = BookComparator.ByLastPlayed, ), NOT_STARTED( nameRes = R.string.book_header_not_started, - comparator = BookComparator.ByLastPlayed.then(BookComparator.ByDateAdded).then(BookComparator.ByName) + comparator = BookComparator.ByLastPlayed.then(BookComparator.ByDateAdded).then(BookComparator.ByName), ), FINISHED( nameRes = R.string.book_header_completed, - comparator = BookComparator.ByLastPlayed + comparator = BookComparator.ByLastPlayed, ); } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewViewModel.kt b/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewViewModel.kt index 2b645965fa..0ecbe98e49 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewViewModel.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/overview/BookOverviewViewModel.kt @@ -113,7 +113,7 @@ constructor( cover = book.content.cover?.let(::ImmutableFile), id = book.id, progress = book.progress(), - remainingTime = DateUtils.formatElapsedTime((book.duration - book.position) / 1000) + remainingTime = DateUtils.formatElapsedTime((book.duration - book.position) / 1000), ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/AddBookHint.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/AddBookHint.kt index 49e702a727..b3c3263c84 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/AddBookHint.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/AddBookHint.kt @@ -13,7 +13,7 @@ internal fun AddBookHint() { ExplanationTooltip { Text( modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), - text = stringResource(R.string.voice_intro_first_book) + text = stringResource(R.string.voice_intro_first_book), ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/BookFolderIcon.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/BookFolderIcon.kt index 50da8a944b..0e2505fac0 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/BookFolderIcon.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/BookFolderIcon.kt @@ -16,7 +16,7 @@ internal fun BookFolderIcon(modifier: Modifier = Modifier, withHint: Boolean, on IconButton(modifier = modifier, onClick = onClick) { Icon( imageVector = Icons.Outlined.Book, - contentDescription = stringResource(R.string.audiobook_folders_title) + contentDescription = stringResource(R.string.audiobook_folders_title), ) } if (withHint) { diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/BookOverview.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/BookOverview.kt index 8f9430475f..5a1f918a93 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/BookOverview.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/BookOverview.kt @@ -71,7 +71,7 @@ fun BookOverviewScreen() { if (uri != null) { fileCoverViewModel.onImagePicked(uri) } - } + }, ) val bottomSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden) @@ -90,7 +90,7 @@ fun BookOverviewScreen() { } } } - } + }, ) { BookOverview( viewState = viewState, @@ -117,7 +117,7 @@ fun BookOverviewScreen() { viewState = deleteBookViewState, onDismiss = deleteBookViewModel::onDismiss, onConfirmDeletion = deleteBookViewModel::onConfirmDeletion, - onDeleteCheckBoxChecked = deleteBookViewModel::onDeleteCheckBoxChecked + onDeleteCheckBoxChecked = deleteBookViewModel::onDeleteCheckBoxChecked, ) } val editBookTitleState = editBookTitleViewModel.state.value @@ -126,7 +126,7 @@ fun BookOverviewScreen() { onDismissEditTitleClick = editBookTitleViewModel::onDismissEditTitle, onConfirmEditTitle = editBookTitleViewModel::onConfirmEditTitle, viewState = editBookTitleState, - onUpdateEditTitle = editBookTitleViewModel::onUpdateEditTitle + onUpdateEditTitle = editBookTitleViewModel::onUpdateEditTitle, ) } } @@ -155,7 +155,7 @@ internal fun BookOverview( MigrateIcon( onClick = onBookMigrationClick, withHint = viewState.showMigrateHint, - onHintClick = onBoomMigrationHelperConfirmClick + onHintClick = onBoomMigrationHelperConfirmClick, ) } BookFolderIcon(withHint = viewState.showAddBookHint, onClick = onBookFolderClick) @@ -165,17 +165,17 @@ internal fun BookOverview( LayoutIcon(layoutIcon, onLayoutIconClick) } SettingsIcon(onSettingsClick) - } + }, ) }, floatingActionButton = { if (viewState.playButtonState != null) { PlayButton( playing = viewState.playButtonState == BookOverviewViewState.PlayButtonState.Playing, - onClick = onPlayButtonClick + onClick = onPlayButtonClick, ) } - } + }, ) { contentPadding -> when (viewState) { is BookOverviewViewState.Content -> { @@ -202,7 +202,7 @@ internal fun BookOverview( Box( Modifier .fillMaxSize() - .padding(contentPadding) + .padding(contentPadding), ) { CircularProgressIndicator(Modifier.align(Alignment.Center)) } @@ -215,7 +215,7 @@ internal fun BookOverview( @Composable private fun BookOverviewPreview( @PreviewParameter(BookOverviewPreviewParameterProvider::class) - viewState: BookOverviewViewState + viewState: BookOverviewViewState, ) { VoiceTheme { BookOverview( @@ -240,7 +240,7 @@ internal class BookOverviewPreviewParameterProvider : PreviewParameterProvider Unit) { Card( modifier = Modifier.widthIn(max = 240.dp), elevation = CardDefaults.cardElevation(defaultElevation = 4.dp), - shape = explanationTooltipShape(triangleCenterX, LocalDensity.current) + shape = explanationTooltipShape(triangleCenterX, LocalDensity.current), ) { content() } @@ -50,7 +50,7 @@ private class ExplanationTooltipPopupPositionProvider( anchorBounds: IntRect, windowSize: IntSize, layoutDirection: LayoutDirection, - popupContentSize: IntSize + popupContentSize: IntSize, ): IntOffset { val rightMargin = with(density) { 16.dp.toPx() } var offset = IntOffset(anchorBounds.center.x - popupContentSize.width / 2, anchorBounds.bottom) @@ -71,21 +71,21 @@ private fun explanationTooltipShape(triangleCenterX: Float?, density: Density): return GenericShape { size, layoutDirection -> addOutline( RoundedCornerShape(12.0.dp) - .createOutline(size, layoutDirection, density) + .createOutline(size, layoutDirection, density), ) if (triangleCenterX != null) { val trianglePath = Path().apply { moveTo( x = triangleCenterX - triangleSize / 2F, - y = 0F + y = 0F, ) lineTo( x = triangleCenterX, - y = -triangleSize / 2F + y = -triangleSize / 2F, ) lineTo( x = triangleCenterX + triangleSize / 2F, - y = 0F + y = 0F, ) close() } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/GridBooks.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/GridBooks.kt index 76e3c56c9c..0c8697996f 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/GridBooks.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/GridBooks.kt @@ -36,7 +36,7 @@ internal fun GridBooks( books: Map>, contentPadding: PaddingValues, onBookClick: (BookId) -> Unit, - onBookLongClick: (BookId) -> Unit + onBookLongClick: (BookId) -> Unit, ) { val cellCount = gridColumnCount() LazyVerticalGrid( @@ -50,22 +50,22 @@ internal fun GridBooks( item( span = { GridItemSpan(maxLineSpan) }, key = category, - contentType = "header" + contentType = "header", ) { Header( modifier = Modifier.padding(top = 8.dp, bottom = 4.dp, start = 8.dp, end = 8.dp), - category = category + category = category, ) } items( items = books, key = { it.id }, - contentType = { "item" } + contentType = { "item" }, ) { book -> GridBook( book = book, onBookClick = onBookClick, - onBookLongClick = onBookLongClick + onBookLongClick = onBookLongClick, ) } } @@ -85,7 +85,7 @@ private fun GridBook( onLongClick = { onBookLongClick(book.id) }, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) { Column { AsyncImage( @@ -97,7 +97,7 @@ private fun GridBook( model = book.cover?.file, placeholder = painterResource(id = R.drawable.album_art), error = painterResource(id = R.drawable.album_art), - contentDescription = null + contentDescription = null, ) Text( modifier = Modifier.padding(start = 8.dp, end = 8.dp, top = 8.dp), @@ -114,7 +114,7 @@ private fun GridBook( if (book.progress > 0F) { LinearProgressIndicator( modifier = Modifier.fillMaxWidth(), - progress = book.progress + progress = book.progress, ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/Header.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/Header.kt index 9dfb6a76a4..8e37f33b88 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/Header.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/Header.kt @@ -10,11 +10,11 @@ import voice.bookOverview.overview.BookOverviewCategory @Composable internal fun Header( modifier: Modifier = Modifier, - category: BookOverviewCategory + category: BookOverviewCategory, ) { Text( modifier = modifier, text = stringResource(id = category.nameRes), - style = MaterialTheme.typography.headlineSmall + style = MaterialTheme.typography.headlineSmall, ) } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/LayoutIcon.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/LayoutIcon.kt index 932bb8dcb8..3d8ff09327 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/LayoutIcon.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/LayoutIcon.kt @@ -22,8 +22,8 @@ internal fun LayoutIcon(layoutIcon: BookOverviewViewState.Content.LayoutIcon, on when (layoutIcon) { BookOverviewViewState.Content.LayoutIcon.List -> R.string.layout_list BookOverviewViewState.Content.LayoutIcon.Grid -> R.string.layout_grid - } - ) + }, + ), ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/ListBooks.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/ListBooks.kt index cac119f482..9b6cc4f6b3 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/ListBooks.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/ListBooks.kt @@ -41,26 +41,26 @@ internal fun ListBooks( ) { LazyColumn( verticalArrangement = Arrangement.spacedBy(8.dp), - contentPadding = contentPadding + PaddingValues(top = 24.dp, start = 8.dp, end = 8.dp, bottom = 16.dp) + contentPadding = contentPadding + PaddingValues(top = 24.dp, start = 8.dp, end = 8.dp, bottom = 16.dp), ) { books.forEach { (category, books) -> if (books.isEmpty()) return@forEach stickyHeader( key = category, - contentType = "header" + contentType = "header", ) { Header( modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.surface) .padding(vertical = 8.dp, horizontal = 8.dp), - category = category + category = category, ) } items( items = books, key = { it.id.value }, - contentType = { "item" } + contentType = { "item" }, ) { book -> ListBookRow( book = book, @@ -88,7 +88,7 @@ private fun ListBookRow( }, modifier = modifier .recomposeHighlighter() - .fillMaxWidth() + .fillMaxWidth(), ) { Column { Row { @@ -96,22 +96,22 @@ private fun ListBookRow( Column( Modifier .padding(start = 8.dp, end = 8.dp, top = 8.dp, bottom = 8.dp) - .align(Alignment.CenterVertically) + .align(Alignment.CenterVertically), ) { if (book.author != null) { Text( text = book.author.toUpperCase(LocaleList.current), style = MaterialTheme.typography.labelSmall, - maxLines = 1 + maxLines = 1, ) } Text( text = book.name, - style = MaterialTheme.typography.bodyMedium + style = MaterialTheme.typography.bodyMedium, ) Text( text = book.remainingTime, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } } @@ -119,7 +119,7 @@ private fun ListBookRow( if (book.progress > 0.05) { LinearProgressIndicator( modifier = Modifier.fillMaxWidth(), - progress = book.progress + progress = book.progress, ) } } @@ -137,6 +137,6 @@ private fun CoverImage(cover: ImmutableFile?) { model = cover?.file, placeholder = painterResource(id = R.drawable.album_art), error = painterResource(id = R.drawable.album_art), - contentDescription = null + contentDescription = null, ) } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/MigrateIcon.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/MigrateIcon.kt index 45e26cb404..55f84e4eaf 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/MigrateIcon.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/MigrateIcon.kt @@ -15,13 +15,13 @@ internal fun MigrateIcon( modifier: Modifier = Modifier, withHint: Boolean, onClick: () -> Unit, - onHintClick: () -> Unit + onHintClick: () -> Unit, ) { Box { IconButton(modifier = modifier, onClick = onClick) { Icon( imageVector = Icons.Outlined.CompareArrows, - contentDescription = stringResource(R.string.migration_hint_title) + contentDescription = stringResource(R.string.migration_hint_title), ) } if (withHint) { diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/PlayButton.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/PlayButton.kt index c57b74354b..ea051affb5 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/PlayButton.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/PlayButton.kt @@ -15,11 +15,11 @@ internal fun PlayButton(playing: Boolean, onClick: () -> Unit) { Icon( painter = rememberAnimatedVectorPainter( animatedImageVector = AnimatedImageVector.animatedVectorResource( - id = R.drawable.avd_pause_to_play + id = R.drawable.avd_pause_to_play, ), - atEnd = !playing + atEnd = !playing, ), - contentDescription = stringResource(R.string.play_pause) + contentDescription = stringResource(R.string.play_pause), ) } } diff --git a/bookOverview/src/main/kotlin/voice/bookOverview/views/SettingsIcon.kt b/bookOverview/src/main/kotlin/voice/bookOverview/views/SettingsIcon.kt index ac86e67bd4..090f7a7cf7 100644 --- a/bookOverview/src/main/kotlin/voice/bookOverview/views/SettingsIcon.kt +++ b/bookOverview/src/main/kotlin/voice/bookOverview/views/SettingsIcon.kt @@ -13,7 +13,7 @@ internal fun SettingsIcon(onSettingsClick: () -> Unit) { IconButton(onSettingsClick) { Icon( imageVector = Icons.Outlined.Settings, - contentDescription = stringResource(R.string.action_settings) + contentDescription = stringResource(R.string.action_settings), ) } } diff --git a/bookOverview/src/test/kotlin/voice/bookOverview/BookFactory.kt b/bookOverview/src/test/kotlin/voice/bookOverview/BookFactory.kt index 21ec170f2e..3a26ab910b 100644 --- a/bookOverview/src/test/kotlin/voice/bookOverview/BookFactory.kt +++ b/bookOverview/src/test/kotlin/voice/bookOverview/BookFactory.kt @@ -10,7 +10,7 @@ import java.util.UUID fun book( chapters: List = listOf(chapter(), chapter()), time: Long = 42, - currentChapter: Chapter.Id = chapters.first().id + currentChapter: Chapter.Id = chapters.first().id, ): Book { return Book( content = BookContent( @@ -25,7 +25,7 @@ fun book( isActive = true, lastPlayedAt = Instant.EPOCH, skipSilence = false, - id = BookId(UUID.randomUUID().toString()) + id = BookId(UUID.randomUUID().toString()), ), chapters = chapters, ) @@ -33,13 +33,13 @@ fun book( fun chapter( duration: Long = 10000, - id: Chapter.Id = Chapter.Id(UUID.randomUUID().toString()) + id: Chapter.Id = Chapter.Id(UUID.randomUUID().toString()), ): Chapter { return Chapter( id = id, name = UUID.randomUUID().toString(), duration = duration, fileLastModified = Instant.EPOCH, - markData = emptyList() + markData = emptyList(), ) } diff --git a/bookOverview/src/test/kotlin/voice/bookOverview/BookOverviewCategoryTest.kt b/bookOverview/src/test/kotlin/voice/bookOverview/BookOverviewCategoryTest.kt index 5c3b148af2..e41fcff809 100644 --- a/bookOverview/src/test/kotlin/voice/bookOverview/BookOverviewCategoryTest.kt +++ b/bookOverview/src/test/kotlin/voice/bookOverview/BookOverviewCategoryTest.kt @@ -14,8 +14,8 @@ class BookOverviewCategoryTest { book.copy( content = book.content.copy( currentChapter = lastChapter.id, - positionInChapter = lastChapter.duration - ) + positionInChapter = lastChapter.duration, + ), ) } book.category shouldBe BookOverviewCategory.FINISHED @@ -28,8 +28,8 @@ class BookOverviewCategoryTest { book.copy( content = book.content.copy( currentChapter = firstChapter.id, - positionInChapter = 0 - ) + positionInChapter = 0, + ), ) } book.category shouldBe BookOverviewCategory.NOT_STARTED @@ -41,8 +41,8 @@ class BookOverviewCategoryTest { book.copy( content = book.content.copy( currentChapter = book.chapters.last().id, - positionInChapter = 0 - ) + positionInChapter = 0, + ), ) } book.category shouldBe BookOverviewCategory.CURRENT diff --git a/common/src/main/kotlin/voice/common/Combine.kt b/common/src/main/kotlin/voice/common/Combine.kt index f15bbae32c..7db5d0fe85 100644 --- a/common/src/main/kotlin/voice/common/Combine.kt +++ b/common/src/main/kotlin/voice/common/Combine.kt @@ -11,7 +11,7 @@ fun combine( flow5: Flow, flow6: Flow, flow7: Flow, - transform: suspend (T1, T2, T3, T4, T5, T6, T7) -> R + transform: suspend (T1, T2, T3, T4, T5, T6, T7) -> R, ): Flow { return combine(flow, flow2, flow3, flow4, flow5, flow6, flow7) { args -> @Suppress("UNCHECKED_CAST") diff --git a/common/src/main/kotlin/voice/common/DispatcherProvider.kt b/common/src/main/kotlin/voice/common/DispatcherProvider.kt index 2dc74ca48d..201e992aed 100644 --- a/common/src/main/kotlin/voice/common/DispatcherProvider.kt +++ b/common/src/main/kotlin/voice/common/DispatcherProvider.kt @@ -3,5 +3,5 @@ package voice.common import kotlin.coroutines.CoroutineContext data class DispatcherProvider( - val main: CoroutineContext + val main: CoroutineContext, ) diff --git a/common/src/main/kotlin/voice/common/RecomposeHighlighter.kt b/common/src/main/kotlin/voice/common/RecomposeHighlighter.kt index a03094300b..f16dfcf60b 100644 --- a/common/src/main/kotlin/voice/common/RecomposeHighlighter.kt +++ b/common/src/main/kotlin/voice/common/RecomposeHighlighter.kt @@ -84,7 +84,7 @@ private val recomposeModifier = lerp( Color.Yellow.copy(alpha = 0.8f), Color.Red.copy(alpha = 0.5f), - min(1f, (numCompositionsSinceTimeout - 1).toFloat() / 100f) + min(1f, (numCompositionsSinceTimeout - 1).toFloat() / 100f), ) to numCompositionsSinceTimeout.toInt().dp.toPx() } } @@ -102,7 +102,7 @@ private val recomposeModifier = brush = SolidColor(color), topLeft = rectTopLeft, size = size, - style = style + style = style, ) } } diff --git a/common/src/main/kotlin/voice/common/compose/LongClickableCard.kt b/common/src/main/kotlin/voice/common/compose/LongClickableCard.kt index 23ac0ca459..bbcfa1c799 100644 --- a/common/src/main/kotlin/voice/common/compose/LongClickableCard.kt +++ b/common/src/main/kotlin/voice/common/compose/LongClickableCard.kt @@ -16,7 +16,7 @@ fun LongClickableCard( onClick: () -> Unit, onLongClick: () -> Unit, modifier: Modifier = Modifier, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { Card(modifier = modifier) { Box( @@ -29,7 +29,7 @@ fun LongClickableCard( role = Role.Button, onClick = onClick, onLongClick = onLongClick, - ) + ), ) { content() } diff --git a/common/src/main/kotlin/voice/common/compose/ViewModel.kt b/common/src/main/kotlin/voice/common/compose/ViewModel.kt index 2875541d12..2338f4b644 100644 --- a/common/src/main/kotlin/voice/common/compose/ViewModel.kt +++ b/common/src/main/kotlin/voice/common/compose/ViewModel.kt @@ -9,7 +9,7 @@ internal class HoldingViewModel(val value: T) : ViewModel() @Composable inline fun rememberScoped( - crossinline create: () -> T + crossinline create: () -> T, ): T { return viewModel(key = T::class.qualifiedName) { HoldingViewModel(create()) diff --git a/common/src/main/kotlin/voice/common/compose/VoiceTheme.kt b/common/src/main/kotlin/voice/common/compose/VoiceTheme.kt index d7485047ba..a3d0ff1372 100644 --- a/common/src/main/kotlin/voice/common/compose/VoiceTheme.kt +++ b/common/src/main/kotlin/voice/common/compose/VoiceTheme.kt @@ -20,7 +20,7 @@ import androidx.compose.material3.MaterialTheme as Material3Theme @Composable fun VoiceTheme( - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { Material3Theme( colorScheme = if (isDarkTheme()) { @@ -35,14 +35,14 @@ fun VoiceTheme( } else { lightColorScheme() } - } + }, ) { MaterialTheme( colors = if (isDarkTheme()) { darkColors() } else { lightColors() - } + }, ) { content() } diff --git a/common/src/main/kotlin/voice/common/conductor/ClearAfterDestroyView.kt b/common/src/main/kotlin/voice/common/conductor/ClearAfterDestroyView.kt index 25a2066613..8dc941fe64 100644 --- a/common/src/main/kotlin/voice/common/conductor/ClearAfterDestroyView.kt +++ b/common/src/main/kotlin/voice/common/conductor/ClearAfterDestroyView.kt @@ -22,7 +22,7 @@ class ClearAfterDestroyView(controller: Controller) : ReadWriteProperty override fun postDestroy(controller: Controller) { value = null } - } + }, ) } @@ -31,7 +31,7 @@ class ClearAfterDestroyView(controller: Controller) : ReadWriteProperty override fun getValue(thisRef: Controller, property: KProperty<*>): T { return value ?: throw UninitializedPropertyAccessException( - "Property ${property.name} is not initialized." + "Property ${property.name} is not initialized.", ) } @@ -42,5 +42,5 @@ class ClearAfterDestroyView(controller: Controller) : ReadWriteProperty fun Controller.clearAfterDestroyView(): ReadWriteProperty = ClearAfterDestroyView( - this + this, ) diff --git a/common/src/main/kotlin/voice/common/conductor/ControllerLifecycleOwner.kt b/common/src/main/kotlin/voice/common/conductor/ControllerLifecycleOwner.kt index 3479e8d2b9..86688b46b5 100644 --- a/common/src/main/kotlin/voice/common/conductor/ControllerLifecycleOwner.kt +++ b/common/src/main/kotlin/voice/common/conductor/ControllerLifecycleOwner.kt @@ -16,30 +16,32 @@ class ControllerLifecycleOwner(lifecycleController: T) : LifecycleOwner where override fun getLifecycle(): Lifecycle = lifecycleRegistry init { - lifecycleController.addLifecycleListener(object : LifecycleListener() { - override fun postContextAvailable(controller: Controller, context: Context) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_CREATE) - } - - override fun preCreateView(controller: Controller) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_START) - } - - override fun preAttach(controller: Controller, view: View) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_RESUME) - } - - override fun preDetach(controller: Controller, view: View) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_PAUSE) - } - - override fun preDestroyView(controller: Controller, view: View) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_STOP) - } - - override fun preDestroy(controller: Controller) { - lifecycleRegistry.handleLifecycleEvent(Event.ON_DESTROY) - } - }) + lifecycleController.addLifecycleListener( + object : LifecycleListener() { + override fun postContextAvailable(controller: Controller, context: Context) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_CREATE) + } + + override fun preCreateView(controller: Controller) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_START) + } + + override fun preAttach(controller: Controller, view: View) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_RESUME) + } + + override fun preDetach(controller: Controller, view: View) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_PAUSE) + } + + override fun preDestroyView(controller: Controller, view: View) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_STOP) + } + + override fun preDestroy(controller: Controller) { + lifecycleRegistry.handleLifecycleEvent(Event.ON_DESTROY) + } + }, + ) } } diff --git a/common/src/main/kotlin/voice/common/conductor/DialogController.kt b/common/src/main/kotlin/voice/common/conductor/DialogController.kt index a1d15cc365..6aba3f647f 100644 --- a/common/src/main/kotlin/voice/common/conductor/DialogController.kt +++ b/common/src/main/kotlin/voice/common/conductor/DialogController.kt @@ -33,7 +33,7 @@ abstract class DialogController(args: Bundle = Bundle()) : Controller(args), Lif final override fun onCreateView( inflater: LayoutInflater, container: ViewGroup, - savedViewState: Bundle? + savedViewState: Bundle?, ): View { dialog = onCreateDialog(savedViewState).apply { setOwnerActivity(activity!!) @@ -80,7 +80,7 @@ abstract class DialogController(args: Bundle = Bundle()) : Controller(args), Lif dismissed = false router.pushController( RouterTransaction.with(this) - .pushChangeHandler(SimpleSwapChangeHandler(false)) + .pushChangeHandler(SimpleSwapChangeHandler(false)), ) } diff --git a/common/src/main/kotlin/voice/common/conductor/LifecycleScopeProperty.kt b/common/src/main/kotlin/voice/common/conductor/LifecycleScopeProperty.kt index 55ea07a4ea..e57beda3d1 100644 --- a/common/src/main/kotlin/voice/common/conductor/LifecycleScopeProperty.kt +++ b/common/src/main/kotlin/voice/common/conductor/LifecycleScopeProperty.kt @@ -36,12 +36,13 @@ class LifecycleScopeProperty(private val lifecycle: Lifecycle) : ReadOnlyPropert ON_STOP -> cancelScope(STARTED) ON_DESTROY -> cancelScope(CREATED) Lifecycle.Event.ON_CREATE, - Lifecycle.Event.ON_ANY -> { + Lifecycle.Event.ON_ANY, + -> { // no-op } } } - } + }, ) } diff --git a/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt b/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt index 3e2bdaa493..bd4d78badd 100644 --- a/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt +++ b/common/src/main/kotlin/voice/common/conductor/ViewBindingController.kt @@ -10,7 +10,7 @@ typealias InflateBinding = (LayoutInflater, ViewGroup?, Boolean) -> B abstract class ViewBindingController( args: Bundle = Bundle(), - private val inflateBinding: InflateBinding + private val inflateBinding: InflateBinding, ) : BaseController(args) { private var _binding: B? = null @@ -19,7 +19,7 @@ abstract class ViewBindingController( final override fun onCreateView( inflater: LayoutInflater, container: ViewGroup, - savedViewState: Bundle? + savedViewState: Bundle?, ): View { return inflateBinding(inflater, container, false) .also { diff --git a/common/src/test/kotlin/voice/common/comparator/NaturalOrderComparatorTest.kt b/common/src/test/kotlin/voice/common/comparator/NaturalOrderComparatorTest.kt index 42e4f1aace..cd12560411 100644 --- a/common/src/test/kotlin/voice/common/comparator/NaturalOrderComparatorTest.kt +++ b/common/src/test/kotlin/voice/common/comparator/NaturalOrderComparatorTest.kt @@ -39,7 +39,7 @@ class NaturalOrderComparatorTest { testFolder.newFile("storage/emulated/0/2.ogg"), testFolder.newFile("xFolder/d.jpg"), testFolder.newFile("1.mp3"), - testFolder.newFile("a.jpg") + testFolder.newFile("a.jpg"), ) } diff --git a/data/src/main/kotlin/voice/data/BookComparator.kt b/data/src/main/kotlin/voice/data/BookComparator.kt index 7ec194466c..0d4d1cacfc 100644 --- a/data/src/main/kotlin/voice/data/BookComparator.kt +++ b/data/src/main/kotlin/voice/data/BookComparator.kt @@ -3,18 +3,18 @@ package voice.data import voice.common.comparator.NaturalOrderComparator enum class BookComparator( - private val comparatorFunction: Comparator + private val comparatorFunction: Comparator, ) : Comparator by comparatorFunction { ByLastPlayed( compareByDescending { it.content.lastPlayedAt - } + }, ), ByName( Comparator { left, right -> NaturalOrderComparator.stringComparator.compare(left.content.name, right.content.name) - } + }, ), ByDateAdded(compareByDescending { it.content.addedAt }) } diff --git a/data/src/main/kotlin/voice/data/Bookmark.kt b/data/src/main/kotlin/voice/data/Bookmark.kt index 986d01bb42..1155e3c932 100644 --- a/data/src/main/kotlin/voice/data/Bookmark.kt +++ b/data/src/main/kotlin/voice/data/Bookmark.kt @@ -16,7 +16,7 @@ data class Bookmark( val addedAt: Instant, val setBySleepTimer: Boolean, @PrimaryKey - val id: Id + val id: Id, ) { data class Id(val value: UUID) { diff --git a/data/src/main/kotlin/voice/data/ChapterMark.kt b/data/src/main/kotlin/voice/data/ChapterMark.kt index ea4355f655..50b4e62b96 100644 --- a/data/src/main/kotlin/voice/data/ChapterMark.kt +++ b/data/src/main/kotlin/voice/data/ChapterMark.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable @Serializable data class MarkData( val startMs: Long, - val name: String + val name: String, ) : Comparable { override fun compareTo(other: MarkData): Int { return startMs.compareTo(other.startMs) @@ -15,7 +15,7 @@ data class MarkData( data class ChapterMark( val name: String, val startMs: Long, - val endMs: Long + val endMs: Long, ) val ChapterMark.durationMs: Long get() = (endMs - startMs).coerceAtLeast(0L) diff --git a/data/src/main/kotlin/voice/data/legacy/LegacyBookMetaData.kt b/data/src/main/kotlin/voice/data/legacy/LegacyBookMetaData.kt index 2b89c8da24..cadafb2320 100644 --- a/data/src/main/kotlin/voice/data/legacy/LegacyBookMetaData.kt +++ b/data/src/main/kotlin/voice/data/legacy/LegacyBookMetaData.kt @@ -19,7 +19,7 @@ data class LegacyBookMetaData( @ColumnInfo(name = "root") val root: String, @ColumnInfo(name = "addedAtMillis") - val addedAtMillis: Long + val addedAtMillis: Long, ) { init { diff --git a/data/src/main/kotlin/voice/data/legacy/LegacyBookSettings.kt b/data/src/main/kotlin/voice/data/legacy/LegacyBookSettings.kt index bdf4ab4afe..d4a1e6a4a6 100644 --- a/data/src/main/kotlin/voice/data/legacy/LegacyBookSettings.kt +++ b/data/src/main/kotlin/voice/data/legacy/LegacyBookSettings.kt @@ -24,5 +24,5 @@ data class LegacyBookSettings( @ColumnInfo(name = "active") val active: Boolean, @ColumnInfo(name = "lastPlayedAtMillis") - val lastPlayedAtMillis: Long + val lastPlayedAtMillis: Long, ) diff --git a/data/src/main/kotlin/voice/data/legacy/LegacyBookmark.kt b/data/src/main/kotlin/voice/data/legacy/LegacyBookmark.kt index 9d9c69a183..e06b561d70 100644 --- a/data/src/main/kotlin/voice/data/legacy/LegacyBookmark.kt +++ b/data/src/main/kotlin/voice/data/legacy/LegacyBookmark.kt @@ -21,5 +21,5 @@ data class LegacyBookmark( val setBySleepTimer: Boolean, @ColumnInfo(name = "id") @PrimaryKey - val id: UUID + val id: UUID, ) diff --git a/data/src/main/kotlin/voice/data/legacy/LegacyChapter.kt b/data/src/main/kotlin/voice/data/legacy/LegacyChapter.kt index 4c29450335..49bf8691f9 100644 --- a/data/src/main/kotlin/voice/data/legacy/LegacyChapter.kt +++ b/data/src/main/kotlin/voice/data/legacy/LegacyChapter.kt @@ -10,7 +10,7 @@ import java.util.UUID @Entity( tableName = "chapters", - indices = [(Index(value = ["bookId"]))] + indices = [(Index(value = ["bookId"]))], ) data class LegacyChapter( @ColumnInfo(name = "file") @@ -27,7 +27,7 @@ data class LegacyChapter( val bookId: UUID, @ColumnInfo(name = "id") @PrimaryKey(autoGenerate = true) - val id: Long = 0L + val id: Long = 0L, ) { @Ignore diff --git a/data/src/main/kotlin/voice/data/legacy/LegacyChapterMark.kt b/data/src/main/kotlin/voice/data/legacy/LegacyChapterMark.kt index 9862219443..208ec23437 100644 --- a/data/src/main/kotlin/voice/data/legacy/LegacyChapterMark.kt +++ b/data/src/main/kotlin/voice/data/legacy/LegacyChapterMark.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable @Serializable data class LegacyMarkData( val startMs: Long, - val name: String + val name: String, ) : Comparable { override fun compareTo(other: LegacyMarkData): Int { return startMs.compareTo(other.startMs) @@ -15,5 +15,5 @@ data class LegacyMarkData( data class LegacyChapterMark( val name: String, val startMs: Long, - val endMs: Long + val endMs: Long, ) diff --git a/data/src/main/kotlin/voice/data/repo/BookContentRepo.kt b/data/src/main/kotlin/voice/data/repo/BookContentRepo.kt index 41fad55c39..a0a3b9ee70 100644 --- a/data/src/main/kotlin/voice/data/repo/BookContentRepo.kt +++ b/data/src/main/kotlin/voice/data/repo/BookContentRepo.kt @@ -19,7 +19,7 @@ import javax.inject.Singleton @Singleton class BookContentRepo @Inject constructor( - private val dao: BookContentDao + private val dao: BookContentDao, ) { private val cacheMutex = Mutex() diff --git a/data/src/main/kotlin/voice/data/repo/BookRepository.kt b/data/src/main/kotlin/voice/data/repo/BookRepository.kt index ee993c74d2..467366d8ef 100644 --- a/data/src/main/kotlin/voice/data/repo/BookRepository.kt +++ b/data/src/main/kotlin/voice/data/repo/BookRepository.kt @@ -75,7 +75,7 @@ class BookRepository return null } chapter - } + }, ) } } diff --git a/data/src/main/kotlin/voice/data/repo/BookmarkRepo.kt b/data/src/main/kotlin/voice/data/repo/BookmarkRepo.kt index 3e993e3792..4fae16e99f 100644 --- a/data/src/main/kotlin/voice/data/repo/BookmarkRepo.kt +++ b/data/src/main/kotlin/voice/data/repo/BookmarkRepo.kt @@ -16,7 +16,7 @@ import javax.inject.Inject class BookmarkRepo @Inject constructor( private val dao: BookmarkDao, - private val appDb: AppDb + private val appDb: AppDb, ) { suspend fun deleteBookmark(id: Bookmark.Id) { @@ -36,7 +36,7 @@ class BookmarkRepo addedAt = Instant.now(), setBySleepTimer = setBySleepTimer, chapterId = book.content.currentChapter, - bookId = book.id + bookId = book.id, ) addBookmark(bookMark) Logger.v("Added bookmark=$bookMark") diff --git a/data/src/main/kotlin/voice/data/repo/ChapterRepo.kt b/data/src/main/kotlin/voice/data/repo/ChapterRepo.kt index 3ad93b47f4..ff05517bb9 100644 --- a/data/src/main/kotlin/voice/data/repo/ChapterRepo.kt +++ b/data/src/main/kotlin/voice/data/repo/ChapterRepo.kt @@ -10,7 +10,7 @@ import javax.inject.Singleton @Singleton class ChapterRepo @Inject constructor( - private val dao: ChapterDao + private val dao: ChapterDao, ) { private val cache = mutableMapOf() @@ -40,7 +40,7 @@ class ChapterRepo suspend inline fun getOrPut( id: Chapter.Id, lastModified: Instant, - defaultValue: () -> Chapter? + defaultValue: () -> Chapter?, ): Chapter? { val chapter = get(id) if (chapter != null && chapter.fileLastModified == lastModified) { diff --git a/data/src/main/kotlin/voice/data/repo/internals/AppDb.kt b/data/src/main/kotlin/voice/data/repo/internals/AppDb.kt index ea7b67b9ef..1e4f43745b 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/AppDb.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/AppDb.kt @@ -27,7 +27,7 @@ import voice.data.repo.internals.dao.LegacyBookDao Bookmark::class, ], version = AppDb.VERSION, - autoMigrations = [AutoMigration(from = 51, to = 52)] + autoMigrations = [AutoMigration(from = 51, to = 52)], ) @TypeConverters(Converters::class) abstract class AppDb : RoomDatabase() { diff --git a/data/src/main/kotlin/voice/data/repo/internals/DataBaseExtensions.kt b/data/src/main/kotlin/voice/data/repo/internals/DataBaseExtensions.kt index d30987737e..e537fed07e 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/DataBaseExtensions.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/DataBaseExtensions.kt @@ -36,7 +36,7 @@ inline fun Cursor.mapRows(mapper: Cursor.() -> T): List = use { inline fun SupportSQLiteDatabase.transaction( exclusive: Boolean = true, - body: SupportSQLiteDatabase.() -> T + body: SupportSQLiteDatabase.() -> T, ): T { if (exclusive) { beginTransaction() @@ -81,7 +81,7 @@ fun SQLiteDatabase.query( having: String? = null, orderBy: String? = null, limit: String? = null, - distinct: Boolean = false + distinct: Boolean = false, ): Cursor { val argsAsString = selectionArgs?.map(Any::toString)?.toTypedArray() return query( @@ -93,7 +93,7 @@ fun SQLiteDatabase.query( groupBy, having, orderBy, - limit + limit, ) } @@ -101,7 +101,7 @@ fun SQLiteDatabase.update( table: String, values: ContentValues, whereClause: String, - vararg whereArgs: Any + vararg whereArgs: Any, ): Int { val whereArgsMapped = whereArgs.map(Any::toString).toTypedArray() return update(table, values, whereClause, whereArgsMapped) diff --git a/data/src/main/kotlin/voice/data/repo/internals/PersistenceModule.kt b/data/src/main/kotlin/voice/data/repo/internals/PersistenceModule.kt index 3da4dd9a02..7e380adc65 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/PersistenceModule.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/PersistenceModule.kt @@ -60,7 +60,7 @@ object PersistenceModule { @Singleton fun appDb( context: Context, - migrations: Array + migrations: Array, ): AppDb { return Room.databaseBuilder(context, AppDb::class.java, AppDb.DATABASE_NAME) .addMigrations(*migrations) @@ -96,7 +96,7 @@ object PersistenceModule { Migration47(), Migration48(), Migration49(), - Migration50() + Migration50(), ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration23to24.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration23to24.kt index 986fbbea37..69420fbd0d 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration23to24.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration23to24.kt @@ -18,7 +18,7 @@ class Migration23to24 : IncrementalMigration(23) { BOOK_TYPE TEXT NOT NULL, BOOK_ROOT TEXT NOT NULL ) - """ + """, ) db.execSQL( """ @@ -30,7 +30,7 @@ class Migration23to24 : IncrementalMigration(23) { BOOK_ID INTEGER NOT NULL, FOREIGN KEY(BOOK_ID) REFERENCES TABLE_BOOK(BOOK_ID) ) - """ + """, ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration24to25.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration24to25.kt index d88628fc22..86510f2f5f 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration24to25.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration24to25.kt @@ -36,7 +36,7 @@ class Migration24to25 : IncrementalMigration(24) { val bookCursor = db.query( copyBookTableName, - arrayOf("BOOK_ID", "BOOK_ROOT", "BOOK_TYPE") + arrayOf("BOOK_ID", "BOOK_ROOT", "BOOK_TYPE"), ) bookCursor.moveToNextLoop { @@ -48,7 +48,7 @@ class Migration24to25 : IncrementalMigration(24) { SupportSQLiteQueryBuilder.builder("copyChapterTableName") .columns(arrayOf("CHAPTER_PATH", "CHAPTER_DURATION", "CHAPTER_NAME")) .selection("BOOK_ID" + "=?", arrayOf(bookId)) - .create() + .create(), ) val chapterNames = ArrayList(mediaCursor.count) val chapterDurations = ArrayList(mediaCursor.count) diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration25to26.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration25to26.kt index b10ba48eed..85323b88af 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration25to26.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration25to26.kt @@ -12,7 +12,7 @@ class Migration25to26 : IncrementalMigration(25) { // get all books val cursor = db.query( "TABLE_BOOK", - arrayOf("BOOK_ID", "BOOK_JSON") + arrayOf("BOOK_ID", "BOOK_JSON"), ) val allBooks = ArrayList(cursor.count) cursor.use { diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration26to27.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration26to27.kt index 7c9a734794..f110efc4fa 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration26to27.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration26to27.kt @@ -22,7 +22,7 @@ class Migration26to27 : IncrementalMigration(26) { |BOOK_JSON TEXT NOT NULL, |LAST_TIME_BOOK_WAS_ACTIVE INTEGER NOT NULL, |BOOK_ACTIVE INTEGER NOT NULL) - """.trimMargin() + """.trimMargin(), ) val cursor = db.query(copyBookTableName, arrayOf("BOOK_JSON")) diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration28to29.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration28to29.kt index 44155ec55c..60417ab3f5 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration28to29.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration28to29.kt @@ -34,7 +34,7 @@ class Migration28to29 : IncrementalMigration(28) { SQLiteDatabase.CONFLICT_FAIL, cv, "BOOK_ID" + "=?", - arrayOf(cursor.getLong(1).toString()) + arrayOf(cursor.getLong(1).toString()), ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration29to30.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration29to30.kt index f462cee109..abf7dda033 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration29to30.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration29to30.kt @@ -74,7 +74,7 @@ class Migration29to30 : IncrementalMigration(29) { // fetching old contents val cursor = db.query( "TABLE_BOOK", - arrayOf("BOOK_JSON", "BOOK_ACTIVE") + arrayOf("BOOK_JSON", "BOOK_ACTIVE"), ) val bookContents = ArrayList(cursor.count) val activeMapping = ArrayList(cursor.count) diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration30to31.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration30to31.kt index 9842722867..79a904782c 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration30to31.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration30to31.kt @@ -24,7 +24,7 @@ class Migration30to31 : IncrementalMigration(30) { val chapterCursor = db.query( SupportSQLiteQueryBuilder.builder(tableChapters) .selection("$bookIdColumn=?", arrayOf(bookId)) - .create() + .create(), ) chapterCursor.moveToNextLoop { chapterCount++ diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration31to32.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration31to32.kt index f3be176cb4..128a81b35e 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration31to32.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration31to32.kt @@ -22,7 +22,7 @@ class Migration31to32 : IncrementalMigration(31) { override fun migrate(db: SupportSQLiteDatabase) { db.query( TABLE_BOOK, - arrayOf(BOOK_ID, BOOK_CURRENT_MEDIA_PATH) + arrayOf(BOOK_ID, BOOK_CURRENT_MEDIA_PATH), ).moveToNextLoop { val bookId = getLong(0) val bookmarkCurrentMediaPath = getString(1) @@ -31,7 +31,7 @@ class Migration31to32 : IncrementalMigration(31) { SupportSQLiteQueryBuilder.builder(TABLE_CHAPTERS) .columns(arrayOf(CHAPTER_PATH)) .selection("$BOOK_ID=?", arrayOf(bookId)) - .create() + .create(), ) val chapterPaths = ArrayList(chapterCursor.count) chapterCursor.moveToNextLoop { @@ -51,7 +51,7 @@ class Migration31to32 : IncrementalMigration(31) { SQLiteDatabase.CONFLICT_FAIL, cv, "$BOOK_ID=?", - arrayOf(bookId.toString()) + arrayOf(bookId.toString()), ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration35to36.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration35to36.kt index 59f860589d..6a57f34503 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration35to36.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration35to36.kt @@ -49,7 +49,7 @@ class Migration35to36 : IncrementalMigration(35) { getString(ROOT), getLong(TIME), getString(TYPE), - getInt(ACTIVE) + getInt(ACTIVE), ) } db.transaction { @@ -81,6 +81,6 @@ class Migration35to36 : IncrementalMigration(35) { val root: String, val time: Long, val type: String, - val active: Int + val active: Int, ) } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration39to40.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration39to40.kt index 378ac0e94d..efe1569787 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration39to40.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration39to40.kt @@ -22,7 +22,7 @@ class Migration39to40 : IncrementalMigration(39) { SQLiteDatabase.CONFLICT_FAIL, positionZeroContentValues, "$BOOK_TIME < ?", - arrayOf(0) + arrayOf(0), ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration43to44.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration43to44.kt index 579e6d46a3..bcb6989bcc 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration43to44.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration43to44.kt @@ -33,7 +33,7 @@ class Migration43to44 : IncrementalMigration(43) { `title` TEXT NOT NULL, `time` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) - """.trimIndent() + """.trimIndent(), ) db.execSQL( """ @@ -45,7 +45,7 @@ class Migration43to44 : IncrementalMigration(43) { `marks` TEXT NOT NULL, `bookId` TEXT NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) - """.trimIndent() + """.trimIndent(), ) db.execSQL("CREATE INDEX `index_chapters_bookId` ON `chapters` (`bookId`)") db.execSQL( @@ -57,7 +57,7 @@ class Migration43to44 : IncrementalMigration(43) { `name` TEXT NOT NULL, `root` TEXT NOT NULL, `addedAtMillis` INTEGER NOT NULL, PRIMARY KEY(`id`)) - """.trimIndent() + """.trimIndent(), ) db.execSQL( """ @@ -70,7 +70,7 @@ class Migration43to44 : IncrementalMigration(43) { `skipSilence` INTEGER NOT NULL, `active` INTEGER NOT NULL, `lastPlayedAtMillis` INTEGER NOT NULL, PRIMARY KEY(`id`)) - """.trimIndent() + """.trimIndent(), ) } @@ -143,8 +143,8 @@ class Migration43to44 : IncrementalMigration(43) { "duration" to duration, "fileLastModified" to lastModified, "marks" to marks, - "bookId" to newId - ) + "bookId" to newId, + ), ) } } @@ -152,7 +152,7 @@ class Migration43to44 : IncrementalMigration(43) { private fun SupportSQLiteDatabase.insert( tableName: String, - contentValues: (ContentValues).() -> Unit + contentValues: (ContentValues).() -> Unit, ) { val cv = ContentValues() contentValues(cv) diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration45.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration45.kt index 4fceed5442..18e2bb73b1 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration45.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration45.kt @@ -34,7 +34,7 @@ class Migration45 : IncrementalMigration(45) { put("positionInChapter", 0) }, "id =?", - arrayOf(bookId) + arrayOf(bookId), ) } } diff --git a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration49.kt b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration49.kt index 4b25feb922..8230179d94 100644 --- a/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration49.kt +++ b/data/src/main/kotlin/voice/data/repo/internals/migrations/Migration49.kt @@ -22,7 +22,7 @@ class Migration49 : IncrementalMigration(49) { |`addedAt` TEXT NOT NULL, |`setBySleepTimer` INTEGER NOT NULL, |`id` TEXT NOT NULL, PRIMARY KEY(`id`)) - """.trimMargin() + """.trimMargin(), ) query("SELECT * FROM bookmark_old").moveToNextLoop { val file = getString("file") @@ -38,7 +38,7 @@ class Migration49 : IncrementalMigration(49) { put("addedAt", Instant.EPOCH.toString()) put("setBySleepTimer", false) put("id", UUID.randomUUID().toString()) - } + }, ) } execSQL("DROP TABLE bookmark_old") diff --git a/data/src/test/kotlin/voice/data/BookFactory.kt b/data/src/test/kotlin/voice/data/BookFactory.kt index fe9d467d0a..4f6778b21c 100644 --- a/data/src/test/kotlin/voice/data/BookFactory.kt +++ b/data/src/test/kotlin/voice/data/BookFactory.kt @@ -25,7 +25,7 @@ fun book( isActive = true, lastPlayedAt = Instant.ofEpochMilli(lastPlayedAtMillis), skipSilence = false, - id = BookId(UUID.randomUUID().toString()) + id = BookId(UUID.randomUUID().toString()), ), chapters = chapters, ) @@ -33,13 +33,13 @@ fun book( fun chapter( duration: Long = 10000, - id: Chapter.Id = Chapter.Id(UUID.randomUUID().toString()) + id: Chapter.Id = Chapter.Id(UUID.randomUUID().toString()), ): Chapter { return Chapter( id = id, name = UUID.randomUUID().toString(), duration = duration, fileLastModified = Instant.EPOCH, - markData = emptyList() + markData = emptyList(), ) } diff --git a/data/src/test/kotlin/voice/data/BookTest.kt b/data/src/test/kotlin/voice/data/BookTest.kt index d36b8db34e..f8da6963f7 100644 --- a/data/src/test/kotlin/voice/data/BookTest.kt +++ b/data/src/test/kotlin/voice/data/BookTest.kt @@ -59,7 +59,7 @@ class BookTest { chapter(duration = 123), chapter(duration = 234), chapter(duration = 345), - chapter(duration = 456, id = lastChapterId) + chapter(duration = 456, id = lastChapterId), ), currentChapter = lastChapterId, ) @@ -75,7 +75,7 @@ class BookTest { chapter(duration = 123), chapter(duration = 234), chapter(duration = 345, id = targetChapter), - chapter(duration = 456) + chapter(duration = 456), ), currentChapter = targetChapter, ) @@ -89,7 +89,7 @@ class BookTest { chapter(duration = 123), chapter(duration = 234), chapter(duration = 345), - chapter(duration = 456) + chapter(duration = 456), ), ) @@ -115,7 +115,7 @@ class BookTest { val ch3 = chapter() val book = book( chapters = listOf(ch1, ch2, ch3), - currentChapter = ch2.id + currentChapter = ch2.id, ) book.assertThat().currentChapterIndexIs(1) @@ -128,7 +128,7 @@ class BookTest { val ch3 = chapter() val book = book( chapters = listOf(ch1, ch2, ch3), - currentChapter = ch2.id + currentChapter = ch2.id, ) book.assertThat().nextChapterIs(ch3) @@ -141,7 +141,7 @@ class BookTest { val ch3 = chapter() val book = book( chapters = listOf(ch1, ch2, ch3), - currentChapter = ch3.id + currentChapter = ch3.id, ) book.assertThat().nextChapterIs(null) @@ -176,7 +176,7 @@ class BookTest { return book( chapters = chapters, time = positionInChapter, - currentChapter = currentChapter + currentChapter = currentChapter, ).position } } diff --git a/data/src/test/kotlin/voice/data/SqlStatementSplitterTest.kt b/data/src/test/kotlin/voice/data/SqlStatementSplitterTest.kt index 9dc4586d2f..8cb581dfd6 100644 --- a/data/src/test/kotlin/voice/data/SqlStatementSplitterTest.kt +++ b/data/src/test/kotlin/voice/data/SqlStatementSplitterTest.kt @@ -17,8 +17,8 @@ class SqlStatementSplitterTest { recordedChunks.shouldContainExactly( listOf( listOf(1, 2), - listOf(3) - ) + listOf(3), + ), ) result.shouldContainExactly("1", "2", "3") } @@ -33,8 +33,8 @@ class SqlStatementSplitterTest { } recordedChunks.shouldContainExactly( listOf( - listOf(1, 2, 3) - ) + listOf(1, 2, 3), + ), ) result.shouldContainExactly("1", "2", "3") } diff --git a/data/src/test/kotlin/voice/data/repo/internals/ConvertersTest.kt b/data/src/test/kotlin/voice/data/repo/internals/ConvertersTest.kt index 2624637e98..10fec60829 100644 --- a/data/src/test/kotlin/voice/data/repo/internals/ConvertersTest.kt +++ b/data/src/test/kotlin/voice/data/repo/internals/ConvertersTest.kt @@ -43,17 +43,17 @@ class ConvertersTest { value = listOf( MarkData(0L, "Hello"), MarkData(5L, "World"), - MarkData(Long.MIN_VALUE, "") + MarkData(Long.MIN_VALUE, ""), ), serialize = Converters::fromMarks, - deSerialize = Converters::toMarks + deSerialize = Converters::toMarks, ) } private fun test( value: D, serialize: (Converters.(D) -> S), - deSerialize: (Converters.(S) -> D) + deSerialize: (Converters.(S) -> D), ) { val converters = Converters() val serialized: S = converters.serialize(value) diff --git a/data/src/test/kotlin/voice/data/repo/internals/DataBaseMigratorTest.kt b/data/src/test/kotlin/voice/data/repo/internals/DataBaseMigratorTest.kt index 933a1ffc89..dae283e407 100644 --- a/data/src/test/kotlin/voice/data/repo/internals/DataBaseMigratorTest.kt +++ b/data/src/test/kotlin/voice/data/repo/internals/DataBaseMigratorTest.kt @@ -34,7 +34,7 @@ class DataBaseMigratorTest { dbName, AppDb.VERSION, true, - *PersistenceModule.migrations() + *PersistenceModule.migrations(), ) } @@ -50,7 +50,7 @@ class DataBaseMigratorTest { db.execSQL( "INSERT OR REPLACE INTO `bookSettings`(`id`,`currentFile`,`positionInChapter`,`playbackSpeed`,`loudnessGain`,`skipSilence`," + "`active`,`lastPlayedAtMillis`) VALUES (?,?,?,?,?,?,?,?)", - arrayOf(settings.id, settings.currentFile, settings.positionInChapter, 1F, 0, 0, 1, 0) + arrayOf(settings.id, settings.currentFile, settings.positionInChapter, 1F, 0, 0, 1, 0), ) } @@ -58,7 +58,7 @@ class DataBaseMigratorTest { db.execSQL( "INSERT OR REPLACE INTO `chapters`(`file`,`name`,`duration`,`fileLastModified`,`marks`,`bookId`,`id`) " + "VALUES (?,?,?,?,?,?,nullif(?, 0))", - arrayOf(chapter.file, "name", 1L, 0L, "{}", chapter.bookId) + arrayOf(chapter.file, "name", 1L, 0L, "{}", chapter.bookId), ) } @@ -81,19 +81,19 @@ class DataBaseMigratorTest { dbName, 45, true, - *PersistenceModule.migrations() + *PersistenceModule.migrations(), ) val migratedBookSettings = migratedDb.query("SELECT * FROM bookSettings").mapRows { BookSetting( id = getString("id"), currentFile = getString("currentFile"), - positionInChapter = getInt("positionInChapter") + positionInChapter = getInt("positionInChapter"), ) } assertThat(migratedBookSettings).containsExactly( correctBookSettings, - BookSetting(id = defectBookId, currentFile = file2, positionInChapter = 0) + BookSetting(id = defectBookId, currentFile = file2, positionInChapter = 0), ).inOrder() } @@ -111,13 +111,13 @@ class DataBaseMigratorTest { data class Bookmark( val path: String, val title: String, - val time: Int + val time: Int, ) val bookmarks = run { listOf( Bookmark(randomString(), randomString(), randomInt()), - Bookmark(randomString(), randomString(), randomInt()) + Bookmark(randomString(), randomString(), randomInt()), ) } bookmarks.forEach { @@ -128,7 +128,7 @@ class DataBaseMigratorTest { put(BookmarkTable.PATH, it.path) put(BookmarkTable.TITLE, it.title) put(BookmarkTable.TIME, it.time) - } + }, ) } @@ -137,7 +137,7 @@ class DataBaseMigratorTest { val name: String, val path: String, val lastModified: Int, - val marks: String? + val marks: String?, ) data class Book( @@ -150,13 +150,13 @@ class DataBaseMigratorTest { val loudnessGain: Int, val active: Int, val time: Int, - val chapters: List + val chapters: List, ) fun chapters(): List { return listOf( Chapter(randomInt(), randomString(), randomString(), randomInt(), randomString()), - Chapter(randomInt(), randomString(), randomString(), randomInt(), null) + Chapter(randomInt(), randomString(), randomString(), randomInt(), null), ) } @@ -171,7 +171,7 @@ class DataBaseMigratorTest { loudnessGain = randomInt(), active = 1, time = randomInt(), - chapters = chapters() + chapters = chapters(), ) val secondBook = Book( author = null, @@ -183,7 +183,7 @@ class DataBaseMigratorTest { loudnessGain = randomInt(), active = 0, time = randomInt(), - chapters = emptyList() + chapters = emptyList(), ) listOf(firstBook, secondBook) @@ -204,7 +204,7 @@ class DataBaseMigratorTest { put(BookTable.TYPE, book.type) put(BookTable.LOUDNESS_GAIN, book.loudnessGain) put(BookTable.ACTIVE, book.active) - } + }, ) book.chapters.forEach { chapter -> db.insert( @@ -217,7 +217,7 @@ class DataBaseMigratorTest { put(ChapterTable.LAST_MODIFIED, chapter.lastModified) put(ChapterTable.MARKS, chapter.marks) put(ChapterTable.BOOK_ID, bookId) - } + }, ) } } @@ -227,7 +227,7 @@ class DataBaseMigratorTest { dbName, 44, true, - *PersistenceModule.migrations() + *PersistenceModule.migrations(), ) val metaDataCursor = migratedDb.query("SELECT * FROM bookMetaData") diff --git a/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration39to40Test.kt b/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration39to40Test.kt index 6161c10156..eb8e2e0bdd 100644 --- a/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration39to40Test.kt +++ b/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration39to40Test.kt @@ -29,14 +29,16 @@ class Migration39to40Test { fun setUp() { val config = SupportSQLiteOpenHelper.Configuration .builder(getApplicationContext()) - .callback(object : SupportSQLiteOpenHelper.Callback(39) { - override fun onCreate(db: SupportSQLiteDatabase) { - db.execSQL(BookTable.CREATE_TABLE) - } + .callback( + object : SupportSQLiteOpenHelper.Callback(39) { + override fun onCreate(db: SupportSQLiteDatabase) { + db.execSQL(BookTable.CREATE_TABLE) + } - override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) { - } - }) + override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) { + } + }, + ) .build() helper = FrameworkSQLiteOpenHelperFactory().create(config) db = helper.writableDatabase diff --git a/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration40to41Test.kt b/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration40to41Test.kt index 67467b87e7..fd70e0a3a6 100644 --- a/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration40to41Test.kt +++ b/data/src/test/kotlin/voice/data/repo/internals/migrations/Migration40to41Test.kt @@ -33,14 +33,16 @@ class Migration40to41Test { fun setUp() { val config = SupportSQLiteOpenHelper.Configuration .builder(getApplicationContext()) - .callback(object : SupportSQLiteOpenHelper.Callback(39) { - override fun onCreate(db: SupportSQLiteDatabase) { - db.execSQL(BookTable.CREATE_TABLE) - } + .callback( + object : SupportSQLiteOpenHelper.Callback(39) { + override fun onCreate(db: SupportSQLiteDatabase) { + db.execSQL(BookTable.CREATE_TABLE) + } - override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) { - } - }) + override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) { + } + }, + ) .build() helper = FrameworkSQLiteOpenHelperFactory().create(config) db = helper.writableDatabase @@ -68,7 +70,7 @@ class Migration40to41Test { SQLiteDatabase.CONFLICT_FAIL, loudnessGainCv, "${BookTable.ID}=?", - arrayOf(id) + arrayOf(id), ) val query = SupportSQLiteQueryBuilder.builder(BookTable.TABLE_NAME) diff --git a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerView.kt b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerView.kt index e2df537d1a..876aca9905 100644 --- a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerView.kt +++ b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerView.kt @@ -74,7 +74,7 @@ fun FolderPickerView( onAddClick: () -> Unit, onDeleteClick: (Uri) -> Unit, onDismissExplanationCardClick: () -> Unit, - onCloseClick: () -> Unit + onCloseClick: () -> Unit, ) { Scaffold( topBar = { @@ -86,10 +86,10 @@ fun FolderPickerView( IconButton(onClick = onCloseClick) { Icon( imageVector = Icons.Outlined.ArrowBack, - contentDescription = stringResource(R.string.close) + contentDescription = stringResource(R.string.close), ) } - } + }, ) }, floatingActionButton = { @@ -101,11 +101,11 @@ fun FolderPickerView( icon = { Icon( imageVector = Icons.Outlined.Add, - contentDescription = stringResource(R.string.add) + contentDescription = stringResource(R.string.add), ) - } + }, ) - } + }, ) { LazyColumn(contentPadding = it) { viewState.explanationCard?.let { text -> @@ -118,16 +118,16 @@ fun FolderPickerView( Column( Modifier .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 16.dp) + .padding(horizontal = 16.dp, vertical = 16.dp), ) { Text( text = text, - style = MaterialTheme.typography.bodyLarge + style = MaterialTheme.typography.bodyLarge, ) Spacer(modifier = Modifier.size(16.dp)) Button( modifier = Modifier.align(End), - onClick = onDismissExplanationCardClick + onClick = onDismissExplanationCardClick, ) { Text(text = stringResource(R.string.got_audiobook_folder_card_action)) } @@ -146,11 +146,11 @@ fun FolderPickerView( content = { Icon( imageVector = Icons.Outlined.Delete, - contentDescription = stringResource(R.string.delete) + contentDescription = stringResource(R.string.delete), ) - } + }, ) - } + }, ) { Text(text = item.name, style = MaterialTheme.typography.bodyLarge) } diff --git a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewModel.kt b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewModel.kt index 1cdc8c294c..20cfe15b74 100644 --- a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewModel.kt +++ b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewModel.kt @@ -43,7 +43,7 @@ class FolderPickerViewModel val documentFile = DocumentFile.fromTreeUri(context, uri) FolderPickerViewState.Item( name = documentFile?.name ?: "", - id = uri + id = uri, ) } } @@ -66,7 +66,7 @@ class FolderPickerViewModel fun addFolder(uri: Uri) { context.contentResolver.takePersistableUriPermission( uri, - Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION + Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION, ) scope.launch { audiobookFolders.updateData { @@ -79,7 +79,7 @@ class FolderPickerViewModel try { context.contentResolver.releasePersistableUriPermission( uri, - Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION + Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION, ) } catch (e: SecurityException) { Logger.w("Could not release uri permission for $uri") diff --git a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewState.kt b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewState.kt index 56b82c4645..ee6c76c7f9 100644 --- a/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewState.kt +++ b/folderPicker/src/main/kotlin/voice/folderPicker/FolderPickerViewState.kt @@ -4,11 +4,11 @@ import android.net.Uri data class FolderPickerViewState( val explanationCard: String?, - val items: List + val items: List, ) { data class Item( val name: String, - val id: Uri + val id: Uri, ) } diff --git a/migration/src/main/kotlin/voice/migration/MigrationViewModel.kt b/migration/src/main/kotlin/voice/migration/MigrationViewModel.kt index 849ddb3f63..a92b0ce26c 100644 --- a/migration/src/main/kotlin/voice/migration/MigrationViewModel.kt +++ b/migration/src/main/kotlin/voice/migration/MigrationViewModel.kt @@ -133,7 +133,7 @@ private fun migrationItem(metaData: LegacyBookMetaData, migrationData: Migration positionInChapter = formatTime(positionInMark), currentFile = currentChapter.name, positionInFile = formatTime(settings.positionInChapter), - ) + ), ) } } @@ -141,7 +141,7 @@ private fun migrationItem(metaData: LegacyBookMetaData, migrationData: Migration private fun bookmark( chapters: List, bookmark: LegacyBookmark, - currentMark: LegacyChapterMark + currentMark: LegacyChapterMark, ): MigrationViewState.Item.Bookmark? { val bookmarkChapter = chapters.find { it.file == bookmark.mediaFile } return if (bookmarkChapter == null) { diff --git a/migration/src/main/kotlin/voice/migration/views/Migration.kt b/migration/src/main/kotlin/voice/migration/views/Migration.kt index d359b6919c..e7bd09e639 100644 --- a/migration/src/main/kotlin/voice/migration/views/Migration.kt +++ b/migration/src/main/kotlin/voice/migration/views/Migration.kt @@ -55,7 +55,7 @@ fun Migration() { viewState = viewState, onCloseClicked = { viewModel.onCloseClick() - } + }, ) } @@ -72,28 +72,28 @@ internal fun Migration( }, navigationIcon = { IconButton( - onClick = onCloseClicked + onClick = onCloseClicked, ) { Icon( imageVector = Icons.Outlined.Close, - contentDescription = stringResource(R.string.close) + contentDescription = stringResource(R.string.close), ) } - } + }, ) }, floatingActionButton = { FloatingActionButton(onClick = viewState.onDeleteClicked) { Icon( imageVector = Icons.Outlined.Delete, - contentDescription = stringResource(id = R.string.delete) + contentDescription = stringResource(id = R.string.delete), ) } - } + }, ) { contentPadding -> LazyColumn( contentPadding = contentPadding + PaddingValues(horizontal = 16.dp, vertical = 24.dp), - verticalArrangement = Arrangement.spacedBy(8.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), ) { items(viewState.items) { item -> MigrationItem(item) @@ -102,7 +102,7 @@ internal fun Migration( if (viewState.showDeletionConfirmationDialog) { DeletionConfirmationDialog( onCancel = viewState.onDeletionAborted, - onConfirm = viewState.onDeletionConfirmed + onConfirm = viewState.onDeletionConfirmed, ) } } @@ -137,24 +137,24 @@ private fun DeletionConfirmationDialog( @Composable private fun MigrationItem(item: MigrationViewState.Item) { Card( - Modifier.fillMaxWidth() + Modifier.fillMaxWidth(), ) { Column( Modifier.padding(horizontal = 16.dp, vertical = 16.dp), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { LabeledValue( label = stringResource(id = R.string.migration_detail_content_name), - value = item.name + value = item.name, ) LabeledValue( label = stringResource(id = R.string.migration_detail_content_root), - value = item.root + value = item.root, ) Column { Text( text = stringResource(id = R.string.migration_detail_content_position), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) Column(Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp)) { Position(item.position) @@ -163,23 +163,23 @@ private fun MigrationItem(item: MigrationViewState.Item) { if (item.bookmarks.isNotEmpty()) { Text( text = stringResource(id = R.string.migration_detail_content_bookmarks), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) Column( modifier = Modifier.padding(horizontal = 16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), ) { item.bookmarks.forEach { bookmark -> if (bookmark.title != null) { LabeledValue( label = stringResource(id = R.string.migration_detail_title), - value = bookmark.title + value = bookmark.title, ) } Column(Modifier.padding(horizontal = 16.dp)) { LabeledValue( label = stringResource(id = R.string.migration_detail_content_added_at), - value = bookmark.addedAt.toString() + value = bookmark.addedAt.toString(), ) Spacer(modifier = Modifier.height(16.dp)) Position(bookmark.position) @@ -204,19 +204,19 @@ private fun Position(viewState: MigrationViewState.Position) { Column(verticalArrangement = Arrangement.spacedBy(16.dp)) { LabeledValue( label = stringResource(id = R.string.migration_detail_content_position_current_file_title), - value = viewState.currentFile + value = viewState.currentFile, ) LabeledValue( label = stringResource(id = R.string.migration_detail_content_position_current_file_position), - value = viewState.positionInFile + value = viewState.positionInFile, ) LabeledValue( label = stringResource(id = R.string.migration_detail_content_position_current_chapter_title), - value = viewState.currentChapter + value = viewState.currentChapter, ) LabeledValue( label = stringResource(id = R.string.migration_detail_content_position_current_chapter_position), - value = viewState.positionInChapter + value = viewState.positionInChapter, ) } } @@ -225,7 +225,7 @@ private fun Position(viewState: MigrationViewState.Position) { @Preview private fun MigrationPreview( @PreviewParameter(MigrationViewStatePreviewProvider::class) - viewState: MigrationViewState + viewState: MigrationViewState, ) { VoiceTheme { Migration(viewState, onCloseClicked = {}) @@ -241,7 +241,7 @@ internal class MigrationViewStatePreviewProvider : PreviewParameterProvider, - private val autoConnection: AndroidAutoConnectedReceiver + private val autoConnection: AndroidAutoConnectedReceiver, ) { suspend fun listen() { diff --git a/playback/src/main/kotlin/voice/playback/di/PlaybackComponent.kt b/playback/src/main/kotlin/voice/playback/di/PlaybackComponent.kt index 29acf10e3f..b9c525ed03 100644 --- a/playback/src/main/kotlin/voice/playback/di/PlaybackComponent.kt +++ b/playback/src/main/kotlin/voice/playback/di/PlaybackComponent.kt @@ -7,7 +7,7 @@ import voice.playback.session.PlaybackService @PlaybackScope @MergeSubcomponent( - scope = PlaybackScope::class + scope = PlaybackScope::class, ) interface PlaybackComponent { diff --git a/playback/src/main/kotlin/voice/playback/notification/NotificationChannelCreator.kt b/playback/src/main/kotlin/voice/playback/notification/NotificationChannelCreator.kt index 85ac3196b8..79fb54334c 100644 --- a/playback/src/main/kotlin/voice/playback/notification/NotificationChannelCreator.kt +++ b/playback/src/main/kotlin/voice/playback/notification/NotificationChannelCreator.kt @@ -16,7 +16,7 @@ const val MUSIC_CHANNEL_ID = "musicChannel4" class NotificationChannelCreator @Inject constructor( private val notificationManager: NotificationManager, - private val context: Context + private val context: Context, ) { private var created = AtomicBoolean() @@ -31,7 +31,7 @@ class NotificationChannelCreator val channel = NotificationChannel( MUSIC_CHANNEL_ID, name, - NotificationManager.IMPORTANCE_LOW + NotificationManager.IMPORTANCE_LOW, ).apply { lockscreenVisibility = Notification.VISIBILITY_PUBLIC setShowBadge(false) diff --git a/playback/src/main/kotlin/voice/playback/notification/NotificationCreator.kt b/playback/src/main/kotlin/voice/playback/notification/NotificationCreator.kt index f39005c0dd..156941e5f1 100644 --- a/playback/src/main/kotlin/voice/playback/notification/NotificationCreator.kt +++ b/playback/src/main/kotlin/voice/playback/notification/NotificationCreator.kt @@ -33,31 +33,31 @@ class NotificationCreator private val playStateManager: PlayStateManager, private val mediaSession: MediaSessionCompat, notificationChannelCreator: NotificationChannelCreator, - private val toBookIntentProvider: ToBookIntentProvider + private val toBookIntentProvider: ToBookIntentProvider, ) { private val fastForwardAction = NotificationCompat.Action( R.drawable.ic_fast_forward_white_36dp, context.getString(R.string.fast_forward), - buildMediaButtonPendingIntent(context, ACTION_FAST_FORWARD) + buildMediaButtonPendingIntent(context, ACTION_FAST_FORWARD), ) private val rewindAction = NotificationCompat.Action( R.drawable.ic_rewind_white_36dp, context.getString(R.string.rewind), - buildMediaButtonPendingIntent(context, ACTION_REWIND) + buildMediaButtonPendingIntent(context, ACTION_REWIND), ) private val playAction = NotificationCompat.Action( R.drawable.ic_play_white_36dp, context.getString(R.string.play), - buildMediaButtonPendingIntent(context, ACTION_PLAY) + buildMediaButtonPendingIntent(context, ACTION_PLAY), ) private val pauseAction = NotificationCompat.Action( R.drawable.ic_pause_white_36dp, context.getString(R.string.pause), - buildMediaButtonPendingIntent(context, ACTION_PAUSE) + buildMediaButtonPendingIntent(context, ACTION_PAUSE), ) init { @@ -103,12 +103,12 @@ class NotificationCreator .data(coverFile) .size( width = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_width), - height = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_height) + height = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_height), ) .fallback(R.drawable.album_art) .error(R.drawable.album_art) .allowHardware(false) - .build() + .build(), ) .drawable!!.toBitmap() @@ -132,7 +132,7 @@ class NotificationCreator context, 0, contentIntent, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) } diff --git a/playback/src/main/kotlin/voice/playback/player/DataSourceConverter.kt b/playback/src/main/kotlin/voice/playback/player/DataSourceConverter.kt index 794a6832c4..1bce0b9272 100644 --- a/playback/src/main/kotlin/voice/playback/player/DataSourceConverter.kt +++ b/playback/src/main/kotlin/voice/playback/player/DataSourceConverter.kt @@ -10,7 +10,7 @@ import javax.inject.Inject class DataSourceConverter @Inject constructor( - private val mediaSourceFactory: MediaSource.Factory + private val mediaSourceFactory: MediaSource.Factory, ) { fun toMediaSource(content: Book): MediaSource { diff --git a/playback/src/main/kotlin/voice/playback/player/ExoPlayer.kt b/playback/src/main/kotlin/voice/playback/player/ExoPlayer.kt index c11ea6c4b4..1384a7aa44 100644 --- a/playback/src/main/kotlin/voice/playback/player/ExoPlayer.kt +++ b/playback/src/main/kotlin/voice/playback/player/ExoPlayer.kt @@ -9,31 +9,33 @@ import voice.playback.BuildConfig import voice.playback.playstate.PlayerState fun ExoPlayer.onSessionPlaybackStateNeedsUpdate(listener: () -> Unit) { - addListener(object : Player.Listener { - override fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters) { - listener() - } + addListener( + object : Player.Listener { + override fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters) { + listener() + } - override fun onPositionDiscontinuity(oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int) { - listener() - } + override fun onPositionDiscontinuity(oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int) { + listener() + } - override fun onPlaybackStateChanged(playbackState: Int) { - listener() - } + override fun onPlaybackStateChanged(playbackState: Int) { + listener() + } - override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) { - listener() - } + override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) { + listener() + } - override fun onIsPlayingChanged(isPlaying: Boolean) { - listener() - } + override fun onIsPlayingChanged(isPlaying: Boolean) { + listener() + } - override fun onTimelineChanged(timeline: Timeline, reason: Int) { - listener() - } - }) + override fun onTimelineChanged(timeline: Timeline, reason: Int) { + listener() + } + }, + ) } inline fun ExoPlayer.onStateChanged(crossinline action: (PlayerState) -> Unit) { @@ -67,7 +69,7 @@ inline fun ExoPlayer.onStateChanged(crossinline action: (PlayerState) -> Unit) { action(state) } } - } + }, ) } @@ -77,7 +79,7 @@ inline fun ExoPlayer.onError(crossinline action: (PlaybackException) -> Unit) { override fun onPlayerError(error: PlaybackException) { action(error) } - } + }, ) } @@ -87,6 +89,6 @@ inline fun ExoPlayer.onPositionDiscontinuity(crossinline action: () -> Unit) { override fun onPositionDiscontinuity(oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int) { action() } - } + }, ) } diff --git a/playback/src/main/kotlin/voice/playback/player/MediaPlayer.kt b/playback/src/main/kotlin/voice/playback/player/MediaPlayer.kt index 0c55213717..fab922500a 100644 --- a/playback/src/main/kotlin/voice/playback/player/MediaPlayer.kt +++ b/playback/src/main/kotlin/voice/playback/player/MediaPlayer.kt @@ -105,7 +105,7 @@ constructor( updateContent { copy( positionInChapter = position, - currentChapter = chapters[player.currentMediaItemIndex] + currentChapter = chapters[player.currentMediaItemIndex], ) } } @@ -306,7 +306,7 @@ constructor( autoRewindAmount.seconds } else { Duration.ZERO - } + }, ) } diff --git a/playback/src/main/kotlin/voice/playback/player/OnlyAudioRenderersFactory.kt b/playback/src/main/kotlin/voice/playback/player/OnlyAudioRenderersFactory.kt index 97c9cb49d9..35d118ae96 100644 --- a/playback/src/main/kotlin/voice/playback/player/OnlyAudioRenderersFactory.kt +++ b/playback/src/main/kotlin/voice/playback/player/OnlyAudioRenderersFactory.kt @@ -14,7 +14,7 @@ import javax.inject.Inject class OnlyAudioRenderersFactory @Inject constructor( - private val context: Context + private val context: Context, ) : RenderersFactory { override fun createRenderers( @@ -22,7 +22,7 @@ class OnlyAudioRenderersFactory videoRendererEventListener: VideoRendererEventListener, audioRendererEventListener: AudioRendererEventListener, textRendererOutput: TextOutput, - metadataRendererOutput: MetadataOutput + metadataRendererOutput: MetadataOutput, ): Array { return arrayOf( MediaCodecAudioRenderer( @@ -30,7 +30,7 @@ class OnlyAudioRenderersFactory MediaCodecSelector.DEFAULT, eventHandler, audioRendererEventListener, - ) + ), ) } } diff --git a/playback/src/main/kotlin/voice/playback/session/ChangeNotifier.kt b/playback/src/main/kotlin/voice/playback/session/ChangeNotifier.kt index 16aed4f972..653481172c 100644 --- a/playback/src/main/kotlin/voice/playback/session/ChangeNotifier.kt +++ b/playback/src/main/kotlin/voice/playback/session/ChangeNotifier.kt @@ -27,7 +27,7 @@ class ChangeNotifier private val bookUriConverter: BookUriConverter, private val mediaSession: MediaSessionCompat, private val context: Context, - private val autoConnectedReceiver: AndroidAutoConnectedReceiver + private val autoConnectedReceiver: AndroidAutoConnectedReceiver, ) { /** The last file the [.notifyChange] has used to update the metadata. **/ @@ -47,7 +47,7 @@ class ChangeNotifier PlaybackStateCompat.ACTION_SKIP_TO_NEXT or PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS or PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM or - PlaybackStateCompat.ACTION_STOP + PlaybackStateCompat.ACTION_STOP, ) // use a different feature set for Android Auto @@ -60,27 +60,27 @@ class ChangeNotifier PlaybackStateCompat.ACTION_PLAY_PAUSE or PlaybackStateCompat.ACTION_SEEK_TO or PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM or - PlaybackStateCompat.ACTION_STOP + PlaybackStateCompat.ACTION_STOP, ) .addCustomAction( ANDROID_AUTO_ACTION_REWIND, context.getString(R.string.rewind), - R.drawable.ic_fast_rewind + R.drawable.ic_fast_rewind, ) .addCustomAction( ANDROID_AUTO_ACTION_FAST_FORWARD, context.getString(R.string.fast_forward), - R.drawable.ic_fast_forward + R.drawable.ic_fast_forward, ) .addCustomAction( ANDROID_AUTO_ACTION_PREVIOUS, context.getString(R.string.previous_track), - R.drawable.ic_skip_previous + R.drawable.ic_skip_previous, ) .addCustomAction( ANDROID_AUTO_ACTION_NEXT, context.getString(R.string.next_track), - R.drawable.ic_skip_next + R.drawable.ic_skip_next, ) fun updatePlaybackState(@PlaybackStateCompat.State state: Int, book: Book?) { @@ -94,7 +94,7 @@ class ChangeNotifier setState( state, book?.content?.positionInChapter ?: PLAYBACK_POSITION_UNKNOWN, - book?.content?.playbackSpeed ?: 1F + book?.content?.playbackSpeed ?: 1F, ) if (book != null) { @@ -121,12 +121,12 @@ class ChangeNotifier .data(content.cover) .size( width = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_width), - height = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_height) + height = context.resources.getDimensionPixelSize(R.dimen.compat_notification_large_icon_max_height), ) .fallback(R.drawable.album_art) .error(R.drawable.album_art) .allowHardware(false) - .build() + .build(), ) .drawable!!.toBitmap() val mediaMetaData = MediaMetadataCompat.Builder() @@ -135,7 +135,7 @@ class ChangeNotifier .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, currentChapter.duration) .putLong( MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, - (content.currentChapterIndex + 1).toLong() + (content.currentChapterIndex + 1).toLong(), ) .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, book.chapters.size.toLong()) .putString(MediaMetadataCompat.METADATA_KEY_TITLE, chapterName) diff --git a/playback/src/main/kotlin/voice/playback/session/MediaBrowserHelper.kt b/playback/src/main/kotlin/voice/playback/session/MediaBrowserHelper.kt index 498d995ffe..4aecfbd2c7 100644 --- a/playback/src/main/kotlin/voice/playback/session/MediaBrowserHelper.kt +++ b/playback/src/main/kotlin/voice/playback/session/MediaBrowserHelper.kt @@ -30,7 +30,7 @@ class MediaBrowserHelper @CurrentBook private val currentBookId: DataStore, private val context: Context, - private val applicationIdProvider: ApplicationIdProvider + private val applicationIdProvider: ApplicationIdProvider, ) { fun root(): String = bookUriConverter.allBooksId() @@ -62,7 +62,8 @@ class MediaBrowserHelper } } is BookUriConverter.Parsed.Book, - is BookUriConverter.Parsed.Chapter -> { + is BookUriConverter.Parsed.Chapter, + -> { Logger.w("Didn't handle $parentId") null } @@ -72,7 +73,7 @@ class MediaBrowserHelper private fun currentBookTitlePrefix() = "${context.getString(R.string.current_book)}: " private suspend fun Book.toMediaDescription( - titlePrefix: String = "" + titlePrefix: String = "", ): MediaBrowserCompat.MediaItem { val iconUri = content.cover?.let { fileProviderUri(it) } val mediaId = bookUriConverter.book(id) @@ -92,12 +93,12 @@ class MediaBrowserHelper context.grantUriPermission( "com.google.android.wearable.app", this, - Intent.FLAG_GRANT_READ_URI_PERMISSION + Intent.FLAG_GRANT_READ_URI_PERMISSION, ) context.grantUriPermission( "com.google.android.projection.gearhead", this, - Intent.FLAG_GRANT_READ_URI_PERMISSION + Intent.FLAG_GRANT_READ_URI_PERMISSION, ) } } else null diff --git a/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt b/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt index a3c6856893..2e62278c38 100644 --- a/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt +++ b/playback/src/main/kotlin/voice/playback/session/PlaybackService.kt @@ -190,7 +190,7 @@ class PlaybackService : MediaBrowserServiceCompat() { override fun onLoadChildren( parentId: String, - result: Result> + result: Result>, ) { result.detach() scope.launch { @@ -202,7 +202,7 @@ class PlaybackService : MediaBrowserServiceCompat() { override fun onGetRoot( clientPackageName: String, clientUid: Int, - rootHints: Bundle? + rootHints: Bundle?, ): BrowserRoot = BrowserRoot(mediaBrowserHelper.root(), null) override fun onDestroy() { @@ -225,14 +225,15 @@ class PlaybackService : MediaBrowserServiceCompat() { when (updatedState) { PlaybackStateCompat.STATE_BUFFERING, - PlaybackStateCompat.STATE_PLAYING -> { + PlaybackStateCompat.STATE_PLAYING, + -> { if (notification != null) { notificationManager.notify(NOTIFICATION_ID, notification) if (!isForeground) { ContextCompat.startForegroundService( applicationContext, - Intent(applicationContext, this@PlaybackService.javaClass) + Intent(applicationContext, this@PlaybackService.javaClass), ) startForeground(NOTIFICATION_ID, notification) isForeground = true diff --git a/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt b/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt index 3a789bcfb7..d1b631c93f 100644 --- a/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt +++ b/playback/src/main/kotlin/voice/playback/session/search/BookSearchHandler.kt @@ -29,7 +29,8 @@ class BookSearchHandler when (search.mediaFocus) { MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE -> playArtist(search) MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE, - MediaStore.Audio.Media.ENTRY_CONTENT_TYPE -> playAlbum(search) + MediaStore.Audio.Media.ENTRY_CONTENT_TYPE, + -> playAlbum(search) else -> playUnstructuredSearch(search.query) } } diff --git a/playback/src/main/kotlin/voice/playback/session/search/BookSearchParser.kt b/playback/src/main/kotlin/voice/playback/session/search/BookSearchParser.kt index df6e064c39..c40aac25f8 100644 --- a/playback/src/main/kotlin/voice/playback/session/search/BookSearchParser.kt +++ b/playback/src/main/kotlin/voice/playback/session/search/BookSearchParser.kt @@ -15,7 +15,7 @@ class BookSearchParser @Inject constructor() { query = query, mediaFocus = extras?.getString(MediaStore.EXTRA_MEDIA_FOCUS), album = extras?.getString(MediaStore.EXTRA_MEDIA_ALBUM), - artist = extras?.getString(MediaStore.EXTRA_MEDIA_ARTIST) + artist = extras?.getString(MediaStore.EXTRA_MEDIA_ARTIST), ) } diff --git a/playback/src/test/kotlin/voice/playback/session/search/BookSearchHandlerTest.kt b/playback/src/test/kotlin/voice/playback/session/search/BookSearchHandlerTest.kt index 2f967750d1..40df803d29 100644 --- a/playback/src/test/kotlin/voice/playback/session/search/BookSearchHandlerTest.kt +++ b/playback/src/test/kotlin/voice/playback/session/search/BookSearchHandlerTest.kt @@ -82,7 +82,7 @@ class BookSearchHandlerTest { fun mediaFocusArtist() = runTest { val bookSearch = BookSearch( mediaFocus = MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE, - artist = bookToFind.content.author + artist = bookToFind.content.author, ) searchHandler.handle(bookSearch) @@ -95,15 +95,15 @@ class BookSearchHandlerTest { val bookToFind = bookToFind.copy( content = bookToFind.content.copy( author = null, - name = "The book of Tim" - ) + name = "The book of Tim", + ), ) coEvery { repo.all() } coAnswers { listOf(bookToFind) } val bookSearch = BookSearch( mediaFocus = MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE, query = "Tim", - artist = "Tim" + artist = "Tim", ) searchHandler.handle(bookSearch) @@ -117,7 +117,7 @@ class BookSearchHandlerTest { mediaFocus = MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE, artist = bookToFind.content.author, album = bookToFind.content.name, - query = null + query = null, ) searchHandler.handle(bookSearch) @@ -140,7 +140,7 @@ fun book(chapters: List): Book { isActive = true, lastPlayedAt = Instant.EPOCH, skipSilence = false, - id = BookId(UUID.randomUUID().toString()) + id = BookId(UUID.randomUUID().toString()), ), chapters = chapters, ) @@ -152,7 +152,7 @@ private fun chapter(): Chapter { name = UUID.randomUUID().toString(), duration = 10000, fileLastModified = Instant.EPOCH, - markData = emptyList() + markData = emptyList(), ) } diff --git a/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayController.kt b/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayController.kt index 3dfcda517e..665516c495 100644 --- a/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayController.kt +++ b/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayController.kt @@ -90,11 +90,11 @@ class BookPlayController(bundle: Bundle) : ViewBindingController val currentMark = book.currentChapter.markForPosition(book.content.positionInChapter) val hasMoreThanOneChapter = book.chapters.sumOf { it.chapterMarks.count() } > 1 @@ -61,7 +61,7 @@ class BookPlayViewModel duration = currentMark.durationMs.milliseconds, playedTime = (book.content.positionInChapter - currentMark.startMs).milliseconds, cover = book.content.cover, - skipSilence = book.content.skipSilence + skipSilence = book.content.skipSilence, ) } } @@ -104,7 +104,7 @@ class BookPlayViewModel bookmarkRepo.addBookmarkAtBookPosition( book = book, title = null, - setBySleepTimer = false + setBySleepTimer = false, ) _viewEffects.tryEmit(BookPlayViewEffect.BookmarkAdded) } diff --git a/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayViewState.kt b/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayViewState.kt index eb586de319..19421c7a45 100644 --- a/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayViewState.kt +++ b/playbackScreen/src/main/kotlin/voice/playbackScreen/BookPlayViewState.kt @@ -12,5 +12,5 @@ data class BookPlayViewState( val duration: Duration, val playing: Boolean, val cover: File?, - val skipSilence: Boolean + val skipSilence: Boolean, ) diff --git a/scanner/src/main/kotlin/voice/app/scanner/BookParser.kt b/scanner/src/main/kotlin/voice/app/scanner/BookParser.kt index d156524a89..e8291f9d66 100644 --- a/scanner/src/main/kotlin/voice/app/scanner/BookParser.kt +++ b/scanner/src/main/kotlin/voice/app/scanner/BookParser.kt @@ -64,7 +64,7 @@ class BookParser setBySleepTimer = legacyBookmark.setBySleepTimer, time = legacyBookmark.time, title = legacyBookmark.title, - ) + ), ) } } @@ -108,7 +108,7 @@ class BookParser cover = migrationSettings?.id?.let { File(application.filesDir, id.toString()) .takeIf { it.canRead() } - } + }, ).also { validateIntegrity(it, chapters) } diff --git a/scanner/src/main/kotlin/voice/app/scanner/ChapterParser.kt b/scanner/src/main/kotlin/voice/app/scanner/ChapterParser.kt index 6ca52f6ee2..94bee507b5 100644 --- a/scanner/src/main/kotlin/voice/app/scanner/ChapterParser.kt +++ b/scanner/src/main/kotlin/voice/app/scanner/ChapterParser.kt @@ -30,7 +30,7 @@ class ChapterParser duration = metaData.duration, fileLastModified = Instant.ofEpochMilli(file.lastModified()), name = metaData.chapterName, - markData = metaData.chapters + markData = metaData.chapters, ) } if (chapter != null) { diff --git a/scanner/src/main/kotlin/voice/app/scanner/CoverScanner.kt b/scanner/src/main/kotlin/voice/app/scanner/CoverScanner.kt index a6c076642c..5c61c15b21 100644 --- a/scanner/src/main/kotlin/voice/app/scanner/CoverScanner.kt +++ b/scanner/src/main/kotlin/voice/app/scanner/CoverScanner.kt @@ -65,7 +65,7 @@ class CoverScanner ffmpeg( input = chapter.id.toUri(), context = context, - command = listOf("-an", coverFile.absolutePath) + command = listOf("-an", coverFile.absolutePath), ) if (coverFile.exists() && coverFile.length() > 0) { coverSaver.setBookCover(coverFile, bookId = book.id) diff --git a/scanner/src/main/kotlin/voice/app/scanner/MediaAnalyzer.kt b/scanner/src/main/kotlin/voice/app/scanner/MediaAnalyzer.kt index 3c788baeff..746fe9f33f 100644 --- a/scanner/src/main/kotlin/voice/app/scanner/MediaAnalyzer.kt +++ b/scanner/src/main/kotlin/voice/app/scanner/MediaAnalyzer.kt @@ -36,8 +36,8 @@ class MediaAnalyzer "-show_entries", "format=duration", "-show_entries", "format_tags=artist,title,album", "-show_entries", "stream_tags=artist,title,album", - "-select_streams", "a" // only select the audio stream - ) + "-select_streams", "a", // only select the audio stream + ), ) if (result == null) { Logger.w("Unable to parse $uri.") @@ -61,9 +61,9 @@ class MediaAnalyzer chapters = parsed.chapters.mapIndexed { index, metaDataChapter -> MarkData( startMs = metaDataChapter.start.inWholeMilliseconds, - name = metaDataChapter.tags?.find(TagType.Title) ?: (index + 1).toString() + name = metaDataChapter.tags?.find(TagType.Title) ?: (index + 1).toString(), ) - } + }, ) } else { Logger.w("Unable to parse $uri") @@ -76,7 +76,7 @@ class MediaAnalyzer val chapterName: String, val author: String?, val bookName: String?, - val chapters: List + val chapters: List, ) } diff --git a/scanner/src/main/kotlin/voice/app/scanner/Metadata.kt b/scanner/src/main/kotlin/voice/app/scanner/Metadata.kt index 55a56b30b8..6c00cf0af8 100644 --- a/scanner/src/main/kotlin/voice/app/scanner/Metadata.kt +++ b/scanner/src/main/kotlin/voice/app/scanner/Metadata.kt @@ -43,14 +43,14 @@ fun Map.find(tagType: TagType): String? { @Serializable data class MetaDataStream( - val tags: Map? = null + val tags: Map? = null, ) @Serializable data class MetaDataChapter( @SerialName("start_time") private val startInSeconds: Double, - val tags: Map? = null + val tags: Map? = null, ) { val start: Duration get() = startInSeconds.seconds @@ -59,5 +59,5 @@ data class MetaDataChapter( @Serializable data class MetaDataFormat( val duration: Double? = null, - val tags: Map? = null + val tags: Map? = null, ) diff --git a/scanner/src/test/kotlin/voice/app/scanner/MediaScannerTest.kt b/scanner/src/test/kotlin/voice/app/scanner/MediaScannerTest.kt index 397e695b6d..b93582e55f 100644 --- a/scanner/src/test/kotlin/voice/app/scanner/MediaScannerTest.kt +++ b/scanner/src/test/kotlin/voice/app/scanner/MediaScannerTest.kt @@ -57,8 +57,8 @@ class MediaScannerTest { assertBookContents( BookContentView( id = BookId(book1.toUri()), - chapters = book1Chapters.drop(1) - ) + chapters = book1Chapters.drop(1), + ), ) } @@ -135,7 +135,7 @@ class MediaScannerTest { contentRepo = bookContentRepo, chapterParser = ChapterParser( chapterRepo = chapterRepo, - mediaAnalyzer = mediaAnalyzer + mediaAnalyzer = mediaAnalyzer, ), bookParser = BookParser( contentRepo = bookContentRepo, @@ -143,7 +143,7 @@ class MediaScannerTest { application = ApplicationProvider.getApplicationContext(), bookmarkDao = db.bookmarkDao(), legacyBookDao = db.legacyBookDao(), - ) + ), ) val bookRepo = BookRepository(chapterRepo, bookContentRepo) @@ -167,7 +167,7 @@ class MediaScannerTest { author = "Author", bookName = "Book Name", chapterName = "Chapter", - chapters = emptyList() + chapters = emptyList(), ) } } @@ -186,7 +186,7 @@ class MediaScannerTest { id = it.id, chapters = it.content.chapters.map { chapter -> chapter.toUri() - } + }, ) } .shouldContainExactlyInAnyOrder(expected.toList()) @@ -199,6 +199,6 @@ class MediaScannerTest { data class BookContentView( val id: BookId, - val chapters: List + val chapters: List, ) } diff --git a/settings/src/main/kotlin/voice/settings/SettingsViewModel.kt b/settings/src/main/kotlin/voice/settings/SettingsViewModel.kt index 52d88125c2..83cc2ab70b 100644 --- a/settings/src/main/kotlin/voice/settings/SettingsViewModel.kt +++ b/settings/src/main/kotlin/voice/settings/SettingsViewModel.kt @@ -32,7 +32,7 @@ class SettingsViewModel resumeOnReplugPref.flow, autoRewindAmountPref.flow, seekTimePref.flow, - dialog + dialog, ) { useDarkTheme, resumeOnReplug, autoRewindAmount, seekTime, dialog -> SettingsViewState( useDarkTheme = useDarkTheme, @@ -40,7 +40,7 @@ class SettingsViewModel resumeOnReplug = resumeOnReplug, seekTimeInSeconds = seekTime, autoRewindInSeconds = autoRewindAmount, - dialog = dialog + dialog = dialog, ) } } diff --git a/settings/src/main/kotlin/voice/settings/SettingsViewState.kt b/settings/src/main/kotlin/voice/settings/SettingsViewState.kt index 7e5e30d198..2d5e3f8dc8 100644 --- a/settings/src/main/kotlin/voice/settings/SettingsViewState.kt +++ b/settings/src/main/kotlin/voice/settings/SettingsViewState.kt @@ -6,7 +6,7 @@ data class SettingsViewState( val resumeOnReplug: Boolean, val seekTimeInSeconds: Int, val autoRewindInSeconds: Int, - val dialog: Dialog? + val dialog: Dialog?, ) { companion object { @@ -16,7 +16,7 @@ data class SettingsViewState( resumeOnReplug = false, seekTimeInSeconds = 0, autoRewindInSeconds = 0, - dialog = null + dialog = null, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/AutoRewindRow.kt b/settings/src/main/kotlin/voice/settings/views/AutoRewindRow.kt index fa0c4b65f1..f10d08c2af 100644 --- a/settings/src/main/kotlin/voice/settings/views/AutoRewindRow.kt +++ b/settings/src/main/kotlin/voice/settings/views/AutoRewindRow.kt @@ -26,10 +26,10 @@ internal fun AutoRewindRow(autoRewindInSeconds: Int, openAutoRewindDialog: () -> text = LocalContext.current.resources.getQuantityString( R.plurals.seconds, autoRewindInSeconds, - autoRewindInSeconds - ) + autoRewindInSeconds, + ), ) - } + }, ) } @@ -37,7 +37,7 @@ internal fun AutoRewindRow(autoRewindInSeconds: Int, openAutoRewindDialog: () -> internal fun AutoRewindAmountDialog( currentSeconds: Int, onSecondsConfirmed: (Int) -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { TimeSettingDialog( title = stringResource(R.string.pref_seek_time), @@ -46,6 +46,6 @@ internal fun AutoRewindAmountDialog( maxSeconds = 20, textPluralRes = R.plurals.seconds, onSecondsConfirmed = onSecondsConfirmed, - onDismiss = onDismiss + onDismiss = onDismiss, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/ContributeDialog.kt b/settings/src/main/kotlin/voice/settings/views/ContributeDialog.kt index e41673653c..2f37770d11 100644 --- a/settings/src/main/kotlin/voice/settings/views/ContributeDialog.kt +++ b/settings/src/main/kotlin/voice/settings/views/ContributeDialog.kt @@ -15,7 +15,7 @@ import voice.settings.R internal fun ContributeDialog( suggestionsClicked: () -> Unit, translationsClicked: () -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { AlertDialog( onDismissRequest = onDismiss, @@ -46,6 +46,6 @@ internal fun ContributeDialog( ) } }, - confirmButton = {} + confirmButton = {}, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/DarkThemeRow.kt b/settings/src/main/kotlin/voice/settings/views/DarkThemeRow.kt index 45efbec2c5..9ba59c8b0b 100644 --- a/settings/src/main/kotlin/voice/settings/views/DarkThemeRow.kt +++ b/settings/src/main/kotlin/voice/settings/views/DarkThemeRow.kt @@ -26,8 +26,8 @@ internal fun DarkThemeRow(useDarkTheme: Boolean, toggle: () -> Unit) { checked = useDarkTheme, onCheckedChange = { toggle() - } + }, ) - } + }, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/ResumeOnReplugRow.kt b/settings/src/main/kotlin/voice/settings/views/ResumeOnReplugRow.kt index eb253a2603..c6c261d6e6 100644 --- a/settings/src/main/kotlin/voice/settings/views/ResumeOnReplugRow.kt +++ b/settings/src/main/kotlin/voice/settings/views/ResumeOnReplugRow.kt @@ -14,7 +14,7 @@ import voice.settings.R @Composable internal fun ResumeOnReplugRow( resumeOnReplug: Boolean, - toggle: () -> Unit + toggle: () -> Unit, ) { ListItem( modifier = Modifier @@ -26,13 +26,13 @@ internal fun ResumeOnReplugRow( text = { Text( text = stringResource(R.string.pref_resume_on_replug), - style = MaterialTheme.typography.bodyLarge + style = MaterialTheme.typography.bodyLarge, ) }, secondaryText = { Text( text = stringResource(R.string.pref_resume_on_replug_hint), - style = MaterialTheme.typography.bodyMedium + style = MaterialTheme.typography.bodyMedium, ) }, trailing = { @@ -40,8 +40,8 @@ internal fun ResumeOnReplugRow( checked = resumeOnReplug, onCheckedChange = { toggle() - } + }, ) - } + }, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/SeekTimeRow.kt b/settings/src/main/kotlin/voice/settings/views/SeekTimeRow.kt index 9142961502..481bb2616d 100644 --- a/settings/src/main/kotlin/voice/settings/views/SeekTimeRow.kt +++ b/settings/src/main/kotlin/voice/settings/views/SeekTimeRow.kt @@ -26,10 +26,10 @@ internal fun SeekTimeRow(seekTimeInSeconds: Int, openSeekTimeDialog: () -> Unit) text = LocalContext.current.resources.getQuantityString( R.plurals.seconds, seekTimeInSeconds, - seekTimeInSeconds - ) + seekTimeInSeconds, + ), ) - } + }, ) } @@ -37,7 +37,7 @@ internal fun SeekTimeRow(seekTimeInSeconds: Int, openSeekTimeDialog: () -> Unit) internal fun SeekAmountDialog( currentSeconds: Int, onSecondsConfirmed: (Int) -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { TimeSettingDialog( title = stringResource(R.string.pref_seek_time), @@ -46,6 +46,6 @@ internal fun SeekAmountDialog( maxSeconds = 60, textPluralRes = R.plurals.seconds, onSecondsConfirmed = onSecondsConfirmed, - onDismiss = onDismiss + onDismiss = onDismiss, ) } diff --git a/settings/src/main/kotlin/voice/settings/views/Settings.kt b/settings/src/main/kotlin/voice/settings/views/Settings.kt index 072358858b..4329faeeff 100644 --- a/settings/src/main/kotlin/voice/settings/views/Settings.kt +++ b/settings/src/main/kotlin/voice/settings/views/Settings.kt @@ -37,7 +37,7 @@ private fun SettingsPreview() { resumeOnReplug = true, seekTimeInSeconds = 42, autoRewindInSeconds = 12, - dialog = null + dialog = null, ) VoiceTheme { Settings( @@ -54,7 +54,7 @@ private fun SettingsPreview() { override fun dismissDialog() {} override fun openSupport() {} override fun openTranslations() {} - } + }, ) } } @@ -75,25 +75,25 @@ private fun Settings(viewState: SettingsViewState, listener: SettingsListener) { content = { Icon( imageVector = Icons.Outlined.Favorite, - contentDescription = stringResource(R.string.pref_support_title) + contentDescription = stringResource(R.string.pref_support_title), ) - } + }, ) }, navigationIcon = { IconButton( onClick = { listener.close() - } + }, ) { Icon( imageVector = Icons.Outlined.Close, - contentDescription = stringResource(R.string.close) + contentDescription = stringResource(R.string.close), ) } - } + }, ) - } + }, ) { contentPadding -> Box(Modifier.padding(contentPadding)) { Column(Modifier.padding(vertical = 8.dp)) { @@ -129,7 +129,7 @@ fun Settings() { @Composable private fun Dialog( viewState: SettingsViewState, - listener: SettingsListener + listener: SettingsListener, ) { val dialog = viewState.dialog ?: return when (dialog) { @@ -137,21 +137,21 @@ private fun Dialog( ContributeDialog( suggestionsClicked = { listener.openSupport() }, translationsClicked = { listener.openTranslations() }, - onDismiss = { listener.dismissDialog() } + onDismiss = { listener.dismissDialog() }, ) } SettingsViewState.Dialog.AutoRewindAmount -> { AutoRewindAmountDialog( currentSeconds = viewState.autoRewindInSeconds, onSecondsConfirmed = listener::autoRewindAmountChanged, - onDismiss = listener::dismissDialog + onDismiss = listener::dismissDialog, ) } SettingsViewState.Dialog.SeekTime -> { SeekAmountDialog( currentSeconds = viewState.seekTimeInSeconds, onSecondsConfirmed = listener::seekAmountChanged, - onDismiss = listener::dismissDialog + onDismiss = listener::dismissDialog, ) } } diff --git a/settings/src/main/kotlin/voice/settings/views/TimeSettingDialog.kt b/settings/src/main/kotlin/voice/settings/views/TimeSettingDialog.kt index 6d4783d21d..c22291e607 100644 --- a/settings/src/main/kotlin/voice/settings/views/TimeSettingDialog.kt +++ b/settings/src/main/kotlin/voice/settings/views/TimeSettingDialog.kt @@ -22,7 +22,7 @@ fun TimeSettingDialog( minSeconds: Int, maxSeconds: Int, onSecondsConfirmed: (Int) -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { val sliderValue = remember { mutableStateOf(currentSeconds.toFloat()) } AlertDialog( @@ -36,15 +36,15 @@ fun TimeSettingDialog( LocalContext.current.resources.getQuantityString( textPluralRes, sliderValue.value.roundToInt(), - sliderValue.value.roundToInt() - ) + sliderValue.value.roundToInt(), + ), ) Slider( valueRange = minSeconds.toFloat()..maxSeconds.toFloat(), value = sliderValue.value, onValueChange = { sliderValue.value = it - } + }, ) } }, @@ -53,7 +53,7 @@ fun TimeSettingDialog( onClick = { onSecondsConfirmed(sliderValue.value.roundToInt()) onDismiss() - } + }, ) { Text(stringResource(R.string.dialog_confirm)) } @@ -62,10 +62,10 @@ fun TimeSettingDialog( TextButton( onClick = { onDismiss() - } + }, ) { Text(stringResource(R.string.dialog_cancel)) } - } + }, ) } diff --git a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimer.kt b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimer.kt index 454fb41ed3..d2aa436e7c 100644 --- a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimer.kt +++ b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimer.kt @@ -31,7 +31,7 @@ class SleepTimer private val shakeDetector: ShakeDetector, @Named(PrefKeys.SLEEP_TIME) private val sleepTimePref: Pref, - private val playerController: PlayerController + private val playerController: PlayerController, ) { private val scope = MainScope() diff --git a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogController.kt b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogController.kt index cda37b2a23..4090d7ee01 100644 --- a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogController.kt +++ b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogController.kt @@ -25,7 +25,7 @@ class SleepTimerDialogController(bundle: Bundle) : DialogController(bundle) { constructor(bookId: BookId) : this( Bundle().apply { putBookId(NI_BOOK_ID, bookId) - } + }, ) @Inject diff --git a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogViewModel.kt b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogViewModel.kt index 40d4d8ca1d..1fc466bc7f 100644 --- a/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogViewModel.kt +++ b/sleepTimer/src/main/kotlin/voice/sleepTimer/SleepTimerDialogViewModel.kt @@ -35,7 +35,7 @@ class SleepTimerDialogViewModel .map { selectedMinutes -> SleepTimerDialogViewState( selectedMinutes = selectedMinutes, - showFab = selectedMinutes > 0 + showFab = selectedMinutes > 0, ) } } @@ -68,7 +68,7 @@ class SleepTimerDialogViewModel bookmarkRepo.addBookmarkAtBookPosition( book = book, setBySleepTimer = true, - title = null + title = null, ) } sleepTimer.setActive(true) diff --git a/sleepTimer/src/test/kotlin/voice/sleepTimer/SleepTimerDialogViewModelTest.kt b/sleepTimer/src/test/kotlin/voice/sleepTimer/SleepTimerDialogViewModelTest.kt index 1c1773ae83..4cf66e6b23 100644 --- a/sleepTimer/src/test/kotlin/voice/sleepTimer/SleepTimerDialogViewModelTest.kt +++ b/sleepTimer/src/test/kotlin/voice/sleepTimer/SleepTimerDialogViewModelTest.kt @@ -41,7 +41,7 @@ class SleepTimerDialogViewModelTest { it.addBookmarkAtBookPosition( book = book, title = null, - setBySleepTimer = true + setBySleepTimer = true, ) } returns mockk() } @@ -50,7 +50,7 @@ class SleepTimerDialogViewModelTest { sleepTimer = sleepTimer, bookRepo = bookRepo, sleepTimePref = sleepTimePref, - dispatcherProvider = DispatcherProvider(scope.coroutineContext) + dispatcherProvider = DispatcherProvider(scope.coroutineContext), ) @Test @@ -74,7 +74,7 @@ class SleepTimerDialogViewModelTest { suspend fun expect(selectedMinutes: Int, showFab: Boolean = true) { awaitItem() shouldBe SleepTimerDialogViewState( selectedMinutes = selectedMinutes, - showFab = showFab + showFab = showFab, ) } expect(42) @@ -115,7 +115,7 @@ class SleepTimerDialogViewModelTest { private fun book( name: String = "TestBook", lastPlayedAtMillis: Long = 0L, - addedAtMillis: Long = 0L + addedAtMillis: Long = 0L, ): Book { val chapters = listOf( chapter(), @@ -134,7 +134,7 @@ private fun book( isActive = true, lastPlayedAt = Instant.ofEpochMilli(lastPlayedAtMillis), skipSilence = false, - id = BookId(UUID.randomUUID().toString()) + id = BookId(UUID.randomUUID().toString()), ), chapters = chapters, ) @@ -146,6 +146,6 @@ private fun chapter(): Chapter { duration = 5.minutes.inWholeMilliseconds, fileLastModified = Instant.EPOCH, markData = emptyList(), - name = "name" + name = "name", ) }