From 62d927739ab1cb21714e6d7f66a73a97b6bd68e7 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Wed, 14 Feb 2024 20:15:12 +0100 Subject: [PATCH] Sharing from overview options, notification channel names --- .../com/futo/platformplayer/UISlideOverlays.kt | 14 +++++++++++--- .../platformplayer/services/DownloadService.kt | 3 ++- .../platformplayer/services/ExportingService.kt | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt b/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt index a3ad39c0..30ae14d7 100644 --- a/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt +++ b/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt @@ -646,9 +646,17 @@ class UISlideOverlays { val watchLater = StatePlaylists.instance.getWatchLater(); items.add(SlideUpMenuGroup(container.context, container.context.getString(R.string.actions), "actions", (listOf( - SlideUpMenuItem(container.context, R.drawable.ic_download, container.context.getString(R.string.download), container.context.getString(R.string.download_the_video), container.context.getString(R.string.download), { - showDownloadVideoOverlay(video, container, true); - }, false), + SlideUpMenuItem(container.context, R.drawable.ic_download, container.context.getString(R.string.download), container.context.getString(R.string.download_the_video), "download", { + showDownloadVideoOverlay(video, container, true); + }, false), + SlideUpMenuItem(container.context, R.drawable.ic_share, container.context.getString(R.string.share), "Share the video", "share", { + val url = if(video.shareUrl.isNotEmpty()) video.shareUrl else video.url; + container.context.startActivity(Intent.createChooser(Intent().apply { + action = Intent.ACTION_SEND; + putExtra(Intent.EXTRA_TEXT, url); + type = "text/plain"; + }, null)); + }, false), SlideUpMenuItem(container.context, R.drawable.ic_visibility_off, container.context.getString(R.string.hide_creator_from_home), "", "hide_creator", { StateMeta.instance.addHiddenCreator(video.author.url); UIDialogs.toast(container.context, "[${video.author.name}] hidden, you may need to reload home"); diff --git a/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt b/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt index 284328e2..9436e2f3 100644 --- a/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt +++ b/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt @@ -37,6 +37,7 @@ class DownloadService : Service() { private val DOWNLOAD_NOTIF_ID = 3; private val DOWNLOAD_NOTIF_TAG = "download"; private val DOWNLOAD_NOTIF_CHANNEL_ID = "downloadChannel"; + private val DOWNLOAD_NOTIF_CHANNEL_NAME = "Downloads"; //Context private val _scope: CoroutineScope = CoroutineScope(Dispatchers.Default); @@ -95,7 +96,7 @@ class DownloadService : Service() { } fun setupNotificationRequirements() { _notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; - _notificationChannel = NotificationChannel(DOWNLOAD_NOTIF_CHANNEL_ID, "Temp", NotificationManager.IMPORTANCE_DEFAULT).apply { + _notificationChannel = NotificationChannel(DOWNLOAD_NOTIF_CHANNEL_ID, DOWNLOAD_NOTIF_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT).apply { this.enableVibration(false); this.setSound(null, null); }; diff --git a/app/src/main/java/com/futo/platformplayer/services/ExportingService.kt b/app/src/main/java/com/futo/platformplayer/services/ExportingService.kt index fc5c24a3..635d5029 100644 --- a/app/src/main/java/com/futo/platformplayer/services/ExportingService.kt +++ b/app/src/main/java/com/futo/platformplayer/services/ExportingService.kt @@ -36,6 +36,7 @@ class ExportingService : Service() { private val EXPORT_NOTIF_ID = 4; private val EXPORT_NOTIF_TAG = "export"; private val EXPORT_NOTIF_CHANNEL_ID = "exportChannel"; + private val EXPORT_NOTIF_CHANNEL_NAME = "Export"; //Context private val _scope: CoroutineScope = CoroutineScope(Dispatchers.Default); @@ -88,7 +89,7 @@ class ExportingService : Service() { } fun setupNotificationRequirements() { _notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; - _notificationChannel = NotificationChannel(EXPORT_NOTIF_CHANNEL_ID, "Temp", NotificationManager.IMPORTANCE_DEFAULT).apply { + _notificationChannel = NotificationChannel(EXPORT_NOTIF_CHANNEL_ID, EXPORT_NOTIF_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT).apply { this.enableVibration(false); this.setSound(null, null); };