Skip to content

Commit b33af62

Browse files
committed
Fix formatting with new ktlint rules
1 parent 0b8b7d3 commit b33af62

20 files changed

Lines changed: 165 additions & 151 deletions

app/src/main/java/org/schabi/newpipe/error/UserAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ enum class UserAction(val message: String) {
4040
GETTING_MAIN_SCREEN_TAB("getting main screen tab"),
4141
PLAY_ON_POPUP("play on popup"),
4242
SUBSCRIPTIONS("loading subscriptions"),
43-
LONG_PRESS_MENU_ACTION("long press menu action"),
43+
LONG_PRESS_MENU_ACTION("long press menu action")
4444
}

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,10 @@ class VideoDetailFragment :
14251425

14261426
if (info.viewCount >= 0) {
14271427
binding.detailViewCountView.text = Localization.localizeViewCount(
1428-
activity, false, info.streamType, info.viewCount
1428+
activity,
1429+
false,
1430+
info.streamType,
1431+
info.viewCount
14291432
)
14301433
binding.detailViewCountView.visibility = View.VISIBLE
14311434
} else {

app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ class FeedFragment : BaseStateFragment<FeedState>() {
425425
// just in case
426426
Log.w(TAG, "Could not get full list of items on long press")
427427
return@fromStreamEntity SinglePlayQueue(item.stream.toStreamInfoItem())
428-
},
429-
),
428+
}
429+
)
430430
)
431431
return true
432432
}

app/src/main/java/org/schabi/newpipe/ui/GestureModifiers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fun Modifier.detectDragGestures(
7979
}
8080
handleDragGestureChange(
8181
change.position.toIntOffset(),
82-
change.positionChange(),
82+
change.positionChange()
8383
)
8484
change.consume()
8585
}

app/src/main/java/org/schabi/newpipe/ui/Toolbar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fun NavigationIcon() {
3939
Icon(
4040
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
4141
contentDescription = stringResource(R.string.back),
42-
modifier = Modifier.padding(horizontal = SizeTokens.SpacingExtraSmall),
42+
modifier = Modifier.padding(horizontal = SizeTokens.SpacingExtraSmall)
4343
)
4444
}
4545

app/src/main/java/org/schabi/newpipe/ui/components/common/ScaffoldWithToolbar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fun ScaffoldWithToolbar(
4242
IconButton(onClick = onBackClick) {
4343
Icon(
4444
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
45-
contentDescription = stringResource(R.string.back),
45+
contentDescription = stringResource(R.string.back)
4646
)
4747
}
4848
},

app/src/main/java/org/schabi/newpipe/ui/components/items/stream/StreamListItem.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import org.schabi.newpipe.ui.theme.AppTheme
3636
fun StreamListItem(
3737
stream: StreamInfoItem,
3838
showProgress: Boolean,
39-
onClick: (StreamInfoItem) -> Unit = {},
39+
onClick: (StreamInfoItem) -> Unit = {}
4040
) {
4141
var showLongPressMenu by rememberSaveable { mutableStateOf(false) }
4242

@@ -81,7 +81,7 @@ fun StreamListItem(
8181
longPressable = LongPressable.fromStreamInfoItem(stream),
8282
// TODO queueFromHere: allow playing the whole list starting from one stream
8383
longPressActions = LongPressAction.fromStreamInfoItem(stream, null),
84-
onDismissRequest = { showLongPressMenu = false },
84+
onDismissRequest = { showLongPressMenu = false }
8585
)
8686
}
8787
}

