Skip to content

Commit 10dd571

Browse files
Update Kotlin to 2.0, update dependencies and fix issues
1 parent b2748cc commit 10dd571

File tree

8 files changed

+23
-40
lines changed

8 files changed

+23
-40
lines changed

app/build.gradle

+6-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
id "kotlin-parcelize"
1010
id "checkstyle"
1111
id "org.sonarqube" version "4.0.0.2929"
12+
id "org.jetbrains.kotlin.plugin.compose" version "${kotlin_version}"
1213
}
1314

1415
android {
@@ -104,10 +105,6 @@ android {
104105
'META-INF/COPYRIGHT']
105106
}
106107
}
107-
108-
composeOptions {
109-
kotlinCompilerExtensionVersion = "1.5.14"
110-
}
111108
}
112109

113110
ext {
@@ -203,7 +200,7 @@ dependencies {
203200
// name and the commit hash with the commit hash of the (pushed) commit you want to test
204201
// This works thanks to JitPack: https://jitpack.io/
205202
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
206-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.24.1'
203+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.24.2'
207204
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
208205

209206
/** Checkstyle **/
@@ -290,13 +287,13 @@ dependencies {
290287

291288
// Jetpack Compose
292289
implementation(platform('androidx.compose:compose-bom:2024.06.00'))
293-
implementation 'androidx.compose.material3:material3:1.3.0-beta04'
290+
implementation 'androidx.compose.material3:material3:1.3.0-beta05'
294291
implementation 'androidx.activity:activity-compose'
295292
implementation 'androidx.compose.ui:ui-tooling-preview'
296-
implementation 'androidx.compose.ui:ui-text:1.7.0-beta04' // Needed for parsing HTML to AnnotatedString
293+
implementation 'androidx.compose.ui:ui-text:1.7.0-beta06' // Needed for parsing HTML to AnnotatedString
297294
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
298-
implementation 'androidx.paging:paging-compose:3.3.0'
299-
implementation 'com.github.nanihadesuka:LazyColumnScrollbar:2.1.0'
295+
implementation 'androidx.paging:paging-compose:3.3.1'
296+
implementation 'com.github.nanihadesuka:LazyColumnScrollbar:2.2.0'
300297

301298
/** Debugging **/
302299
// Memory leak detection

app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.schabi.newpipe.extractor.utils.Utils;
2828
import org.schabi.newpipe.util.ThemeHelper;
2929

30-
import java.io.UnsupportedEncodingException;
31-
3230
/*
3331
* Created by beneth <[email protected]> on 06.12.16.
3432
*
@@ -187,14 +185,11 @@ private void handleCookiesFromUrl(@Nullable final String url) {
187185
final int abuseEnd = url.indexOf("+path");
188186

189187
try {
190-
String abuseCookie = url.substring(abuseStart + 13, abuseEnd);
191-
abuseCookie = Utils.decodeUrlUtf8(abuseCookie);
192-
handleCookies(abuseCookie);
193-
} catch (UnsupportedEncodingException | StringIndexOutOfBoundsException e) {
188+
handleCookies(Utils.decodeUrlUtf8(url.substring(abuseStart + 13, abuseEnd)));
189+
} catch (final StringIndexOutOfBoundsException e) {
194190
if (MainActivity.DEBUG) {
195-
e.printStackTrace();
196191
Log.d(TAG, "handleCookiesFromUrl: invalid google abuse starting at "
197-
+ abuseStart + " and ending at " + abuseEnd + " for url " + url);
192+
+ abuseStart + " and ending at " + abuseEnd + " for url " + url, e);
198193
}
199194
}
200195
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
202202
// Menu
203203
// /////////////////////////////////////////////////////////////////////////
204204

205+
@Deprecated("Deprecated in Java")
205206
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
206207
super.onCreateOptionsMenu(menu, inflater)
207208

@@ -212,6 +213,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
212213
inflater.inflate(R.menu.menu_feed_fragment, menu)
213214
}
214215

216+
@Deprecated("Deprecated in Java")
215217
override fun onOptionsItemSelected(item: MenuItem): Boolean {
216218
if (item.itemId == R.id.menu_item_feed_help) {
217219
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
@@ -253,7 +255,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
253255
viewModel.getShowFutureItemsFromPreferences()
254256
)
255257

256-
AlertDialog.Builder(context!!)
258+
AlertDialog.Builder(requireContext())
257259
.setTitle(R.string.feed_hide_streams_title)
258260
.setMultiChoiceItems(dialogItems, checkedDialogItems) { _, which, isChecked ->
259261
checkedDialogItems[which] = isChecked
@@ -267,6 +269,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
267269
.show()
268270
}
269271

272+
@Deprecated("Deprecated in Java")
270273
override fun onDestroyOptionsMenu() {
271274
super.onDestroyOptionsMenu()
272275
activity?.supportActionBar?.subtitle = null

app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
129129
// Menu
130130
// ////////////////////////////////////////////////////////////////////////
131131

132+
@Deprecated("Deprecated in Java")
132133
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
133134
super.onCreateOptionsMenu(menu, inflater)
134135

app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
9494

9595
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
9696
return object : Dialog(requireActivity(), theme) {
97+
@Deprecated("Deprecated in Java")
9798
override fun onBackPressed() {
9899
if (!this@FeedGroupDialog.onBackPressed()) {
99100
super.onBackPressed()

app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java

+5-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.schabi.newpipe.settings;
22

3-
import static org.schabi.newpipe.extractor.utils.Utils.decodeUrlUtf8;
43
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
54

65
import android.app.Activity;
@@ -30,8 +29,6 @@
3029

3130
import java.io.File;
3231
import java.io.IOException;
33-
import java.io.UnsupportedEncodingException;
34-
import java.net.URI;
3532

3633
public class DownloadSettingsFragment extends BasePreferenceFragment {
3734
public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true;
@@ -108,28 +105,15 @@ private void updatePreferencesSummary() {
108105

109106
private void showPathInSummary(final String prefKey, @StringRes final int defaultString,
110107
final Preference target) {
111-
String rawUri = defaultPreferences.getString(prefKey, null);
112-
if (rawUri == null || rawUri.isEmpty()) {
108+
final Uri uri = Uri.parse(defaultPreferences.getString(prefKey, ""));
109+
if (uri.equals(Uri.EMPTY)) {
113110
target.setSummary(getString(defaultString));
114111
return;
115112
}
116113

117-
if (rawUri.charAt(0) == File.separatorChar) {
118-
target.setSummary(rawUri);
119-
return;
120-
}
121-
if (rawUri.startsWith(ContentResolver.SCHEME_FILE)) {
122-
target.setSummary(new File(URI.create(rawUri)).getPath());
123-
return;
124-
}
125-
126-
try {
127-
rawUri = decodeUrlUtf8(rawUri);
128-
} catch (final UnsupportedEncodingException e) {
129-
// nothing to do
130-
}
131-
132-
target.setSummary(rawUri);
114+
final String summary = ContentResolver.SCHEME_FILE.equals(uri.getScheme())
115+
? uri.getPath() : uri.toString();
116+
target.setSummary(summary);
133117
}
134118

135119
private boolean isFileUri(final String path) {

app/src/main/java/org/schabi/newpipe/settings/notifications/NotificationModeConfigFragment.kt

+2
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ class NotificationModeConfigFragment : Fragment() {
7777
super.onDestroy()
7878
}
7979

80+
@Deprecated("Deprecated in Java")
8081
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
8182
super.onCreateOptionsMenu(menu, inflater)
8283
inflater.inflate(R.menu.menu_notifications_channels, menu)
8384
}
8485

86+
@Deprecated("Deprecated in Java")
8587
override fun onOptionsItemSelected(item: MenuItem): Boolean {
8688
return when (item.itemId) {
8789
R.id.action_toggle_all -> {

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.9.24'
4+
ext.kotlin_version = '2.0.0'
55
repositories {
66
google()
77
mavenCentral()

0 commit comments

Comments
 (0)