Skip to content

Commit 08f5c1a

Browse files
committed
Merge remote-tracking branch 'newpipe/refactor' into extended-refactor
2 parents 8aab002 + c1bdffd commit 08f5c1a

File tree

216 files changed

+5019
-3426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+5019
-3426
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ captures/
1010
*.class
1111
app/debug/
1212
app/release/
13+
.kotlin/
1314

1415
# vscode / eclipse files
1516
*.classpath

app/build.gradle

+121-90
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import com.android.tools.profgen.ArtProfileKt
22
import com.android.tools.profgen.ArtProfileSerializer
33
import com.android.tools.profgen.DexFile
4+
import com.mikepenz.aboutlibraries.plugin.DuplicateMode
45

56
plugins {
6-
id "com.android.application"
7-
id "kotlin-android"
8-
id "kotlin-kapt"
9-
id "kotlin-parcelize"
10-
id "checkstyle"
11-
id "org.sonarqube" version "4.0.0.2929"
7+
alias libs.plugins.android.application
8+
alias libs.plugins.kotlin.android
9+
alias libs.plugins.kotlin.compose
10+
alias libs.plugins.kotlin.kapt
11+
alias libs.plugins.kotlin.parcelize
12+
alias libs.plugins.checkstyle
13+
alias libs.plugins.sonarqube
14+
alias libs.plugins.hilt
15+
alias libs.plugins.aboutlibraries
1216
}
1317