app/src/main/java/org/schabi/newpipe/ui/components/menu/LongPressAction.kt

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ data class LongPressAction(
6060
val type: Type,
6161
@MainThread
6262
val action: suspend (context: Context) -> Unit,
63-
val enabled: (isPlayerRunning: Boolean) -> Boolean = { true },
63+
val enabled: (isPlayerRunning: Boolean) -> Boolean = { true }
6464
) {
6565
enum class Type(
6666
/**
@@ -69,7 +69,7 @@ data class LongPressAction(
6969
*/
7070
val id: Int,
7171
@StringRes val label: Int,
72-
val icon: ImageVector,
72+
val icon: ImageVector
7373
) {
7474
Enqueue(0, R.string.enqueue, Icons.Default.AddToQueue),
7575
EnqueueNext(1, R.string.enqueue_next_stream, Icons.Default.QueuePlayNext),
@@ -92,15 +92,15 @@ data class LongPressAction(
9292
UnsetPlaylistThumbnail(18, R.string.unset_playlist_thumbnail, Icons.Default.HideImage),
9393
Unsubscribe(19, R.string.unsubscribe, Icons.Default.Delete),
9494
ShowDetails(20, R.string.play_queue_stream_detail, Icons.Default.Info),
95-
Remove(21, R.string.play_queue_remove, Icons.Default.Delete),
95+
Remove(21, R.string.play_queue_remove, Icons.Default.Delete)
9696
;
9797

9898
// TODO allow actions to return disposables
9999
// TODO add actions that use the whole list the item belongs to (see wholeListQueue)
100100

101101
fun buildAction(
102102
enabled: (isPlayerRunning: Boolean) -> Boolean = { true },
103-
action: suspend (context: Context) -> Unit,
103+
action: suspend (context: Context) -> Unit
104104
) = LongPressAction(this, action, enabled)
105105

106106
companion object {
@@ -109,7 +109,7 @@ data class LongPressAction(
109109
val DefaultEnabledActions: List<Type> = listOf(
110110
ShowDetails, Enqueue, EnqueueNext, Background, Popup, BackgroundFromHere, Download,
111111
AddToPlaylist, Share, OpenInBrowser, MarkAsWatched, Delete,
112-
Rename, SetAsPlaylistThumbnail, UnsetPlaylistThumbnail, Unsubscribe, Remove,
112+
Rename, SetAsPlaylistThumbnail, UnsetPlaylistThumbnail, Unsubscribe, Remove
113113
)
114114
}
115115
}
@@ -133,7 +133,7 @@ data class LongPressAction(
133133
},
134134
Type.Play.buildAction { context ->
135135
NavigationHelper.playOnMainPlayer(context, queue(context), false)
136-
},
136+
}
137137
)
138138
}
139139

@@ -147,7 +147,7 @@ data class LongPressAction(
147147
},
148148
Type.PlayFromHere.buildAction { context ->
149149
NavigationHelper.playOnMainPlayer(context, queueFromHere(), false)
150-
},
150+
}
151151
)
152152
}
153153

@@ -158,7 +158,7 @@ data class LongPressAction(
158158
},
159159
Type.OpenInBrowser.buildAction { context ->
160160
ShareUtils.openUrlInBrowser(context, item.url)
161-
},
161+
}
162162
)
163163
}
164164

@@ -169,7 +169,7 @@ data class LongPressAction(
169169
},
170170
Type.OpenInBrowser.buildAction { context ->
171171
ShareUtils.openUrlInBrowser(context, url)
172-
},
172+
}
173173
)
174174
}
175175

@@ -200,13 +200,16 @@ data class LongPressAction(
200200
},
201201
Type.ShowChannelDetails.buildAction { context ->
202202
val uploaderUrl = fetchUploaderUrlIfSparse(
203-
context, item.serviceId, item.url, item.uploaderUrl
203+
context,
204+
item.serviceId,
205+
item.url,
206+
item.uploaderUrl
204207
)
205208
NavigationHelper.openChannelFragment(
206209
context.findFragmentActivity().supportFragmentManager,
207210
item.serviceId,
208211
uploaderUrl,
209-
item.uploaderName,
212+
item.uploaderName
210213
)
211214
},
212215
Type.MarkAsWatched.buildAction { context ->
@@ -216,7 +219,7 @@ data class LongPressAction(
216219
},
217220
Type.PlayWithKodi.buildAction { context ->
218221
KoreUtils.playWithKore(context, item.url.toUri())
219-
},
222+
}
220223
)
221224
}
222225

