diff --git a/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt b/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt index fea36ed5..754803f9 100644 --- a/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt +++ b/app/src/main/java/com/futo/platformplayer/UISlideOverlays.kt @@ -304,7 +304,7 @@ class UISlideOverlays { return overlay; } - fun showVideoOptionsOverlay(video: IPlatformVideo, container: ViewGroup, onVideoHidden: (()->Unit)? = null): SlideUpMenuOverlay { + fun showVideoOptionsOverlay(video: IPlatformVideo, container: ViewGroup, vararg actions: SlideUpMenuItem): SlideUpMenuOverlay { val items = arrayListOf(); val lastUpdated = StatePlaylists.instance.getLastUpdatedPlaylist(); @@ -323,11 +323,11 @@ class UISlideOverlays { val queue = StatePlayer.instance.getQueue(); val watchLater = StatePlaylists.instance.getWatchLater(); items.add(SlideUpMenuGroup(container.context, "Actions", "actions", - SlideUpMenuItem(container.context, R.drawable.ic_visibility_off, "Hide", "Hide from Home", "hide", - { StateMeta.instance.addHiddenVideo(video.url); onVideoHidden?.invoke() }), - SlideUpMenuItem(container.context, R.drawable.ic_download, "Download", "Download the video", "download", - { showDownloadVideoOverlay(video, container, true); }, false) - )) + (listOf( + SlideUpMenuItem(container.context, R.drawable.ic_download, "Download", "Download the video", "download", + { showDownloadVideoOverlay(video, container, true); }, false)) + + actions) + )); items.add( SlideUpMenuGroup(container.context, "Add To", "addto", SlideUpMenuItem(container.context, R.drawable.ic_queue_add, "Add to Queue", "${queue.size} videos", "queue", diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ContentFeedView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ContentFeedView.kt index 7fa5d8fe..d64dd6aa 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ContentFeedView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ContentFeedView.kt @@ -15,7 +15,9 @@ import com.futo.platformplayer.api.media.models.post.IPlatformPost import com.futo.platformplayer.api.media.models.video.IPlatformVideo import com.futo.platformplayer.api.media.structures.* import com.futo.platformplayer.logging.Logger +import com.futo.platformplayer.states.StateMeta import com.futo.platformplayer.states.StatePlayer +import com.futo.platformplayer.states.StatePlaylists import com.futo.platformplayer.video.PlayerManager import com.futo.platformplayer.views.FeedStyle import com.futo.platformplayer.views.adapters.PreviewContentListAdapter @@ -24,6 +26,7 @@ import com.futo.platformplayer.views.adapters.InsertedViewAdapterWithLoader import com.futo.platformplayer.views.adapters.InsertedViewHolder import com.futo.platformplayer.views.adapters.PreviewNestedVideoViewHolder import com.futo.platformplayer.views.adapters.PreviewVideoViewHolder +import com.futo.platformplayer.views.overlays.slideup.SlideUpMenuItem import kotlin.math.floor abstract class ContentFeedView : FeedView, ContentPreviewViewHolder> where TFragment : MainFragment { @@ -69,15 +72,24 @@ abstract class ContentFeedView : FeedView= 0) { - recyclerData.results.removeAt(removeIndex); - recyclerData.adapter.notifyItemRemoved(recyclerData.adapter.childToParentPosition(removeIndex)); + UISlideOverlays.showVideoOptionsOverlay(content, it, SlideUpMenuItem(context, R.drawable.ic_visibility_off, "Hide", "Hide from Home", "hide", + { StateMeta.instance.addHiddenVideo(content.url); + if (fragment is HomeFragment) { + val removeIndex = recyclerData.results.indexOf(content); + if (removeIndex >= 0) { + recyclerData.results.removeAt(removeIndex); + recyclerData.adapter.notifyItemRemoved(recyclerData.adapter.childToParentPosition(removeIndex)); + } } - } - }; + }), + SlideUpMenuItem(context, R.drawable.ic_playlist, "Play Feed as Queue", "Play entire feed", "playFeed", + { + val newQueue = listOf(content) + recyclerData.results + .filterIsInstance() + .filter { it != content }; + StatePlayer.instance.setQueue(newQueue, StatePlayer.TYPE_QUEUE, "Feed Queue", true, false); + }) + ); } }; adapter.onAddToQueueClicked.subscribe(this) { diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePlugins.kt b/app/src/main/java/com/futo/platformplayer/states/StatePlugins.kt index 84662d2c..27b030e1 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePlugins.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePlugins.kt @@ -116,8 +116,9 @@ class StatePlugins { else if(embeddedConfig != null) { val existing = getPlugin(embedded.key); if(existing != null && existing.config.version < embeddedConfig.version ) { - Logger.i(TAG, "Found outdated embedded plugin [${existing.config.id}] ${existing.config.name}, deleting and reinstalling"); - deletePlugin(embedded.key); + Logger.i(TAG, "Outdated Embedded plugin [${existing.config.id}] ${existing.config.name} (${existing.config.version} < ${embeddedConfig?.version}), reinstalling"); + //deletePlugin(embedded.key); + installEmbeddedPlugin(context, embedded.value) } else if(existing != null && _isFirstEmbedUpdate) Logger.i(TAG, "Embedded plugin [${existing.config.id}] ${existing.config.name}, up to date (${existing.config.version} >= ${embeddedConfig?.version})"); @@ -360,6 +361,8 @@ class StatePlugins { } val existing = getPlugin(config.id) + val existingAuth = existing?.getAuth(); + val existingCaptcha = existing?.getCaptchaData(); if (existing != null) { if(!reinstall) throw IllegalStateException("Plugin with id ${config.id} already exists"); @@ -373,7 +376,7 @@ class StatePlugins { if(icon != null) iconsDir.saveIconBinary(config.id, icon); - _plugins.save(SourcePluginDescriptor(config, null, null, flags)); + _plugins.save(SourcePluginDescriptor(config, existingAuth?.toEncrypted(), existingCaptcha?.toEncrypted(), flags)); return null; } catch(ex: Throwable) {