From 1faf1b261c0c8c9dfca41d116095b08ee5f9c5cb Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:08:00 +0200 Subject: [PATCH 1/4] Updated to latest kotlin version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 363404848..c4647a9ad 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.4.10' + ext.kotlin_version = '1.5.30' repositories { google() mavenCentral() From dbd90299bd26fb4c4cd6a70b9005a85700485bfc Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:08:54 +0200 Subject: [PATCH 2/4] Replaced deprecated ``kotlin-android-extensions`` with ``kotlin-parcelize`` References: * https://developer.android.com/topic/libraries/view-binding/migration#groovy * https://developer.android.com/kotlin/parcelize#groovy --- app/build.gradle | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cf2823024..d9ae26436 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ plugins { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'checkstyle' @@ -84,11 +84,6 @@ android { jvmTarget = JavaVersion.VERSION_1_8 } - // Required and used only by groupie - androidExtensions { - experimental = true - } - sourceSets { androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) } From b061423847f8cc4dbd59f30ffbad55471d4fe825 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:09:27 +0200 Subject: [PATCH 3/4] Changed package as the old one is deprecated --- app/src/main/java/org/schabi/newpipe/about/License.kt | 2 +- app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt | 2 +- app/src/main/java/org/schabi/newpipe/error/ErrorInfo.kt | 2 +- app/src/main/java/org/schabi/newpipe/util/SavedState.kt | 2 +- app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/about/License.kt b/app/src/main/java/org/schabi/newpipe/about/License.kt index b2c5d44a2..117ff9bf5 100644 --- a/app/src/main/java/org/schabi/newpipe/about/License.kt +++ b/app/src/main/java/org/schabi/newpipe/about/License.kt @@ -1,7 +1,7 @@ package org.schabi.newpipe.about import android.os.Parcelable -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize import java.io.Serializable /** diff --git a/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt b/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt index 2e967ebe8..354e8fef7 100644 --- a/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt +++ b/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt @@ -1,7 +1,7 @@ package org.schabi.newpipe.about import android.os.Parcelable -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize @Parcelize class SoftwareComponent diff --git a/app/src/main/java/org/schabi/newpipe/error/ErrorInfo.kt b/app/src/main/java/org/schabi/newpipe/error/ErrorInfo.kt index 487e7c7fb..6581b5752 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ErrorInfo.kt +++ b/app/src/main/java/org/schabi/newpipe/error/ErrorInfo.kt @@ -2,7 +2,7 @@ package org.schabi.newpipe.error import android.os.Parcelable import androidx.annotation.StringRes -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize import org.schabi.newpipe.R import org.schabi.newpipe.extractor.Info import org.schabi.newpipe.extractor.NewPipe diff --git a/app/src/main/java/org/schabi/newpipe/util/SavedState.kt b/app/src/main/java/org/schabi/newpipe/util/SavedState.kt index 313d56192..c556b59ff 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SavedState.kt +++ b/app/src/main/java/org/schabi/newpipe/util/SavedState.kt @@ -1,7 +1,7 @@ package org.schabi.newpipe.util import android.os.Parcelable -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize /** * Information about the saved state on the disk. diff --git a/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt b/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt index b2364f058..403eee0c7 100644 --- a/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt +++ b/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt @@ -1,7 +1,7 @@ package us.shandian.giga.get import android.os.Parcelable -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize import org.schabi.newpipe.extractor.MediaFormat import org.schabi.newpipe.extractor.stream.AudioStream import org.schabi.newpipe.extractor.stream.Stream From f18a7c91ca247d8dc7f674044b9a79f8c6565a9f Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 27 Aug 2021 16:32:59 +0200 Subject: [PATCH 4/4] Suppressed warning There seems to be a bug in the kotlin plugin as it tells you when building that this can't be null: "Condition 'throwable != null' is always 'true'" However it can indeed be null as seen in https://github.com/TeamNewPipe/NewPipe/pull/6986#issuecomment-906822218 --- .../schabi/newpipe/local/feed/service/FeedLoadService.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt index 3638b4c0e..98ff5914d 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt @@ -300,6 +300,12 @@ class FeedLoadService : Service() { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe { _, throwable -> + // There seems to be a bug in the kotlin plugin as it tells you when + // building that this can't be null: + // "Condition 'throwable != null' is always 'true'" + // However it can indeed be null + // The suppression may be removed in further versions + @Suppress("SENSELESS_COMPARISON") if (throwable != null) { Log.e(TAG, "Error while storing result", throwable) handleError(throwable)