diff --git a/app/build.gradle b/app/build.gradle index c516f8ce2..09cb1f5eb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,7 @@ plugins { id "kotlin-parcelize" id "checkstyle" id "org.sonarqube" version "4.0.0.2929" + id "org.jetbrains.kotlin.plugin.compose" version "${kotlin_version}" } android { @@ -104,10 +105,6 @@ android { 'META-INF/COPYRIGHT'] } } - - composeOptions { - kotlinCompilerExtensionVersion = "1.5.14" - } } ext { @@ -290,13 +287,13 @@ dependencies { // Jetpack Compose implementation(platform('androidx.compose:compose-bom:2024.06.00')) - implementation 'androidx.compose.material3:material3:1.3.0-beta04' + implementation 'androidx.compose.material3:material3:1.3.0-beta05' implementation 'androidx.activity:activity-compose' implementation 'androidx.compose.ui:ui-tooling-preview' - implementation 'androidx.compose.ui:ui-text:1.7.0-beta04' // Needed for parsing HTML to AnnotatedString + implementation 'androidx.compose.ui:ui-text:1.7.0-beta06' // Needed for parsing HTML to AnnotatedString implementation 'androidx.lifecycle:lifecycle-viewmodel-compose' - implementation 'androidx.paging:paging-compose:3.3.0' - implementation 'com.github.nanihadesuka:LazyColumnScrollbar:2.1.0' + implementation 'androidx.paging:paging-compose:3.3.1' + implementation 'com.github.nanihadesuka:LazyColumnScrollbar:2.2.0' /** Debugging **/ // Memory leak detection diff --git a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java index 42ef261a1..51a0ff1e6 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java @@ -185,10 +185,8 @@ public class ReCaptchaActivity extends AppCompatActivity { final int abuseEnd = url.indexOf("+path"); try { - String abuseCookie = url.substring(abuseStart + 13, abuseEnd); - abuseCookie = Utils.decodeUrlUtf8(abuseCookie); - handleCookies(abuseCookie); - } catch (IllegalArgumentException | StringIndexOutOfBoundsException e) { + handleCookies(Utils.decodeUrlUtf8(url.substring(abuseStart + 13, abuseEnd))); + } catch (final StringIndexOutOfBoundsException e) { if (MainActivity.DEBUG) { Log.e(TAG, "handleCookiesFromUrl: invalid google abuse starting at " + abuseStart + " and ending at " + abuseEnd + " for url " + url, e); 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 e8c5b1e34..b99291309 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 @@ -202,6 +202,7 @@ class FeedFragment : BaseStateFragment() { // Menu // ///////////////////////////////////////////////////////////////////////// + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) @@ -212,6 +213,7 @@ class FeedFragment : BaseStateFragment() { inflater.inflate(R.menu.menu_feed_fragment, menu) } + @Deprecated("Deprecated in Java") override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == R.id.menu_item_feed_help) { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) @@ -253,7 +255,7 @@ class FeedFragment : BaseStateFragment() { viewModel.getShowFutureItemsFromPreferences() ) - AlertDialog.Builder(context!!) + AlertDialog.Builder(requireContext()) .setTitle(R.string.feed_hide_streams_title) .setMultiChoiceItems(dialogItems, checkedDialogItems) { _, which, isChecked -> checkedDialogItems[which] = isChecked @@ -267,6 +269,7 @@ class FeedFragment : BaseStateFragment() { .show() } + @Deprecated("Deprecated in Java") override fun onDestroyOptionsMenu() { super.onDestroyOptionsMenu() activity?.supportActionBar?.subtitle = null 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 fe2321059..59bbaee9d 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 @@ -129,6 +129,7 @@ class SubscriptionFragment : BaseStateFragment() { // Menu // //////////////////////////////////////////////////////////////////////// + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) 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 41761fb01..954b872a6 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 @@ -94,6 +94,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return object : Dialog(requireActivity(), theme) { + @Deprecated("Deprecated in Java") override fun onBackPressed() { if (!this@FeedGroupDialog.onBackPressed()) { super.onBackPressed() diff --git a/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java index 76163b30a..ff7811af3 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java @@ -1,6 +1,5 @@ package org.schabi.newpipe.settings; -import static org.schabi.newpipe.extractor.utils.Utils.decodeUrlUtf8; import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage; import android.app.Activity; @@ -30,7 +29,6 @@ import org.schabi.newpipe.util.FilePickerActivityHelper; import java.io.File; import java.io.IOException; -import java.net.URI; public class DownloadSettingsFragment extends BasePreferenceFragment { public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true; @@ -107,28 +105,15 @@ public class DownloadSettingsFragment extends BasePreferenceFragment { private void showPathInSummary(final String prefKey, @StringRes final int defaultString, final Preference target) { - String rawUri = defaultPreferences.getString(prefKey, null); - if (rawUri == null || rawUri.isEmpty()) { + final Uri uri = Uri.parse(defaultPreferences.getString(prefKey, "")); + if (uri.equals(Uri.EMPTY)) { target.setSummary(getString(defaultString)); return; } - if (rawUri.charAt(0) == File.separatorChar) { - target.setSummary(rawUri); - return; - } - if (rawUri.startsWith(ContentResolver.SCHEME_FILE)) { - target.setSummary(new File(URI.create(rawUri)).getPath()); - return; - } - - try { - rawUri = decodeUrlUtf8(rawUri); - } catch (final IllegalArgumentException e) { - // nothing to do - } - - target.setSummary(rawUri); + final String summary = ContentResolver.SCHEME_FILE.equals(uri.getScheme()) + ? uri.getPath() : uri.toString(); + target.setSummary(summary); } private boolean isFileUri(final String path) { diff --git a/app/src/main/java/org/schabi/newpipe/settings/notifications/NotificationModeConfigFragment.kt b/app/src/main/java/org/schabi/newpipe/settings/notifications/NotificationModeConfigFragment.kt index 581768c30..2df3e33b6 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/notifications/NotificationModeConfigFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/settings/notifications/NotificationModeConfigFragment.kt @@ -77,11 +77,13 @@ class NotificationModeConfigFragment : Fragment() { super.onDestroy() } + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) inflater.inflate(R.menu.menu_notifications_channels, menu) } + @Deprecated("Deprecated in Java") override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.action_toggle_all -> { diff --git a/build.gradle b/build.gradle index 49de98659..1acfb6f4a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.9.24' + ext.kotlin_version = '2.0.0' repositories { google() mavenCentral()