Skip to content

Commit

Permalink
Enable trailing commas.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulWoitaschek committed Aug 1, 2022
1 parent 4317014 commit a519361
Show file tree
Hide file tree
Showing 147 changed files with 511 additions and 499 deletions.
6 changes: 2 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/src/main/kotlin/voice/app/AppController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AppController : ComposeController() {
FolderPicker(
onCloseClick = {
navController.popBackStack()
}
},
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/kotlin/voice/app/features/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MainActivity : AppCompatActivity() {
from: Controller?,
isPush: Boolean,
container: ViewGroup,
handler: ControllerChangeHandler
handler: ControllerChangeHandler,
) {
from?.setOptionsMenuHidden(true)
}
Expand All @@ -85,11 +85,11 @@ class MainActivity : AppCompatActivity() {
from: Controller?,
isPush: Boolean,
container: ViewGroup,
handler: ControllerChangeHandler
handler: ControllerChangeHandler,
) {
from?.setOptionsMenuHidden(false)
}
}
},
)

lifecycleScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EditCoverDialogController(bundle: Bundle) : DialogController(bundle) {
constructor(args: Arguments) : this(
Bundle().apply {
putParcelable(NI_ARGS, args)
}
},
)

@Inject
Expand Down Expand Up @@ -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()

Expand All @@ -87,6 +87,6 @@ class EditCoverDialogController(bundle: Bundle) : DialogController(bundle) {
@Parcelize
data class Arguments(
val coverUri: Uri,
val bookId: BookId
val bookId: BookId,
) : Parcelable
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) {
constructor(bookId: BookId) : this(
Bundle().apply {
putBookId(NI_BOOK_ID, bookId)
}
},
)

init {
Expand All @@ -47,7 +47,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) {
BindingItem<SelectChapterRowBinding, ChapterMark>(
mark,
R.layout.select_chapter_row,
SelectChapterRowBinding::bind
SelectChapterRowBinding::bind,
) { data, position ->
root.setOnClickListener(listener)
@Suppress("SetTextI18n")
Expand All @@ -56,7 +56,7 @@ class SelectChapterDialog(bundle: Bundle) : DialogController(bundle) {
0,
0,
if (position == viewState.selectedIndex) R.drawable.ic_equalizer else 0,
0
0,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import voice.data.ChapterMark

data class SelectChapterViewState(
val chapters: List<ChapterMark>,
val selectedIndex: Int?
val selectedIndex: Int?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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)!!
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BookmarkView>() {

lateinit var bookId: BookId
Expand All @@ -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)
Expand Down Expand Up @@ -90,7 +90,7 @@ class BookmarkPresenter
val addedBookmark = bookmarkRepo.addBookmarkAtBookPosition(
book = book,
title = name,
setBySleepTimer = false
setBySleepTimer = false,
)
bookmarks.add(addedBookmark)
if (attached) renderView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -66,7 +66,7 @@ class EditBookmarkDialog(args: Bundle) : DialogController(args) {

operator fun <T> invoke(
target: T,
bookmark: Bookmark
bookmark: Bookmark,
): EditBookmarkDialog where T : Controller, T : Callback {
val args = Bundle().apply {
putBookmarkId(NI_BOOKMARK_ID, bookmark.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlin.time.Duration.Companion.minutes

class BookMarkHolder(
parent: ViewGroup,
private val listener: BookmarkClickListener
private val listener: BookmarkClickListener,
) : ViewBindingHolder<BookmarkRowLayoutBinding>(parent, BookmarkRowLayoutBinding::inflate) {

var boundBookmark: Bookmark? = null
Expand Down Expand Up @@ -51,7 +51,7 @@ class BookMarkHolder(
bookmark.addedAt.toEpochMilli(),
justNowThreshold.inWholeMilliseconds,
2.days.inWholeMilliseconds,
0
0,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BookMarkHolder>() {

private val bookmarks = ArrayList<Bookmark>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import voice.data.Bookmark
*/
class BookmarkDiffUtilCallback(
private val oldItems: List<Bookmark>,
private val newItems: List<Bookmark>
private val newItems: List<Bookmark>,
) : DiffUtil.Callback() {

override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CoverFromInternetController(bundle: Bundle) : ViewBindingController<ImageP
constructor(bookId: BookId) : this(
Bundle().apply {
putBookId(NI_BOOK_ID, bookId)
}
},
)

init {
Expand Down Expand Up @@ -75,7 +75,7 @@ class CoverFromInternetController(bundle: Bundle) : ViewBindingController<ImageP
view: WebView,
errorCode: Int,
description: String?,
failingUrl: String?
failingUrl: String?,
) {
view.loadUrl(originalUrl)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ class CoverFromInternetController(bundle: Bundle) : ViewBindingController<ImageP
left,
top,
width,
height
height,
)
bitmap.recycle()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import kotlin.properties.Delegates
class CropOverlay @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
defStyleAttr: Int = 0,
) : FrameLayout(
context,
attrs,
defStyleAttr
defStyleAttr,
) {

private val leftCircle = newCircle()
Expand All @@ -56,7 +56,7 @@ class CropOverlay @JvmOverloads constructor(
dragRect.squareInset(-max)
return max != 0f
}
}
},
)

var selectionOn: Boolean by Delegates.observable(false) { _, old, new ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BaseWidgetProvider : AppWidgetProvider() {
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray
appWidgetIds: IntArray,
) {
widgetUpdater.update()
}
Expand All @@ -30,7 +30,7 @@ class BaseWidgetProvider : AppWidgetProvider() {
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int,
newOptions: Bundle
newOptions: Bundle,
) {
widgetUpdater.update()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TriggerWidgetOnChange
private val currentBook: DataStore<BookId?>,
private val repo: BookRepository,
private val playStateManager: PlayStateManager,
private val widgetUpdater: WidgetUpdater
private val widgetUpdater: WidgetUpdater,
) {

fun init() {
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/kotlin/voice/app/features/widget/WidgetUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/voice/app/injection/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class App : Application(), PlaybackComponentFactoryProvider {
Coil.setImageLoader(
ImageLoader.Builder(this)
.addLastModifiedToFileCacheKey(false)
.build()
.build(),
)

DynamicColors.applyToActivitiesIfAvailable(this)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/voice/app/injection/AppComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import javax.inject.Singleton

@Singleton
@MergeComponent(
scope = AppScope::class
scope = AppScope::class,
)
interface AppComponent {

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/voice/app/injection/PrefsModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object PrefsModule {
return factory.create(
serializer = ListSerializer(UriSerializer),
fileName = "audiobookFolders",
defaultValue = emptyList()
defaultValue = emptyList(),
)
}

Expand All @@ -121,7 +121,7 @@ object PrefsModule {
return factory.create(
serializer = BookId.serializer().nullable,
fileName = "currentBook",
defaultValue = null
defaultValue = null,
)
}

Expand Down
Loading

0 comments on commit a519361

Please sign in to comment.