From 3beae3e1e81ce72903525103cb0f94c27c46430b Mon Sep 17 00:00:00 2001 From: Nemanja Tesic Date: Fri, 8 Oct 2021 15:47:32 +0200 Subject: [PATCH 1/4] dev: Play All Button --- .../controllers/settings.home.controller.js | 10 +++++ control/settings/templates/home.html | 15 +++++++ widget/assets/css/icons/ic_play_material.svg | 1 + widget/assets/css/widget.app.css | 40 +++++++++++++++++++ widget/controllers/widget.home.controller.js | 23 ++++++++++- widget/controllers/widget.media.controller.js | 2 +- widget/js/shared/stringsConfig.js | 17 ++++++++ widget/templates/home.html | 7 ++++ 8 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 widget/assets/css/icons/ic_play_material.svg diff --git a/control/settings/controllers/settings.home.controller.js b/control/settings/controllers/settings.home.controller.js index d8888b1..c1a81ab 100644 --- a/control/settings/controllers/settings.home.controller.js +++ b/control/settings/controllers/settings.home.controller.js @@ -17,6 +17,8 @@ Settings.data.design.skipMediaPage = true; if (typeof (Settings.data.content.autoPlay) == 'undefined') Settings.data.content.autoPlay = true; + if (typeof (Settings.data.content.playAllButton) == 'undefined') + Settings.data.content.playAllButton = false; if (typeof (Settings.data.content.autoPlayDelay) == 'undefined') Settings.data.content.autoPlayDelay = { label: "Off", value: 0 }; }, (err) => { @@ -70,6 +72,14 @@ } }; + Settings.setPlayAllButton = (e) => { + let value = e.target.checked; + if (value != Settings.data.content.playAllButton) { + Settings.data.content.playAllButton = value; + MediaCenter.save(Settings.data).then(() => {}); + } + }; + Settings.setAutoPlayDelay = (option) => { if (option.value != Settings.data.content.autoPlayDelay.value) { Settings.data.content.autoPlayDelay = option; diff --git a/control/settings/templates/home.html b/control/settings/templates/home.html index b9fd9ae..5b1c91f 100644 --- a/control/settings/templates/home.html +++ b/control/settings/templates/home.html @@ -26,6 +26,21 @@ +
+ +
+ + +
+
+ +

Auto Play Delay diff --git a/widget/assets/css/icons/ic_play_material.svg b/widget/assets/css/icons/ic_play_material.svg new file mode 100644 index 0000000..dedacae --- /dev/null +++ b/widget/assets/css/icons/ic_play_material.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/widget/assets/css/widget.app.css b/widget/assets/css/widget.app.css index 1c7648a..71a8cbc 100644 --- a/widget/assets/css/widget.app.css +++ b/widget/assets/css/widget.app.css @@ -1045,4 +1045,44 @@ input[type=range]::-ms-track { overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; +} + +.box-play-all{ + width: 100%; + height: 50px; + padding: 16px; + position: sticky; + top: 0; + background-color: var(--bf-theme-background); + z-index: 100; + -webkit-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + -moz-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + -o-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; +} + +.button-play-all{ + width: 48px; + height: 48px; + border-radius: 50%; + position: absolute; + right: 15px; + bottom: -24px; + background-color: var(--bf-theme-title-bar); + cursor: pointer; + z-index: 100; + box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + -moz-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + -webkit-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; + -o-box-shadow: rgb(0 0 0 / 60%) 0px 1px 5px; +} + +.image-play-all{ + width: 100%; + height: 100%; + background-color: var(--bf-theme-icons); + -webkit-mask: url(icons/ic_play_material.svg) no-repeat center; + mask: url(icons/ic_play_material.svg) no-repeat center; + -webkit-mask-size: 35px; + mask-size: 35px; } \ No newline at end of file diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index cf47f8e..1845640 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -7,8 +7,14 @@ $rootScope.showFeed = true; var WidgetHome = this; WidgetHome.deepLink = false; + WidgetHome.totalRecord = null; $rootScope.loadingData = true; $rootScope.autoPlay = true; + + WidgetHome.globalPlaylistStrings = { + plAllLoading: strings.get('playAllHeader.plAllLoading'), + plAllItems: strings.get('playAllHeader.plAllItems'), + } const isLauncher = window.location.href.includes('launcherPlugin'); const slideElement = document.querySelector(".slide"); @@ -33,6 +39,7 @@ transferAudioContentToPlayList: false, forceAutoPlay: false, autoPlay: true, + playAllButton: false, autoPlayDelay: { label: "Off", value: 0 }, globalPlaylist: true, }, @@ -82,6 +89,7 @@ $rootScope.autoPlay = typeof MediaCenterInfo.data.content.autoPlay !== 'undefined' ? MediaCenterInfo.data.content.autoPlay : true; $rootScope.autoPlayDelay = typeof MediaCenterInfo.data.content.autoPlayDelay !== 'undefined' ? MediaCenterInfo.data.content.autoPlayDelay : { label: "Off", value: 0 }; + $rootScope.playAllButton = typeof MediaCenterInfo.data.content.playAllButton !== 'undefined' ? MediaCenterInfo.data.content.playAllButton : false; }, function fail() { MediaCenterInfo = _infoData; @@ -158,6 +166,17 @@ } }; + WidgetHome.playAll = function(){ + WidgetHome.goToMedia(0); + } + + WidgetHome.showNumberOfItems = function (){ + if(WidgetHome.totalRecord != null){ + return WidgetHome.totalRecord+" "+ ((WidgetHome.globalPlaylistStrings.plAllItems)?WidgetHome.globalPlaylistStrings.plAllItems:"Items"); + } + else return ((WidgetHome.globalPlaylistStrings.plAllLoading)?WidgetHome.globalPlaylistStrings.plAllLoading:"Loading.."); + } + WidgetHome.setEmptyState = function () { $rootScope.showFeed = true; $rootScope.showEmptyState = true; @@ -197,8 +216,9 @@ $rootScope.forceAutoPlay = false; // WidgetHome.media.data.content.forceAutoPlay $rootScope.skipMediaPage = WidgetHome.media.data.design.skipMediaPage; - $rootScope.autoPlay = typeof MediaCenterInfo.data.content.autoPlay !== 'undefined' ? MediaCenterInfo.data.content.autoPlay : true; + $rootScope.autoPlay = typeof WidgetHome.media.data.content.autoPlay !== 'undefined' ? WidgetHome.media.data.content.autoPlay : true; $rootScope.autoPlayDelay = typeof WidgetHome.media.data.content.autoPlayDelay !== 'undefined' ? WidgetHome.media.data.content.autoPlayDelay : { label: "Off", value: 0 }; + $rootScope.playAllButton = typeof WidgetHome.media.data.content.playAllButton !== 'undefined' ? WidgetHome.media.data.content.playAllButton : false; if (view && event.data.content && event.data.content.images) { view.loadItems(event.data.content.images); @@ -427,6 +447,7 @@ $rootScope.myItems = WidgetHome.items; resolve(); } + WidgetHome.totalRecord=WidgetHome.items.length; }).catch(err => { console.error(err); resolve() diff --git a/widget/controllers/widget.media.controller.js b/widget/controllers/widget.media.controller.js index 91a4ad3..aa3dbf8 100644 --- a/widget/controllers/widget.media.controller.js +++ b/widget/controllers/widget.media.controller.js @@ -293,7 +293,7 @@ $rootScope.autoPlay = typeof WidgetMedia.media.data.content.autoPlay !== 'undefined' ? WidgetMedia.media.data.content.autoPlay : true; $rootScope.autoPlayDelay = typeof WidgetMedia.media.data.content.autoPlayDelay !== 'undefined' ? WidgetMedia.media.data.content.autoPlayDelay : { label: "Off", value: 0 }; - + $rootScope.playAllButton = typeof WidgetMedia.media.data.content.playAllButton !== 'undefined' ? WidgetMedia.media.data.content.playAllButton : false; // Update Data in media contoller WidgetMedia.fixIOSAutoPlay(); $rootScope.refreshItems(); diff --git a/widget/js/shared/stringsConfig.js b/widget/js/shared/stringsConfig.js index 07f7a80..3960685 100644 --- a/widget/js/shared/stringsConfig.js +++ b/widget/js/shared/stringsConfig.js @@ -121,6 +121,23 @@ var stringsConfig = { defaultValue: "Remove", }, }, + }, + playAllHeader: { + title: "Play All", + labels: { + plAllLoading: { + title: "Loading Message", + placeholder: "Loading..", + maxLength: 50, + defaultValue: "Loading..", + }, + plAllItems: { + title: "Items Count", + placeholder: "Items", + maxLength: 70, + defaultValue: "Items", + } + }, }, deeplink: { title: "Deep link", diff --git a/widget/templates/home.html b/widget/templates/home.html index dabd2f5..5a529ef 100644 --- a/widget/templates/home.html +++ b/widget/templates/home.html @@ -1,4 +1,11 @@

+
+

{{WidgetHome.showNumberOfItems()}}

+
+
+
+
+
Date: Thu, 14 Oct 2021 17:00:08 +0200 Subject: [PATCH 2/4] dev: Small Fix --- widget/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/widget/index.html b/widget/index.html index 74bce13..1f655ca 100644 --- a/widget/index.html +++ b/widget/index.html @@ -85,6 +85,7 @@
{{delayCountdownText}}