From 7d5647b0ba35fc16cc42fa0dbb0d000c40e871b8 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Wed, 21 Jan 2026 17:24:58 +0800 Subject: [PATCH] ktlint: Fix standard_argument-list-wrapping violations Signed-off-by: Aayush Gupta --- .editorconfig | 1 - .../newpipe/database/DatabaseMigrationTest.kt | 42 ++++-- .../schabi/newpipe/database/FeedDAOTest.kt | 21 ++- .../playlist/LocalPlaylistManagerTest.kt | 24 ++- .../newpipe/util/StreamItemAdapterTest.kt | 52 +++++-- .../org/schabi/newpipe/NewVersionWorker.kt | 12 +- .../org/schabi/newpipe/about/AboutActivity.kt | 137 +++++++++++++----- .../schabi/newpipe/about/LicenseFragment.kt | 3 +- .../newpipe/about/LicenseFragmentHelper.kt | 9 +- .../newpipe/database/feed/model/FeedEntity.kt | 8 +- .../feed/model/FeedGroupSubscriptionEntity.kt | 8 +- .../feed/model/FeedLastUpdatedEntity.kt | 4 +- .../database/stream/model/StreamEntity.kt | 8 +- .../main/java/org/schabi/newpipe/ktx/View.kt | 10 +- .../schabi/newpipe/local/feed/FeedFragment.kt | 15 +- .../feed/notifications/NotificationHelper.kt | 4 +- .../local/feed/service/FeedLoadManager.kt | 9 +- .../subscription/SubscriptionFragment.kt | 9 +- .../local/subscription/SubscriptionManager.kt | 3 +- .../subscription/dialog/FeedGroupDialog.kt | 9 +- .../dialog/FeedGroupDialogViewModel.kt | 8 +- .../player/mediabrowser/MediaBrowserImpl.kt | 3 +- .../org/schabi/newpipe/util/FilenameUtils.kt | 6 +- .../schabi/newpipe/util/ReleaseVersionUtil.kt | 3 +- .../views/player/PlayerFastSeekOverlay.kt | 6 +- .../newpipe/views/player/SecondsView.kt | 4 +- .../local/subscription/FeedGroupIconTest.kt | 3 +- .../settings/ImportAllCombinationsTest.kt | 7 +- 28 files changed, 306 insertions(+), 122 deletions(-) diff --git a/.editorconfig b/.editorconfig index 24476d4aa..62ebdafe2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,6 @@ ktlint_code_style = android_studio # https://pinterest.github.io/ktlint/latest/rules/standard/#function-naming ktlint_function_naming_ignore_when_annotated_with = Composable -ktlint_standard_argument-list-wrapping = disabled ktlint_standard_backing-property-naming = disabled ktlint_standard_chain-method-continuation = disabled ktlint_standard_class-signature = disabled diff --git a/app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt b/app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt index 4327271f4..fd551b7b8 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt @@ -176,28 +176,32 @@ class DatabaseMigrationTest { databaseInV7.run { insert( - "search_history", SQLiteDatabase.CONFLICT_FAIL, + "search_history", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", serviceId) put("search", defaultSearch1) } ) insert( - "search_history", SQLiteDatabase.CONFLICT_FAIL, + "search_history", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", serviceId) put("search", defaultSearch2) } ) insert( - "search_history", SQLiteDatabase.CONFLICT_FAIL, + "search_history", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", otherServiceId) put("search", defaultSearch1) } ) insert( - "search_history", SQLiteDatabase.CONFLICT_FAIL, + "search_history", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", otherServiceId) put("search", defaultSearch2) @@ -207,13 +211,17 @@ class DatabaseMigrationTest { } testHelper.runMigrationsAndValidate( - AppDatabase.DATABASE_NAME, Migrations.DB_VER_8, - true, Migrations.MIGRATION_7_8 + AppDatabase.DATABASE_NAME, + Migrations.DB_VER_8, + true, + Migrations.MIGRATION_7_8 ) testHelper.runMigrationsAndValidate( - AppDatabase.DATABASE_NAME, Migrations.DB_VER_9, - true, Migrations.MIGRATION_8_9 + AppDatabase.DATABASE_NAME, + Migrations.DB_VER_9, + true, + Migrations.MIGRATION_8_9 ) val migratedDatabaseV8 = getMigratedDatabase() @@ -235,7 +243,8 @@ class DatabaseMigrationTest { val remoteUid2: Long databaseInV8.run { localUid1 = insert( - "playlists", SQLiteDatabase.CONFLICT_FAIL, + "playlists", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("name", DEFAULT_NAME + "1") put("is_thumbnail_permanent", false) @@ -243,7 +252,8 @@ class DatabaseMigrationTest { } ) localUid2 = insert( - "playlists", SQLiteDatabase.CONFLICT_FAIL, + "playlists", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("name", DEFAULT_NAME + "2") put("is_thumbnail_permanent", false) @@ -251,25 +261,29 @@ class DatabaseMigrationTest { } ) delete( - "playlists", "uid = ?", + "playlists", + "uid = ?", Array(1) { localUid1 } ) remoteUid1 = insert( - "remote_playlists", SQLiteDatabase.CONFLICT_FAIL, + "remote_playlists", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", DEFAULT_SERVICE_ID) put("url", DEFAULT_URL) } ) remoteUid2 = insert( - "remote_playlists", SQLiteDatabase.CONFLICT_FAIL, + "remote_playlists", + SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply { put("service_id", DEFAULT_SECOND_SERVICE_ID) put("url", DEFAULT_SECOND_URL) } ) delete( - "remote_playlists", "uid = ?", + "remote_playlists", + "uid = ?", Array(1) { remoteUid2 } ) close() diff --git a/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt b/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt index 5216273a0..a61caad06 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt @@ -40,14 +40,21 @@ class FeedDAOTest { private val stream7 = StreamEntity(7, serviceId, "https://youtube.com/watch?v=7", "stream 7", StreamType.VIDEO_STREAM, 1000, "channel-4", "https://youtube.com/channel/4", "https://i.ytimg.com/vi/1/hqdefault.jpg", 100, "2023-08-10", OffsetDateTime.parse("2023-08-10T00:00:00Z")) private val allStreams = listOf( - stream1, stream2, stream3, stream4, stream5, stream6, stream7 + stream1, + stream2, + stream3, + stream4, + stream5, + stream6, + stream7 ) @Before fun createDb() { val context = ApplicationProvider.getApplicationContext() db = Room.inMemoryDatabaseBuilder( - context, AppDatabase::class.java + context, + AppDatabase::class.java ).build() feedDAO = db.feedDAO() streamDAO = db.streamDAO() @@ -64,7 +71,10 @@ class FeedDAOTest { fun testUnlinkStreamsOlderThan_KeepOne() { setupUnlinkDelete("2023-08-15T00:00:00Z") val streams = feedDAO.getStreams( - FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null + FeedGroupEntity.GROUP_ALL_ID, + includePlayed = true, + includePartiallyPlayed = true, + null ) .blockingGet() val allowedStreams = listOf(stream3, stream5, stream6, stream7) @@ -75,7 +85,10 @@ class FeedDAOTest { fun testUnlinkStreamsOlderThan_KeepMultiple() { setupUnlinkDelete("2023-08-01T00:00:00Z") val streams = feedDAO.getStreams( - FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null + FeedGroupEntity.GROUP_ALL_ID, + includePlayed = true, + includePartiallyPlayed = true, + null ) .blockingGet() val allowedStreams = listOf(stream3, stream4, stream5, stream6, stream7) diff --git a/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt b/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt index ce3aeb84a..ac9e84228 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt @@ -33,8 +33,12 @@ class LocalPlaylistManagerTest { fun createPlaylist() { val NEWPIPE_URL = "https://newpipe.net/" val stream = StreamEntity( - serviceId = 1, url = NEWPIPE_URL, title = "title", - streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader", + serviceId = 1, + url = NEWPIPE_URL, + title = "title", + streamType = StreamType.VIDEO_STREAM, + duration = 1, + uploader = "uploader", uploaderUrl = NEWPIPE_URL ) @@ -58,14 +62,22 @@ class LocalPlaylistManagerTest { @Test() fun createPlaylist_nonExistentStreamsAreUpserted() { val stream = StreamEntity( - serviceId = 1, url = "https://newpipe.net/", title = "title", - streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader", + serviceId = 1, + url = "https://newpipe.net/", + title = "title", + streamType = StreamType.VIDEO_STREAM, + duration = 1, + uploader = "uploader", uploaderUrl = "https://newpipe.net/" ) database.streamDAO().insert(stream) val upserted = StreamEntity( - serviceId = 1, url = "https://newpipe.net/2", title = "title2", - streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader", + serviceId = 1, + url = "https://newpipe.net/2", + title = "title2", + streamType = StreamType.VIDEO_STREAM, + duration = 1, + uploader = "uploader", uploaderUrl = "https://newpipe.net/" ) diff --git a/app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt b/app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt index da23bdfec..348612249 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt @@ -156,41 +156,51 @@ class StreamItemAdapterTest { helper.assertInvalidResponse(getResponse(mapOf(Pair("content-length", "mp3"))), 0) helper.assertInvalidResponse( - getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.png\""))), 1 + getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.png\""))), + 1 ) helper.assertInvalidResponse( - getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"data.csv\""))), 2 + getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"data.csv\""))), + 2 ) helper.assertInvalidResponse( - getResponse(mapOf(Pair("Content-Disposition", "form-data; filename=\"data.csv\""))), 3 + getResponse(mapOf(Pair("Content-Disposition", "form-data; filename=\"data.csv\""))), + 3 ) helper.assertInvalidResponse( - getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"fieldName\"; filename*=\"filename.jpg\""))), 4 + getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"fieldName\"; filename*=\"filename.jpg\""))), + 4 ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.ogg\""))), - 5, MediaFormat.OGG + 5, + MediaFormat.OGG ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "some-form-data; filename=\"audio.flac\""))), - 6, MediaFormat.FLAC + 6, + MediaFormat.FLAC ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.aiff\"; filename=\"audio.aiff\""))), - 7, MediaFormat.AIFF + 7, + MediaFormat.AIFF ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"alien?\"; filename*=UTF-8''%CE%B1%CE%BB%CE%B9%CF%B5%CE%BD.m4a"))), - 8, MediaFormat.M4A + 8, + MediaFormat.M4A ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.mp3\"; filename=\"audio.opus\"; filename*=UTF-8''alien.opus"))), - 9, MediaFormat.OPUS + 9, + MediaFormat.OPUS ) helper.assertValidResponse( getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.mp3\"; filename=\"audio.opus\"; filename*=\"UTF-8''alien.opus\""))), - 10, MediaFormat.OPUS + 10, + MediaFormat.OPUS ) } @@ -213,16 +223,24 @@ class StreamItemAdapterTest { helper.assertInvalidResponse(getResponse(mapOf()), 7) helper.assertValidResponse( - getResponse(mapOf(Pair("Content-Type", "audio/flac"))), 8, MediaFormat.FLAC + getResponse(mapOf(Pair("Content-Type", "audio/flac"))), + 8, + MediaFormat.FLAC ) helper.assertValidResponse( - getResponse(mapOf(Pair("Content-Type", "audio/wav"))), 9, MediaFormat.WAV + getResponse(mapOf(Pair("Content-Type", "audio/wav"))), + 9, + MediaFormat.WAV ) helper.assertValidResponse( - getResponse(mapOf(Pair("Content-Type", "audio/opus"))), 10, MediaFormat.OPUS + getResponse(mapOf(Pair("Content-Type", "audio/opus"))), + 10, + MediaFormat.OPUS ) helper.assertValidResponse( - getResponse(mapOf(Pair("Content-Type", "audio/aiff"))), 11, MediaFormat.AIFF + getResponse(mapOf(Pair("Content-Type", "audio/aiff"))), + 11, + MediaFormat.AIFF ) } @@ -345,7 +363,8 @@ class StreamItemAdapterTest { index: Int ) { assertFalse( - "invalid header returns valid value", retrieveMediaFormat(streams[index], response) + "invalid header returns valid value", + retrieveMediaFormat(streams[index], response) ) assertNull("Media format extracted although stated otherwise", wrapper.getFormat(index)) } @@ -359,7 +378,8 @@ class StreamItemAdapterTest { format: MediaFormat ) { assertTrue( - "header was not recognized", retrieveMediaFormat(streams[index], response) + "header was not recognized", + retrieveMediaFormat(streams[index], response) ) assertEquals("Wrong media format extracted", format, wrapper.getFormat(index)) } diff --git a/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt b/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt index 893aa8d1b..fb48d3f70 100644 --- a/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt +++ b/app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt @@ -46,7 +46,8 @@ class NewVersionWorker( // Show toast stating that the app is up-to-date if the update check was manual. ContextCompat.getMainExecutor(applicationContext).execute { Toast.makeText( - applicationContext, R.string.app_update_unavailable_toast, + applicationContext, + R.string.app_update_unavailable_toast, Toast.LENGTH_SHORT ).show() } @@ -58,7 +59,11 @@ class NewVersionWorker( val intent = Intent(Intent.ACTION_VIEW, apkLocationUrl?.toUri()) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) val pendingIntent = PendingIntentCompat.getActivity( - applicationContext, 0, intent, 0, false + applicationContext, + 0, + intent, + 0, + false ) val channelId = applicationContext.getString(R.string.app_update_notification_channel_id) val notificationBuilder = NotificationCompat.Builder(applicationContext, channelId) @@ -71,7 +76,8 @@ class NewVersionWorker( ) .setContentText( applicationContext.getString( - R.string.app_update_available_notification_text, versionName + R.string.app_update_available_notification_text, + versionName ) ) diff --git a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt index 0bed7ac60..cfb504200 100644 --- a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt +++ b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt @@ -116,85 +116,144 @@ class AboutActivity : AppCompatActivity() { */ private val SOFTWARE_COMPONENTS = arrayListOf( SoftwareComponent( - "ACRA", "2013", "Kevin Gaudin", - "https://github.com/ACRA/acra", StandardLicenses.APACHE2 + "ACRA", + "2013", + "Kevin Gaudin", + "https://github.com/ACRA/acra", + StandardLicenses.APACHE2 ), SoftwareComponent( - "AndroidX", "2005 - 2011", "The Android Open Source Project", - "https://developer.android.com/jetpack", StandardLicenses.APACHE2 + "AndroidX", + "2005 - 2011", + "The Android Open Source Project", + "https://developer.android.com/jetpack", + StandardLicenses.APACHE2 ), SoftwareComponent( - "ExoPlayer", "2014 - 2020", "Google, Inc.", - "https://github.com/google/ExoPlayer", StandardLicenses.APACHE2 + "ExoPlayer", + "2014 - 2020", + "Google, Inc.", + "https://github.com/google/ExoPlayer", + StandardLicenses.APACHE2 ), SoftwareComponent( - "GigaGet", "2014 - 2015", "Peter Cai", - "https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL3 + "GigaGet", + "2014 - 2015", + "Peter Cai", + "https://github.com/PaperAirplane-Dev-Team/GigaGet", + StandardLicenses.GPL3 ), SoftwareComponent( - "Groupie", "2016", "Lisa Wray", - "https://github.com/lisawray/groupie", StandardLicenses.MIT + "Groupie", + "2016", + "Lisa Wray", + "https://github.com/lisawray/groupie", + StandardLicenses.MIT ), SoftwareComponent( - "Android-State", "2018", "Evernote", - "https://github.com/Evernote/android-state", StandardLicenses.EPL1 + "Android-State", + "2018", + "Evernote", + "https://github.com/Evernote/android-state", + StandardLicenses.EPL1 ), SoftwareComponent( - "Bridge", "2021", "Livefront", - "https://github.com/livefront/bridge", StandardLicenses.APACHE2 + "Bridge", + "2021", + "Livefront", + "https://github.com/livefront/bridge", + StandardLicenses.APACHE2 ), SoftwareComponent( - "Jsoup", "2009 - 2020", "Jonathan Hedley", - "https://github.com/jhy/jsoup", StandardLicenses.MIT + "Jsoup", + "2009 - 2020", + "Jonathan Hedley", + "https://github.com/jhy/jsoup", + StandardLicenses.MIT ), SoftwareComponent( - "Markwon", "2019", "Dimitry Ivanov", - "https://github.com/noties/Markwon", StandardLicenses.APACHE2 + "Markwon", + "2019", + "Dimitry Ivanov", + "https://github.com/noties/Markwon", + StandardLicenses.APACHE2 ), SoftwareComponent( - "Material Components for Android", "2016 - 2020", "Google, Inc.", + "Material Components for Android", + "2016 - 2020", + "Google, Inc.", "https://github.com/material-components/material-components-android", StandardLicenses.APACHE2 ), SoftwareComponent( - "NewPipe Extractor", "2017 - 2020", "Christian Schabesberger", - "https://github.com/TeamNewPipe/NewPipeExtractor", StandardLicenses.GPL3 + "NewPipe Extractor", + "2017 - 2020", + "Christian Schabesberger", + "https://github.com/TeamNewPipe/NewPipeExtractor", + StandardLicenses.GPL3 ), SoftwareComponent( - "NoNonsense-FilePicker", "2016", "Jonas Kalderstam", - "https://github.com/spacecowboy/NoNonsense-FilePicker", StandardLicenses.MPL2 + "NoNonsense-FilePicker", + "2016", + "Jonas Kalderstam", + "https://github.com/spacecowboy/NoNonsense-FilePicker", + StandardLicenses.MPL2 ), SoftwareComponent( - "OkHttp", "2019", "Square, Inc.", - "https://square.github.io/okhttp/", StandardLicenses.APACHE2 + "OkHttp", + "2019", + "Square, Inc.", + "https://square.github.io/okhttp/", + StandardLicenses.APACHE2 ), SoftwareComponent( - "Picasso", "2013", "Square, Inc.", - "https://square.github.io/picasso/", StandardLicenses.APACHE2 + "Picasso", + "2013", + "Square, Inc.", + "https://square.github.io/picasso/", + StandardLicenses.APACHE2 ), SoftwareComponent( - "PrettyTime", "2012 - 2020", "Lincoln Baxter, III", - "https://github.com/ocpsoft/prettytime", StandardLicenses.APACHE2 + "PrettyTime", + "2012 - 2020", + "Lincoln Baxter, III", + "https://github.com/ocpsoft/prettytime", + StandardLicenses.APACHE2 ), SoftwareComponent( - "ProcessPhoenix", "2015", "Jake Wharton", - "https://github.com/JakeWharton/ProcessPhoenix", StandardLicenses.APACHE2 + "ProcessPhoenix", + "2015", + "Jake Wharton", + "https://github.com/JakeWharton/ProcessPhoenix", + StandardLicenses.APACHE2 ), SoftwareComponent( - "RxAndroid", "2015", "The RxAndroid authors", - "https://github.com/ReactiveX/RxAndroid", StandardLicenses.APACHE2 + "RxAndroid", + "2015", + "The RxAndroid authors", + "https://github.com/ReactiveX/RxAndroid", + StandardLicenses.APACHE2 ), SoftwareComponent( - "RxBinding", "2015", "Jake Wharton", - "https://github.com/JakeWharton/RxBinding", StandardLicenses.APACHE2 + "RxBinding", + "2015", + "Jake Wharton", + "https://github.com/JakeWharton/RxBinding", + StandardLicenses.APACHE2 ), SoftwareComponent( - "RxJava", "2016 - 2020", "RxJava Contributors", - "https://github.com/ReactiveX/RxJava", StandardLicenses.APACHE2 + "RxJava", + "2016 - 2020", + "RxJava Contributors", + "https://github.com/ReactiveX/RxJava", + StandardLicenses.APACHE2 ), SoftwareComponent( - "SearchPreference", "2018", "ByteHamster", - "https://github.com/ByteHamster/SearchPreference", StandardLicenses.MIT + "SearchPreference", + "2018", + "ByteHamster", + "https://github.com/ByteHamster/SearchPreference", + StandardLicenses.MIT ) ) } diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt index 240e2f42b..bd0632c13 100644 --- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt @@ -97,7 +97,8 @@ class LicenseFragment : Fragment() { .observeOn(AndroidSchedulers.mainThread()) .subscribe { formattedLicense -> val webViewData = Base64.encodeToString( - formattedLicense.toByteArray(), Base64.NO_PADDING + formattedLicense.toByteArray(), + Base64.NO_PADDING ) val webView = WebView(context) webView.loadData(webViewData, "text/html; charset=UTF-8", "base64") diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt index a2574ae86..32e4f812f 100644 --- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt +++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt @@ -28,13 +28,16 @@ fun getFormattedLicense(context: Context, license: License): String { fun getLicenseStylesheet(context: Context): String { val isLightTheme = ThemeHelper.isLightThemeSelected(context) val licenseBackgroundColor = getHexRGBColor( - context, if (isLightTheme) R.color.light_license_background_color else R.color.dark_license_background_color + context, + if (isLightTheme) R.color.light_license_background_color else R.color.dark_license_background_color ) val licenseTextColor = getHexRGBColor( - context, if (isLightTheme) R.color.light_license_text_color else R.color.dark_license_text_color + context, + if (isLightTheme) R.color.light_license_text_color else R.color.dark_license_text_color ) val youtubePrimaryColor = getHexRGBColor( - context, if (isLightTheme) R.color.light_youtube_primary_color else R.color.dark_youtube_primary_color + context, + if (isLightTheme) R.color.light_youtube_primary_color else R.color.dark_youtube_primary_color ) return "body{padding:12px 15px;margin:0;background:#$licenseBackgroundColor;color:#$licenseTextColor}" + "a[href]{color:#$youtubePrimaryColor}pre{white-space:pre-wrap}" diff --git a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedEntity.kt b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedEntity.kt index beeedc62b..86568bc90 100644 --- a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedEntity.kt @@ -19,13 +19,17 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity entity = StreamEntity::class, parentColumns = [StreamEntity.STREAM_ID], childColumns = [STREAM_ID], - onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE, deferred = true + onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.CASCADE, + deferred = true ), ForeignKey( entity = SubscriptionEntity::class, parentColumns = [SubscriptionEntity.SUBSCRIPTION_UID], childColumns = [SUBSCRIPTION_ID], - onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE, deferred = true + onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.CASCADE, + deferred = true ) ] ) diff --git a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedGroupSubscriptionEntity.kt b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedGroupSubscriptionEntity.kt index b114a734c..6dac3c89c 100644 --- a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedGroupSubscriptionEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedGroupSubscriptionEntity.kt @@ -18,14 +18,18 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity entity = FeedGroupEntity::class, parentColumns = [FeedGroupEntity.ID], childColumns = [GROUP_ID], - onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE, deferred = true + onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.CASCADE, + deferred = true ), ForeignKey( entity = SubscriptionEntity::class, parentColumns = [SubscriptionEntity.SUBSCRIPTION_UID], childColumns = [SUBSCRIPTION_ID], - onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE, deferred = true + onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.CASCADE, + deferred = true ) ] ) diff --git a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedLastUpdatedEntity.kt b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedLastUpdatedEntity.kt index 51c8c1afa..fc0ee6742 100644 --- a/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedLastUpdatedEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/feed/model/FeedLastUpdatedEntity.kt @@ -16,7 +16,9 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity entity = SubscriptionEntity::class, parentColumns = [SubscriptionEntity.SUBSCRIPTION_UID], childColumns = [SUBSCRIPTION_ID], - onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE, deferred = true + onDelete = ForeignKey.CASCADE, + onUpdate = ForeignKey.CASCADE, + deferred = true ) ] ) diff --git a/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt b/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt index 4bb34d7b0..067f666b6 100644 --- a/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt @@ -86,8 +86,12 @@ data class StreamEntity( @Ignore constructor(item: PlayQueueItem) : this( - serviceId = item.serviceId, url = item.url, title = item.title, - streamType = item.streamType, duration = item.duration, uploader = item.uploader, + serviceId = item.serviceId, + url = item.url, + title = item.title, + streamType = item.streamType, + duration = item.duration, + uploader = item.uploader, uploaderUrl = item.uploaderUrl, thumbnailUrl = ImageStrategy.imageListToDbUrl(item.thumbnails) ) diff --git a/app/src/main/java/org/schabi/newpipe/ktx/View.kt b/app/src/main/java/org/schabi/newpipe/ktx/View.kt index f6d08d143..432b974cb 100644 --- a/app/src/main/java/org/schabi/newpipe/ktx/View.kt +++ b/app/src/main/java/org/schabi/newpipe/ktx/View.kt @@ -43,8 +43,14 @@ fun View.animate( if (DEBUG) { val id = runCatching { resources.getResourceEntryName(id) }.getOrDefault(id.toString()) val msg = String.format( - "%8s → [%s:%s] [%s %s:%s] execOnEnd=%s", enterOrExit, - javaClass.simpleName, id, animationType, duration, delay, execOnEnd + "%8s → [%s:%s] [%s %s:%s] execOnEnd=%s", + enterOrExit, + javaClass.simpleName, + id, + animationType, + duration, + delay, + execOnEnd ) Log.d(TAG, "animate(): $msg") } diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index b4b23a503..930998c67 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -390,8 +390,13 @@ class FeedFragment : BaseStateFragment() { if (item is StreamItem && !isRefreshing) { val stream = item.streamWithState.stream NavigationHelper.openVideoDetailFragment( - requireContext(), fm, - stream.serviceId, stream.url, stream.title, null, false + requireContext(), + fm, + stream.serviceId, + stream.url, + stream.title, + null, + false ) } } @@ -503,7 +508,8 @@ class FeedFragment : BaseStateFragment() { ) { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) val isFastFeedModeEnabled = sharedPreferences.getBoolean( - getString(R.string.feed_use_dedicated_fetch_method_key), false + getString(R.string.feed_use_dedicated_fetch_method_key), + false ) val builder = AlertDialog.Builder(requireContext()) @@ -538,7 +544,8 @@ class FeedFragment : BaseStateFragment() { private fun updateRelativeTimeViews() { updateRefreshViewState() groupAdapter.notifyItemRangeChanged( - 0, groupAdapter.itemCount, + 0, + groupAdapter.itemCount, StreamItem.UPDATE_RELATIVE_TIME ) } diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt index 7ce117fcd..d2d16a755 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt @@ -42,7 +42,9 @@ class NotificationHelper(val context: Context) { fun displayNewStreamsNotifications(data: FeedUpdateInfo) { val newStreams = data.newStreams val summary = context.resources.getQuantityString( - R.plurals.new_streams, newStreams.size, newStreams.size + R.plurals.new_streams, + newStreams.size, + newStreams.size ) val summaryBuilder = NotificationCompat.Builder( context, diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadManager.kt b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadManager.kt index c60214564..3090a92d4 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadManager.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadManager.kt @@ -87,7 +87,8 @@ class FeedLoadManager(private val context: Context) { ) GROUP_NOTIFICATION_ENABLED -> feedDatabaseManager.outdatedSubscriptionsWithNotificationMode( - outdatedThreshold, NotificationMode.ENABLED + outdatedThreshold, + NotificationMode.ENABLED ) else -> feedDatabaseManager.outdatedSubscriptionsForGroup(groupId, outdatedThreshold) @@ -188,7 +189,8 @@ class FeedLoadManager(private val context: Context) { val channelInfo = getChannelInfo( subscriptionEntity.serviceId, - subscriptionEntity.url, true + subscriptionEntity.url, + true ) .onErrorReturn(storeOriginalErrorAndRethrow) .blockingGet() @@ -218,7 +220,8 @@ class FeedLoadManager(private val context: Context) { ) { val infoItemsPage = getMoreChannelTabItems( subscriptionEntity.serviceId, - linkHandler, channelTabInfo.nextPage + linkHandler, + channelTabInfo.nextPage ) .blockingGet() diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 5a3753dd0..28abe4cf9 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -346,7 +346,10 @@ class SubscriptionFragment : BaseStateFragment() { val actions = DialogInterface.OnClickListener { _, i -> when (i) { 0 -> ShareUtils.shareText( - requireContext(), selectedItem.name, selectedItem.url, selectedItem.thumbnails + requireContext(), + selectedItem.name, + selectedItem.url, + selectedItem.thumbnails ) 1 -> ShareUtils.openUrlInBrowser(requireContext(), selectedItem.url) @@ -380,7 +383,9 @@ class SubscriptionFragment : BaseStateFragment() { private val listenerChannelItem = object : OnClickGesture { override fun selected(selectedItem: ChannelInfoItem) = NavigationHelper.openChannelFragment( fm, - selectedItem.serviceId, selectedItem.url, selectedItem.name + selectedItem.serviceId, + selectedItem.url, + selectedItem.name ) override fun held(selectedItem: ChannelInfoItem) = showLongTapDialog(selectedItem) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionManager.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionManager.kt index 57ff2a401..bc7afe602 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionManager.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionManager.kt @@ -37,7 +37,8 @@ class SubscriptionManager(context: Context) { filterQuery.isNotEmpty() -> { return if (showOnlyUngrouped) { subscriptionTable.getSubscriptionsOnlyUngroupedFiltered( - currentGroupId, filterQuery + currentGroupId, + filterQuery ) } else { subscriptionTable.getSubscriptionsFiltered(filterQuery) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index 094b1c17f..ab856278f 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -178,8 +178,10 @@ class FeedGroupDialog : DialogFragment(), BackPressable { itemAnimator = null adapter = subscriptionGroupAdapter layoutManager = GridLayoutManager( - requireContext(), subscriptionGroupAdapter.spanCount, - RecyclerView.VERTICAL, false + requireContext(), + subscriptionGroupAdapter.spanCount, + RecyclerView.VERTICAL, + false ).apply { spanSizeLookup = subscriptionGroupAdapter.spanSizeLookup } @@ -387,7 +389,8 @@ class FeedGroupDialog : DialogFragment(), BackPressable { val selectedCount = this.selectedSubscriptions.size val selectedCountText = resources.getQuantityString( R.plurals.feed_group_dialog_selection_count, - selectedCount, selectedCount + selectedCount, + selectedCount ) feedGroupCreateBinding.selectedSubscriptionCountView.text = selectedCountText feedGroupCreateBinding.subscriptionsHeaderInfo.text = selectedCountText diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialogViewModel.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialogViewModel.kt index 292bda394..d8eac2492 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialogViewModel.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialogViewModel.kt @@ -55,7 +55,8 @@ class FeedGroupDialogViewModel( private var subscriptionsDisposable = Flowable .combineLatest( - subscriptionsFlowable, feedDatabaseManager.subscriptionIdsForGroup(groupId) + subscriptionsFlowable, + feedDatabaseManager.subscriptionIdsForGroup(groupId) ) { t1: List, t2: List -> t1 to t2.toSet() } .subscribeOn(Schedulers.io()) .subscribe(mutableSubscriptionsLiveData::postValue) @@ -125,7 +126,10 @@ class FeedGroupDialogViewModel( ) = viewModelFactory { initializer { FeedGroupDialogViewModel( - context.applicationContext, groupId, initialQuery, initialShowOnlyUngrouped + context.applicationContext, + groupId, + initialQuery, + initialShowOnlyUngrouped ) } } diff --git a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserImpl.kt b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserImpl.kt index 1e1a2a113..6b59f683a 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserImpl.kt +++ b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserImpl.kt @@ -90,7 +90,8 @@ class MediaBrowserImpl( val extras = Bundle() extras.putBoolean( - MediaConstants.BROWSER_SERVICE_EXTRAS_KEY_SEARCH_SUPPORTED, true + MediaConstants.BROWSER_SERVICE_EXTRAS_KEY_SEARCH_SUPPORTED, + true ) return MediaBrowserServiceCompat.BrowserRoot(ID_ROOT, extras) } diff --git a/app/src/main/java/org/schabi/newpipe/util/FilenameUtils.kt b/app/src/main/java/org/schabi/newpipe/util/FilenameUtils.kt index 6a2d23d21..1237a984b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/FilenameUtils.kt +++ b/app/src/main/java/org/schabi/newpipe/util/FilenameUtils.kt @@ -31,10 +31,12 @@ object FilenameUtils { val defaultCharset = context.getString(R.string.default_file_charset_value) val replacementChar = sharedPreferences.getStringSafe( - context.getString(R.string.settings_file_replacement_character_key), "_" + context.getString(R.string.settings_file_replacement_character_key), + "_" ) val selectedCharset = sharedPreferences.getStringSafe( - context.getString(R.string.settings_file_charset_key), "" + context.getString(R.string.settings_file_charset_key), + "" ).ifEmpty { defaultCharset } val charset = when (selectedCharset) { diff --git a/app/src/main/java/org/schabi/newpipe/util/ReleaseVersionUtil.kt b/app/src/main/java/org/schabi/newpipe/util/ReleaseVersionUtil.kt index fef7e83c0..bc3849384 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ReleaseVersionUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/util/ReleaseVersionUtil.kt @@ -26,7 +26,8 @@ object ReleaseVersionUtil { PackageInfoCompat.hasSignatures(app.packageManager, app.packageName, certificates, false) } catch (e: PackageManager.NameNotFoundException) { createNotification( - app, ErrorInfo(e, UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not find package info") + app, + ErrorInfo(e, UserAction.CHECK_FOR_NEW_APP_VERSION, "Could not find package info") ) false } diff --git a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt index cfbb4141c..08b7df6af 100644 --- a/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt +++ b/app/src/main/java/org/schabi/newpipe/views/player/PlayerFastSeekOverlay.kt @@ -115,8 +115,10 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) : clone(rootConstraintLayout) clear(secondsView.id, if (forward) START else END) connect( - secondsView.id, if (forward) END else START, - PARENT_ID, if (forward) END else START + secondsView.id, + if (forward) END else START, + PARENT_ID, + if (forward) END else START ) secondsView.startAnimation() applyTo(rootConstraintLayout) diff --git a/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt b/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt index 8472653fb..5e4885129 100644 --- a/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt +++ b/app/src/main/java/org/schabi/newpipe/views/player/SecondsView.kt @@ -29,7 +29,9 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context var seconds: Int = 0 set(value) { binding.tvSeconds.text = context.resources.getQuantityString( - R.plurals.seconds, value, value + R.plurals.seconds, + value, + value ) field = value } diff --git a/app/src/test/java/org/schabi/newpipe/local/subscription/FeedGroupIconTest.kt b/app/src/test/java/org/schabi/newpipe/local/subscription/FeedGroupIconTest.kt index 2fc44d9b7..6db72255b 100644 --- a/app/src/test/java/org/schabi/newpipe/local/subscription/FeedGroupIconTest.kt +++ b/app/src/test/java/org/schabi/newpipe/local/subscription/FeedGroupIconTest.kt @@ -15,7 +15,8 @@ class FeedGroupIconTest { assertEquals( "Gap between ids detected (current item: ${currentIcon.name} - ${currentIcon.id} → should be: $shouldBeId)", - shouldBeId, currentIcon.id + shouldBeId, + currentIcon.id ) } } diff --git a/app/src/test/java/org/schabi/newpipe/settings/ImportAllCombinationsTest.kt b/app/src/test/java/org/schabi/newpipe/settings/ImportAllCombinationsTest.kt index 628c41da4..c7f53f3ac 100644 --- a/app/src/test/java/org/schabi/newpipe/settings/ImportAllCombinationsTest.kt +++ b/app/src/test/java/org/schabi/newpipe/settings/ImportAllCombinationsTest.kt @@ -161,8 +161,11 @@ class ImportAllCombinationsTest { } catch (e: Throwable) { failedAssertions.add( FailData( - containsDb, containsSer, containsJson, - filename, e + containsDb, + containsSer, + containsJson, + filename, + e ) ) }