1418
android {
@@ -104,6 +108,7 @@ android {
104108

105109
buildFeatures {
106110
viewBinding true
111+
compose true
107112
buildConfig true
108113
}
109114

@@ -125,23 +130,6 @@ android {
125130
}
126131
}
127132

128-
ext {
129-
checkstyleVersion = '10.12.1'
130-
131-
androidxLifecycleVersion = '2.6.2'
132-
androidxRoomVersion = '2.6.1'
133-
androidxWorkVersion = '2.8.1'
134-
135-
stateSaverVersion = '1.4.1'
136-
exoPlayerVersion = '2.18.7'
137-
googleAutoServiceVersion = '1.1.1'
138-
groupieVersion = '2.10.1'
139-
markwonVersion = '4.6.2'
140-
141-
leakCanaryVersion = '2.12'
142-
stethoVersion = '1.6.0'
143-
}
144-
145133
configurations {
146134
checkstyle
147135
ktlint
@@ -151,7 +139,7 @@ checkstyle {
151139
getConfigDirectory().set(rootProject.file("checkstyle"))
152140
ignoreFailures false
153141
showViolations true
154-
toolVersion = checkstyleVersion
142+
toolVersion = libs.versions.checkstyle.get()
155143
}
156144

157145
tasks.register('runCheckstyle', Checkstyle) {
@@ -193,11 +181,13 @@ tasks.register('formatKtlint', JavaExec) {
193181
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
194182
}
195183

184+
apply from: 'check-dependencies.gradle'
185+
196186
afterEvaluate {
197187
if (!System.properties.containsKey('skipFormatKtlint')) {
198188
preDebugBuild.dependsOn formatKtlint
199189
}
200-
preDebugBuild.dependsOn runCheckstyle, runKtlint
190+
preDebugBuild.dependsOn runCheckstyle, runKtlint, checkDependenciesOrder
201191
}
202192

203193
sonar {
@@ -208,9 +198,20 @@ sonar {
208198
}
209199
}
210200

201+
kapt {
202+
correctErrorTypes true
203+
}
204+
205+
aboutLibraries {
206+
// note: offline mode prevents the plugin from fetching licenses at build time, which would be
207+
// harmful for reproducible builds
208+
offlineMode = true
209+
duplicationMode = DuplicateMode.MERGE
210+
}
211+
211212
dependencies {
212213
/** Desugaring **/
213-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
214+
coreLibraryDesugaring libs.desugar.jdk.libs.nio
214215

215216
/** NewPipe libraries **/
216217
// You can use a local version by uncommenting a few lines in settings.gradle
@@ -222,109 +223,139 @@ dependencies {
222223
// the corresponding commit hash, since JitPack is sometimes buggy
223224
implementation 'com.github.MaintainTeam:LastPipeExtractor:6bf7594fbc59ba2c6372b71addbe31aa2e33118f'
224225
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
226+
// implementation libs.teamnewpipe.nanojson
227+
// implementation libs.teamnewpipe.newpipe.extractor
228+
// implementation libs.teamnewpipe.nononsense.filepicker
225229

226230
/** Checkstyle **/
227-
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
228-
ktlint 'com.pinterest:ktlint:0.45.2'
231+
checkstyle libs.tools.checkstyle
232+
ktlint libs.tools.ktlint
229233

230234
/** Kotlin **/
231-
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
235+
implementation libs.kotlin.stdlib
232236

233237
/** AndroidX **/
234-
implementation 'androidx.appcompat:appcompat:1.6.1'
235-
implementation 'androidx.cardview:cardview:1.0.0'
236-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
237-
implementation 'androidx.core:core-ktx:1.12.0'
238-
implementation 'androidx.documentfile:documentfile:1.0.1'
239-
implementation 'androidx.fragment:fragment-ktx:1.6.2'
240-
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}"
241-
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}"
242-
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
243-
implementation 'androidx.media:media:1.7.0'
244-
implementation 'androidx.preference:preference:1.2.1'
245-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
246-
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
247-
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
248-
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
249-
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
250-
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
251-
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
252-
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
253-
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
254-
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
255-
implementation 'com.google.android.material:material:1.11.0'
256-
implementation "androidx.webkit:webkit:1.9.0"
238+
implementation libs.androidx.appcompat
239+
implementation libs.androidx.cardview
240+
implementation libs.androidx.constraintlayout
241+
implementation libs.androidx.core.ktx
242+
implementation libs.androidx.documentfile
243+
implementation libs.androidx.fragment.compose
244+
implementation libs.androidx.lifecycle.livedata
245+
implementation libs.androidx.lifecycle.viewmodel
246+
implementation libs.androidx.localbroadcastmanager
247+
implementation libs.androidx.media
248+
implementation libs.androidx.preference
249+
implementation libs.androidx.recyclerview
250+
implementation libs.androidx.room.runtime
251+
implementation libs.androidx.room.rxjava3
252+
kapt libs.androidx.room.compiler
253+
implementation libs.androidx.swiperefreshlayout
254+
implementation libs.androidx.work.runtime
255+
implementation libs.androidx.work.rxjava3
256+
implementation libs.androidx.material
257+
implementation libs.androidx.webkit
257258

258259
/** Third-party libraries **/
259260
// Instance state boilerplate elimination
260-
implementation 'com.github.livefront:bridge:v2.0.2'
261-
implementation "com.evernote:android-state:$stateSaverVersion"
262-
kapt "com.evernote:android-state-processor:$stateSaverVersion"
261+
implementation libs.livefront.bridge
262+
implementation libs.android.state
263+
kapt libs.android.state.processor
263264

264265
// HTML parser
265-
implementation "org.jsoup:jsoup:1.17.2"
266+
implementation libs.jsoup
266267

267268
// HTTP client
268-
implementation "com.squareup.okhttp3:okhttp:4.12.0"
269+
implementation libs.okhttp
269270

270271
// Media player
271-
implementation "com.google.android.exoplayer:exoplayer-core:${exoPlayerVersion}"
272-
implementation "com.google.android.exoplayer:exoplayer-dash:${exoPlayerVersion}"
273-
implementation "com.google.android.exoplayer:exoplayer-database:${exoPlayerVersion}"
274-
implementation "com.google.android.exoplayer:exoplayer-datasource:${exoPlayerVersion}"
275-
implementation "com.google.android.exoplayer:exoplayer-hls:${exoPlayerVersion}"
276-
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:${exoPlayerVersion}"
277-
implementation "com.google.android.exoplayer:exoplayer-ui:${exoPlayerVersion}"
278-
implementation "com.google.android.exoplayer:extension-mediasession:${exoPlayerVersion}"
272+
implementation libs.exoplayer.core
273+
implementation libs.exoplayer.dash
274+
implementation libs.exoplayer.database
275+
implementation libs.exoplayer.datasource
276+
implementation libs.exoplayer.hls
277+
implementation libs.exoplayer.smoothstreaming
278+
implementation libs.exoplayer.ui
279+
implementation libs.extension.mediasession
279280

280281
// Metadata generator for service descriptors
281-
compileOnly "com.google.auto.service:auto-service-annotations:${googleAutoServiceVersion}"
282-
kapt "com.google.auto.service:auto-service:${googleAutoServiceVersion}"
282+
compileOnly libs.auto.service
283+
kapt libs.auto.service.kapt
283284

284285
// Manager for complex RecyclerView layouts
285-
implementation "com.github.lisawray.groupie:groupie:${groupieVersion}"
286-
implementation "com.github.lisawray.groupie:groupie-viewbinding:${groupieVersion}"
286+
implementation libs.lisawray.groupie
287+
implementation libs.lisawray.groupie.viewbinding
287288

288289
// Image loading
289-
//noinspection GradleDependency --> 2.8 is the last version, not 2.71828!
290-
implementation "com.squareup.picasso:picasso:2.8"
290+
implementation libs.coil.compose
291+
implementation libs.coil.network.okhttp
291292

292293
// Markdown library for Android
293-
implementation "io.noties.markwon:core:${markwonVersion}"
294-
implementation "io.noties.markwon:linkify:${markwonVersion}"
294+
implementation libs.markwon.core
295+
implementation libs.markwon.linkify
295296

296297
// Crash reporting
297-
implementation "ch.acra:acra-core:5.11.3"
298+
implementation libs.acra.core
298299

299300
// Properly restarting
300-
implementation 'com.jakewharton:process-phoenix:2.1.2'
301+
implementation libs.process.phoenix
301302

302303
// Reactive extensions for Java VM
303-
implementation "io.reactivex.rxjava3:rxjava:3.1.8"
304-
implementation "io.reactivex.rxjava3:rxandroid:3.0.2"
304+
implementation libs.rxjava3.rxjava
305+
implementation libs.rxjava3.rxandroid
305306
// RxJava binding APIs for Android UI widgets
306-
implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0"
307+
implementation libs.rxbinding4.rxbinding
307308

308309
// Date and time formatting
309-
implementation "org.ocpsoft.prettytime:prettytime:5.0.8.Final"
310+
implementation libs.prettytime
311+
312+
// Jetpack Compose
313+
implementation(platform(libs.androidx.compose.bom))
314+
implementation libs.androidx.compose.material3
315+
implementation libs.androidx.compose.adaptive
316+
implementation libs.androidx.activity.compose
317+
implementation libs.androidx.compose.ui.tooling.preview
318+
implementation libs.androidx.lifecycle.viewmodel.compose
319+
implementation libs.androidx.compose.ui.text // Needed for parsing HTML to AnnotatedString
320+
implementation libs.androidx.compose.material.icons.extended
321+
322+
// Jetpack Compose related dependencies
323+
implementation libs.androidx.paging.compose
324+
implementation libs.androidx.navigation.compose
325+
326+
// Coroutines interop
327+
implementation libs.kotlinx.coroutines.rx3
328+
329+
// Library loading for About screen
330+
implementation libs.aboutlibraries.compose.m3
331+
332+
// Hilt
333+
implementation libs.hilt.android
334+
kapt(libs.hilt.compiler)
335+
336+
// Scroll
337+
implementation libs.lazycolumnscrollbar
310338

311339
/** Debugging **/
312340
// Memory leak detection
313-
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
314-
debugImplementation "com.squareup.leakcanary:plumber-android:${leakCanaryVersion}"
315-
debugImplementation "com.squareup.leakcanary:leakcanary-android-core:${leakCanaryVersion}"
341+
debugImplementation libs.leakcanary.object.watcher
342+
debugImplementation libs.leakcanary.plumber.android
343+
debugImplementation libs.leakcanary.android.core
316344
// Debug bridge for Android
317-
debugImplementation "com.facebook.stetho:stetho:${stethoVersion}"
318-
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
345+
debugImplementation libs.stetho
346+
debugImplementation libs.stetho.okhttp3
347+
348+
// Jetpack Compose
349+
debugImplementation libs.androidx.compose.ui.tooling
319350

320351
/** Testing **/
321-
testImplementation 'junit:junit:4.13.2'
322-
testImplementation 'org.mockito:mockito-core:5.6.0'
352+
testImplementation libs.junit
353+
testImplementation libs.mockito.core
323354

324-
androidTestImplementation "androidx.test.ext:junit:1.1.5"
325-
androidTestImplementation "androidx.test:runner:1.5.2"
326-
androidTestImplementation "androidx.room:room-testing:${androidxRoomVersion}"
327-
androidTestImplementation "org.assertj:assertj-core:3.24.2"
355+
androidTestImplementation libs.androidx.junit
356+
androidTestImplementation libs.androidx.runner
357+
androidTestImplementation libs.androidx.room.testing
358+
androidTestImplementation libs.assertj.core
328359
}
329360

330361
static String getGitWorkingBranch() {

app/check-dependencies.gradle

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
tasks.register('checkDependenciesOrder') {
2+
group = 'verification'
3+
description = 'Checks that each section in libs.versions.toml is sorted alphabetically'
4+
5+
def tomlFile = file('../gradle/libs.versions.toml')
6+
7+
doLast {
8+
if (!tomlFile.exists()) {
9+
throw new GradleException('TOML file not found')
10+
}
11+
12+
def lines = tomlFile.readLines()
13+
def nonSortedBlocks = []
14+
def currentBlock = []
15+
def prevLine = ''
16+
def prevIndex = 0
17+
18+
lines.eachWithIndex { line, lineIndex ->
19+
if (line.trim() && !line.startsWith('#')) {
20+
if (line.startsWith('[')) {
21+
prevLine = ''
22+
} else {
23+
def currIndex = lineIndex + 1
24+
if (prevLine > line) {
25+
if (currentBlock && currentBlock[-1] == "${prevIndex}: ${prevLine}") {
26+
currentBlock.add("${currIndex}: ${line}")
27+
} else {
28+
if (!currentBlock.isEmpty()) {
29+
nonSortedBlocks.add(currentBlock)
30+
currentBlock = []
31+
}
32+
currentBlock.add("${prevIndex}: ${prevLine}")
33+
currentBlock.add("${currIndex}: ${line}")
34+
}
35+
}
36+
prevLine = line
37+
prevIndex = lineIndex + 1
38+
}
39+
}
40+
}
41+
42+
if (!currentBlock.isEmpty()) {
43+
nonSortedBlocks.add(currentBlock)
44+
throw new GradleException("The following lines were not sorted:\n" +
45+
nonSortedBlocks.collect { it.join("\n") }.join("\n\n"))
46+
}
47+
}
48+
}

app/src/main/AndroidManifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
android:exported="false"
7878
android:label="@string/settings" />
7979

80+
<activity
81+
android:name=".settings.SettingsV2Activity"
82+
android:exported="true"
83+
android:label="@string/settings" />
84+
8085
<activity
8186
android:name=".about.AboutActivity"
8287
android:exported="false"

0 commit comments

Comments
 (0)