diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ac4b2a005..03841a7b2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -304,10 +304,6 @@ dependencies { implementation(libs.google.exoplayer.smoothstreaming) implementation(libs.google.exoplayer.ui) - // Metadata generator for service descriptors - compileOnly(libs.google.autoservice.annotations) - ksp(libs.google.autoservice.compiler) - // Manager for complex RecyclerView layouts implementation(libs.lisawray.groupie.core) implementation(libs.lisawray.groupie.viewbinding) @@ -322,6 +318,8 @@ dependencies { // Crash reporting implementation(libs.acra.core) + compileOnly(libs.google.autoservice.annotations) + ksp(libs.zacsweers.autoservice.compiler) // Properly restarting implementation(libs.jakewharton.phoenix) diff --git a/app/src/main/java/org/schabi/newpipe/database/history/dao/StreamHistoryDAO.kt b/app/src/main/java/org/schabi/newpipe/database/history/dao/StreamHistoryDAO.kt index 432c93a55..916d4e5ed 100644 --- a/app/src/main/java/org/schabi/newpipe/database/history/dao/StreamHistoryDAO.kt +++ b/app/src/main/java/org/schabi/newpipe/database/history/dao/StreamHistoryDAO.kt @@ -35,7 +35,7 @@ abstract class StreamHistoryDAO : BasicDAO { abstract val historySortedById: Flowable> @Query("SELECT * FROM stream_history WHERE stream_id = :streamId ORDER BY access_date DESC LIMIT 1") - abstract fun getLatestEntry(streamId: Long): StreamHistoryEntity + abstract fun getLatestEntry(streamId: Long): StreamHistoryEntity? @Query("DELETE FROM stream_history WHERE stream_id = :streamId") abstract fun deleteStreamHistory(streamId: Long): Int diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.kt b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.kt index 5ca1cdf9a..22db561cf 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.kt @@ -1730,12 +1730,13 @@ class VideoDetailFragment : } override fun onFullscreenToggleButtonClicked() { + // On Android TV screen rotation is not supported // In tablet user experience will be better if screen will not be rotated // from landscape to portrait every time. // Just turn on fullscreen mode in landscape orientation // or portrait & unlocked global orientation val isLandscape = DeviceUtils.isLandscape(requireContext()) - if (DeviceUtils.isTablet(activity) && + if (DeviceUtils.isTv(activity) || DeviceUtils.isTablet(activity) && (!PlayerHelper.globalScreenOrientationLocked(activity) || isLandscape) ) { player!!.UIs().get(MainPlayerUi::class)?.toggleFullscreen() diff --git a/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java b/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java index ff3b2478e..5676fee95 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java @@ -13,6 +13,9 @@ import androidx.annotation.StringRes; import org.schabi.newpipe.R; import org.schabi.newpipe.database.stream.model.StreamEntity; import org.schabi.newpipe.download.DownloadDialog; +import org.schabi.newpipe.error.ErrorInfo; +import org.schabi.newpipe.error.ErrorUtil; +import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.local.dialog.PlaylistAppendDialog; import org.schabi.newpipe.local.dialog.PlaylistDialog; import org.schabi.newpipe.local.history.HistoryRecordManager; @@ -133,6 +136,16 @@ public enum StreamDialogDefaultEntry { MARK_AS_WATCHED(R.string.mark_as_watched, (fragment, item) -> new HistoryRecordManager(fragment.getContext()) .markAsWatched(item) + .doOnError(error -> { + ErrorUtil.showSnackbar( + fragment.requireContext(), + new ErrorInfo( + error, + UserAction.OPEN_INFO_ITEM_DIALOG, + "Got an error when trying to mark as watched" + ) + ); + }) .onErrorComplete() .observeOn(AndroidSchedulers.mainThread()) .subscribe() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e4e5515f1..2e4b630ba 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,8 @@ acra = "5.13.1" agp = "8.13.1" appcompat = "1.7.1" assertj = "3.27.6" -autoservice = "1.1.1" +autoservice-google = "1.1.1" +autoservice-zacsweers = "1.2.0" bridge = "v2.0.2" cardview = "1.0.0" checkstyle = "12.1.2" @@ -114,8 +115,7 @@ evernote-statesaver-core = { module = "com.evernote:android-state", version.ref facebook-stetho-core = { module = "com.facebook.stetho:stetho", version.ref = "stetho" } facebook-stetho-okhttp3 = { module = "com.facebook.stetho:stetho-okhttp3", version.ref = "stetho" } google-android-material = { module = "com.google.android.material:material", version.ref = "material" } -google-autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "autoservice" } -google-autoservice-compiler = { module = "com.google.auto.service:auto-service", version.ref = "autoservice" } +google-autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "autoservice-google" } google-exoplayer-core = { module = "com.google.android.exoplayer:exoplayer-core", version.ref = "exoplayer" } google-exoplayer-dash = { module = "com.google.android.exoplayer:exoplayer-dash", version.ref = "exoplayer" } google-exoplayer-database = { module = "com.google.android.exoplayer:exoplayer-database", version.ref = "exoplayer" } @@ -152,6 +152,7 @@ squareup-leakcanary-core = { module = "com.squareup.leakcanary:leakcanary-androi squareup-leakcanary-plumber = { module = "com.squareup.leakcanary:plumber-android", version.ref = "leakcanary" } squareup-leakcanary-watcher = { module = "com.squareup.leakcanary:leakcanary-object-watcher-android", version.ref = "leakcanary" } squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +zacsweers-autoservice-compiler = { module = "dev.zacsweers.autoservice:auto-service-ksp", version.ref = "autoservice-zacsweers" } [plugins] about-libraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "about-libraries" }