From b6697bbc35868938eda2c3647e33a011f6869a2c Mon Sep 17 00:00:00 2001 From: Hyerim Kim Date: Wed, 17 May 2017 13:36:36 +0900 Subject: [PATCH] Fixes Svace issues Removes Option menu of video player Change-Id: I2eaa72dab8f37226350cafeb2beb68df38d514ee Signed-off-by: Hyerim Kim --- .../TVMediaHub.Tizen/Models/ContentProvider.cs | 61 ++---- .../TVMediaHub.Tizen/Models/VideoProvider.cs | 1 + TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml | 1 - .../TVMediaHub.Tizen/Views/VideoPlayer.xaml.cs | 230 +-------------------- 4 files changed, 15 insertions(+), 278 deletions(-) mode change 100644 => 100755 TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs diff --git a/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs b/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs old mode 100644 new mode 100755 index 90ba670..737fe96 --- a/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs @@ -58,15 +58,11 @@ namespace TVMediaHub.Tizen.Models private string GetDateString(DateTime date) { - DateTime yesterDay = DateTime.Today; - - yesterDay.AddDays(-1); - - if (DateTime.Today == date) + if (date.Equals(DateTime.Today)) { return "Today"; } - else if (yesterDay == date) + else if (date.Equals(DateTime.Today.AddDays(-1))) { return "Yesterday"; } @@ -129,8 +125,11 @@ namespace TVMediaHub.Tizen.Models return currentGroupItem; } - private IEnumerable MakeGroups(IEnumerable mediaInformations, SortOption sortOption) +#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously + private async Task> MakeGroupAsync(IEnumerable mediaInformations, SortOption sortOption) +#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { + DbgPort.D("MG Async"); List result = new List(); GroupItem lastGroupItem = null; GroupItem currentGroupItem = null; @@ -144,44 +143,18 @@ namespace TVMediaHub.Tizen.Models { var currentInformation = mediaInformation; var shortcutInfo = new MediaShortcutInfo(currentInformation); - currentGroupItem = GetGroupItem(sortOption, currentGroupItem, mediaInformation); - if (lastGroupItem != currentGroupItem) - { - result.Add(currentGroupItem); - lastGroupItem = currentGroupItem; - } - if (currentGroupItem != null) + // TODO : The catch implementation should be checked once again. + try { - currentGroupItem.Contents.Add(shortcutInfo); + currentGroupItem = GetGroupItem(sortOption, currentGroupItem, mediaInformation); } - else + catch (Exception e) { - throw new System.Exception("Something's wrong on making a GroupItem. Check your logic."); + DbgPort.E(e.Message); + return null; } - } - - return result; - } -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - private async Task> MakeGroupAsync(IEnumerable mediaInformations, SortOption sortOption) -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - { - DbgPort.D("MG Async"); - List result = new List(); - GroupItem lastGroupItem = null; - GroupItem currentGroupItem = null; - - if (mediaInformations == null) - { - throw new System.ArgumentException("mediaInformations must not be null."); - } - foreach (MediaInformation mediaInformation in mediaInformations) - { - var currentInformation = mediaInformation; - var shortcutInfo = new MediaShortcutInfo(currentInformation); - currentGroupItem = GetGroupItem(sortOption, currentGroupItem, mediaInformation); if (lastGroupItem != currentGroupItem) { result.Add(currentGroupItem); @@ -192,11 +165,6 @@ namespace TVMediaHub.Tizen.Models { currentGroupItem.Contents.Add(shortcutInfo); } - else - { - throw new System.Exception("Something's wrong on making a GroupItem. Check your logic."); - } - } return result; @@ -330,11 +298,6 @@ namespace TVMediaHub.Tizen.Models return mediaInformations; } - public IEnumerable Read(SortOption sortOption, string storageId = null, int offset = -1, int count = -1) - { - return MakeGroups(ReadWithoutGroup(sortOption, storageId, offset, count), sortOption); - } - public async Task> ReadAsync(SortOption sortOption, string storageId = null, int offset = -1, int count = -1) { IEnumerable list = await ReadWithoutGroupAsync(sortOption, storageId, offset, count); diff --git a/TVMediaHub/TVMediaHub.Tizen/Models/VideoProvider.cs b/TVMediaHub/TVMediaHub.Tizen/Models/VideoProvider.cs index 381f36c..cae0e38 100755 --- a/TVMediaHub/TVMediaHub.Tizen/Models/VideoProvider.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Models/VideoProvider.cs @@ -52,6 +52,7 @@ namespace TVMediaHub.Tizen.Models catch (Exception exception) { DbgPort.E(exception.Message); + return recentlyPlayedVideo; } foreach (var mediaInformation in mediaInformations) diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml index 7a5ac7a..7b51321 100755 --- a/TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml +++ b/TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml @@ -170,7 +170,6 @@ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5958}" /> (duration - 6000)) { IsInPlayBackRewFwd = false; playerInstance.SetPlaybackRate((PlayBackRate[0])); @@ -313,18 +284,6 @@ namespace TVMediaHub.Tizen.Views SpeedInfo.FadeTo(0.0, 100); } } - else if (PlayBackForwardIndex != 0 && - playPosition > (duration - 6000)) - { - IsInPlayBackRewFwd = false; - playerInstance.SetPlaybackRate((PlayBackRate[0])); - - if (SpeedInfo.Opacity == 1) - { - SpeedInfo.FadeTo(0.0, 100); - } - } - }); if (playerInstance.State != PlayerState.Playing && @@ -749,191 +708,6 @@ namespace TVMediaHub.Tizen.Views progress.Progress = 1.0; } - private void OptionsBtnClicked(object sender, EventArgs e) - { - if (SpeedInfo.Opacity == 1) - { -#pragma warning disable CS4014 - SpeedInfo.FadeTo(0.0, 100); -#pragma warning restore CS4014 - } - - if (ControlArea.Opacity == 0) - { - SetControlAreaState(ControlAreaState.AUTO); - - return; - } - - SetControlAreaState(ControlAreaState.AUTO); - - CreateOptionPopup(); - } - - private void CreateScreenRateOptionPopup() - { - if (isScreenRatePopupShowing) - { - return; - } - - screenRateOptionPopup = new ContextPopup - { - IsAutoHidingEnabled = true, - Orientation = ContextPopupOrientation.Vertical, - DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down), - }; - - screenRateOptionPopup.Items.Add(new ContextPopupItem(" ORIGINAL ")); - screenRateOptionPopup.Items.Add(new ContextPopupItem(" 16:9 ")); - screenRateOptionPopup.Items.Add(new ContextPopupItem(" 4:3 ")); - - screenRateOptionPopup.SelectedIndexChanged += (s, e) => - { - var ctxPopup = s as ContextPopup; - - DbgPort.D("[SlideShowSpeed] Selected Item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + "(" + ctxPopup.SelectedIndex + ")"); - - switch (ctxPopup.SelectedIndex) - { - case 0: - /// ORIGINAL - break; - case 1: - /// 16:9 - break; - case 2: - /// 4:3 - break; - default: - break; - } - - screenRateOptionPopup.Dismiss(); - screenRateOptionPopup = null; - }; - - screenRateOptionPopup.Dismissed += (s, args) => - { - isScreenRatePopupShowing = false; - - CreateOptionPopup(); - }; - - screenRateOptionPopup.Show(PopupAnchor, (PopupAnchor.Width / 2), PopupAnchor.Height); - isScreenRatePopupShowing = true; - } - - private void CreateSoundEffectOptionPopup() - { - if (isSoundEffectPopupShowing) - { - return; - } - - soundEffectOptionPopup = new ContextPopup - { - IsAutoHidingEnabled = true, - Orientation = ContextPopupOrientation.Vertical, - DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down), - }; - - soundEffectOptionPopup.Items.Add(new ContextPopupItem(" STANDARD ")); - soundEffectOptionPopup.Items.Add(new ContextPopupItem(" CINEMA ")); - soundEffectOptionPopup.Items.Add(new ContextPopupItem(" SPORT ")); - - soundEffectOptionPopup.SelectedIndexChanged += (s, e) => - { - var ctxPopup = s as ContextPopup; - - DbgPort.D("[SlideShowEffect] Selected Item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + "(" + ctxPopup.SelectedIndex + ")"); - - switch (ctxPopup.SelectedIndex) - { - case 0: - /// STANDARD - break; - case 1: - /// CINEMA - break; - case 2: - /// SPORT - break; - default: - break; - } - - soundEffectOptionPopup.Dismiss(); - soundEffectOptionPopup = null; - }; - - soundEffectOptionPopup.Dismissed += (s, args) => - { - isSoundEffectPopupShowing = false; - - CreateOptionPopup(); - }; - - soundEffectOptionPopup.Show(PopupAnchor, (PopupAnchor.Width / 2), PopupAnchor.Height); - isSoundEffectPopupShowing = true; - } - - private void CreateOptionPopup() - { - if (isOptionPopupShowing) - { - return; - } - - optionPopup = new ContextPopup - { - IsAutoHidingEnabled = true, - Orientation = ContextPopupOrientation.Vertical, - DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down), - }; - - optionPopup.Items.Add(new ContextPopupItem(" SCREEN RATE ")); - optionPopup.Items.Add(new ContextPopupItem(" SOUND EFFECT ")); - - optionPopup.SelectedIndexChanged += (s, args) => - { - var ctxPopup = s as ContextPopup; - - DbgPort.D("[VideoPlayer] Selected Item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + " (" + ctxPopup.SelectedIndex + ")"); - switch (ctxPopup.SelectedIndex) - { - case 0: - /// Screen Rate - CreateScreenRateOptionPopup(); - break; - case 1: - /// Sound Effect - CreateSoundEffectOptionPopup(); - break; - default: - break; - } - - optionPopup.Dismiss(); - optionPopup = null; - }; - - optionPopup.Dismissed += (s, args) => - { - isOptionPopupShowing = false; - - if (!isScreenRatePopupShowing && !isSoundEffectPopupShowing) - { - SetControlAreaState(ControlAreaState.AUTO); - } - }; - - optionPopup.Show(PopupAnchor, (PopupAnchor.Width / 2), PopupAnchor.Height); - isOptionPopupShowing = true; - - SetControlAreaState(ControlAreaState.SHOW); - } - public override void RunHideAnimation() { if (SpeedInfo.Opacity == 1) -- 2.7.4