@@ -227,7 +230,7 @@ data class LongPressAction(
227230
@JvmStatic
228231
fun fromStreamInfoItem(
229232
item: StreamInfoItem,
230-
queueFromHere: (() -> PlayQueue)?,
233+
queueFromHere: (() -> PlayQueue)?
231234
/* TODO isKodiEnabled: Boolean, */
232235
): List<LongPressAction> {
233236
return buildPlayerActionList { context -> fetchItemInfoIfSparse(context, item) } +
@@ -239,7 +242,7 @@ data class LongPressAction(
239242
@JvmStatic
240243
fun fromStreamEntity(
241244
item: StreamEntity,
242-
queueFromHere: (() -> PlayQueue)?,
245+
queueFromHere: (() -> PlayQueue)?
243246
): List<LongPressAction> {
244247
// TODO decide if it's fine to just convert to StreamInfoItem here (it poses an
245248
// unnecessary dependency on the extractor, when we want to just look at data; maybe
@@ -251,38 +254,43 @@ data class LongPressAction(
251254
fun fromPlayQueueItem(
252255
item: PlayQueueItem,
253256
playQueueFromWhichToDelete: PlayQueue,
254-
showDetails: Boolean,
257+
showDetails: Boolean
255258
): List<LongPressAction> {
256259
// TODO decide if it's fine to just convert to StreamInfoItem here (it poses an
257260
// unnecessary dependency on the extractor, when we want to just look at data; maybe
258261
// using something like LongPressable would work)
259262
val streamInfoItem = item.toStreamInfoItem()
260263
return buildShareActionList(streamInfoItem) +
261-
buildAdditionalStreamActionList(streamInfoItem) +
262-
if (showDetails) {
263-
listOf(
264-
Type.ShowDetails.buildAction { context ->
265-
// playQueue is null since we don't want any queue change
266-
NavigationHelper.openVideoDetail(
267-
context, item.serviceId, item.url, item.title, null, false
268-
)
269-
}
270-
)
271-
} else {
272-
listOf()
273-
} +
264+
buildAdditionalStreamActionList(streamInfoItem) +
265+
if (showDetails) {
274266
listOf(
275-
Type.Remove.buildAction {
276-
val index = playQueueFromWhichToDelete.indexOf(item)
277-
playQueueFromWhichToDelete.remove(index)
267+
Type.ShowDetails.buildAction { context ->
268+
// playQueue is null since we don't want any queue change
269+
NavigationHelper.openVideoDetail(
270+
context,
271+
item.serviceId,
272+
item.url,
273+
item.title,
274+
null,
275+
false
276+
)
278277
}
279278
)
279+
} else {
280+
listOf()
281+
} +
282+
listOf(
283+
Type.Remove.buildAction {
284+
val index = playQueueFromWhichToDelete.indexOf(item)
285+
playQueueFromWhichToDelete.remove(index)
286+
}
287+
)
280288
}
281289

282290
@JvmStatic
283291
fun fromStreamStatisticsEntry(
284292
item: StreamStatisticsEntry,
285-
queueFromHere: (() -> PlayQueue)?,
293+
queueFromHere: (() -> PlayQueue)?
286294
): List<LongPressAction> {
287295
return fromStreamEntity(item.streamEntity, queueFromHere) +
288296
listOf(
@@ -304,7 +312,7 @@ data class LongPressAction(
304312
queueFromHere: (() -> PlayQueue)?,
305313
// TODO possibly embed these two actions here
306314
onDelete: Runnable,
307-
onSetAsPlaylistThumbnail: Runnable,
315+
onSetAsPlaylistThumbnail: Runnable
308316
): List<LongPressAction> {
309317
return fromStreamEntity(item.streamEntity, queueFromHere) +
310318
listOf(
@@ -318,7 +326,7 @@ data class LongPressAction(
318326
item: PlaylistMetadataEntry,
319327
onRename: Runnable,
320328
onDelete: Runnable,
321-
unsetPlaylistThumbnail: Runnable?,
329+
unsetPlaylistThumbnail: Runnable?
322330
): List<LongPressAction> {
323331
return listOf(
324332
Type.Rename.buildAction { onRename.run() },
@@ -332,7 +340,7 @@ data class LongPressAction(
332340
@JvmStatic
333341
fun fromPlaylistRemoteEntity(
334342
item: PlaylistRemoteEntity,
335-
onDelete: Runnable,
343+
onDelete: Runnable
336344
): List<LongPressAction> {
337345
return buildPlayerActionList { PlaylistPlayQueue(item.serviceId, item.url) } +
338346
buildShareActionList(
@@ -341,14 +349,14 @@ data class LongPressAction(
341349
item.thumbnailUrl
342350
) +
343351
listOf(
344-
Type.Delete.buildAction { onDelete.run() },
352+
Type.Delete.buildAction { onDelete.run() }
345353
)
346354
}
347355

348356
@JvmStatic
349357
fun fromChannelInfoItem(
350358
item: ChannelInfoItem,
351-
onUnsubscribe: Runnable?,
359+
onUnsubscribe: Runnable?
352360
): List<LongPressAction> {
353361
return buildPlayerActionList { ChannelTabPlayQueue(item.serviceId, item.url) } +
354362
buildShareActionList(item) +
@@ -358,7 +366,7 @@ data class LongPressAction(
358366
context.findFragmentActivity().supportFragmentManager,
359367
item.serviceId,
360368
item.url,
361-
item.name,
369+
item.name
362370
)
363371
},
364372
onUnsubscribe?.let { r -> Type.Unsubscribe.buildAction { r.run() } }

0 commit comments

Comments
 (0)