Skip to content

Commit e955bee

Browse files
Update Kotlin to 2.0, update dependencies and fix issues
1 parent eaac7f3 commit e955bee

8 files changed

Lines changed: 21 additions & 34 deletions

File tree

app/build.gradle

Lines changed: 5 additions & 8 deletions
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 {
@@ -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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,8 @@ private void handleCookiesFromUrl(@Nullable final String url) {
185185
final int abuseEnd = url.indexOf("+path");
186186

187187
try {
188-
String abuseCookie = url.substring(abuseStart + 13, abuseEnd);
189-
abuseCookie = Utils.decodeUrlUtf8(abuseCookie);
190-
handleCookies(abuseCookie);
191-
} catch (IllegalArgumentException | StringIndexOutOfBoundsException e) {
188+
handleCookies(Utils.decodeUrlUtf8(url.substring(abuseStart + 13, abuseEnd)));
189+
} catch (final StringIndexOutOfBoundsException e) {
192190
if (MainActivity.DEBUG) {
193191
Log.e(TAG, "handleCookiesFromUrl: invalid google abuse starting at "
194192
+ abuseStart + " and ending at " + abuseEnd + " for url " + url, e);

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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 5 additions & 20 deletions
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,7 +29,6 @@
3029

3130
import java.io.File;
3231
import java.io.IOException;
33-
import java.net.URI;
3432

3533
public class DownloadSettingsFragment extends BasePreferenceFragment {
3634
public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true;
@@ -107,28 +105,15 @@ private void updatePreferencesSummary() {
107105

108106
private void showPathInSummary(final String prefKey, @StringRes final int defaultString,
109107
final Preference target) {
110-
String rawUri = defaultPreferences.getString(prefKey, null);
111-
if (rawUri == null || rawUri.isEmpty()) {
108+
final Uri uri = Uri.parse(defaultPreferences.getString(prefKey, ""));
109+
if (uri.equals(Uri.EMPTY)) {
112110
target.setSummary(getString(defaultString));
113111
return;
114112
}
115113

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

134119
private boolean isFileUri(final String path) {

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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)