From: Heonjae Jang Date: Wed, 19 Apr 2017 11:18:09 +0000 (+0900) Subject: Add MusicTab X-Git-Tag: accepted/tizen/unified/20170811.133302~154 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74e5e9feacb59667a87e4ef8881e0b13132865a2;p=profile%2Ftv%2Fapps%2Fdotnet%2Fmediahub.git Add MusicTab 1. Add MusicTab 2. Add IsFooterEnableProperty in FooterNormalStatus 3. Change Option DropdownList to Button and ContextPopup 4. Add Boilerplate Change-Id: Id131cd836cadfd638bfb3976578abb449f0f0c0c Signed-off-by: Heonjae Jang --- diff --git a/TVMediaHub/TVMediaHub.Tizen/DataModels/SelectedEventArgs.cs b/TVMediaHub/TVMediaHub.Tizen/DataModels/SelectedEventArgs.cs new file mode 100644 index 0000000..3b0d601 --- /dev/null +++ b/TVMediaHub/TVMediaHub.Tizen/DataModels/SelectedEventArgs.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Xamarin.Forms.Extension; + +namespace TVMediaHub.Tizen.DataModels +{ + public class ContextPopupSelectedEventArgs : EventArgs + { + public int Index { get; } + public ContextPopupItem Item { get; } + + public ContextPopupSelectedEventArgs(int index, ContextPopupItem item) + { + Index = index; + Item = item; + } + } +} diff --git a/TVMediaHub/TVMediaHub.Tizen/Models/MediaShortcutInfo.cs b/TVMediaHub/TVMediaHub.Tizen/Models/MediaShortcutInfo.cs index 17e3cb6..d976182 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Models/MediaShortcutInfo.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Models/MediaShortcutInfo.cs @@ -1,11 +1,21 @@ -using System; -using System.Collections.Generic; +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Tizen.Content.MediaContent; -using TVMediaHub.Tizen.Utils; namespace TVMediaHub.Tizen.Models { diff --git a/TVMediaHub/TVMediaHub.Tizen/TVMediaHub.Tizen.csproj b/TVMediaHub/TVMediaHub.Tizen/TVMediaHub.Tizen.csproj index f3973ae..72cb161 100755 --- a/TVMediaHub/TVMediaHub.Tizen/TVMediaHub.Tizen.csproj +++ b/TVMediaHub/TVMediaHub.Tizen/TVMediaHub.Tizen.csproj @@ -111,9 +111,6 @@ MusicTab.xaml - - RecentlyWatchedVideoContent.xaml - VideoGroup.xaml @@ -253,11 +250,6 @@ - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml @@ -295,10 +287,10 @@ - + - + diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/AnimationLayerPage.cs b/TVMediaHub/TVMediaHub.Tizen/Views/AnimationLayerPage.cs index 551693d..2181b64 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/AnimationLayerPage.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Views/AnimationLayerPage.cs @@ -1,8 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection.Emit; -using System.Text; +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System.Threading.Tasks; using Xamarin.Forms; diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/CustomImageControl.cs b/TVMediaHub/TVMediaHub.Tizen/Views/CustomImageControl.cs index 850cf94..07457c6 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/CustomImageControl.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Views/CustomImageControl.cs @@ -1,9 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TVMediaHub.Tizen.Utils; +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using Xamarin.Forms; namespace TVMediaHub.Tizen.Views diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/FooterDeleteStatus.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/FooterDeleteStatus.xaml.cs index 12b64e4..2cb7444 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/FooterDeleteStatus.xaml.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Views/FooterDeleteStatus.xaml.cs @@ -1,4 +1,19 @@ - +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/FooterNormalStatus.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/FooterNormalStatus.xaml.cs index 31f13ec..3b167ad 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/FooterNormalStatus.xaml.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Views/FooterNormalStatus.xaml.cs @@ -1,25 +1,45 @@ -using System; +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Xamarin.Forms; using Xamarin.Forms.Xaml; using Tizen.Xamarin.Forms.Extension; -using System.Collections.ObjectModel; using TVMediaHub.Tizen.Utils; -using Tizen; +using TVMediaHub.Tizen.DataModels; namespace TVMediaHub.Tizen.Views { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class FooterNormalStatus : RelativeLayout { + public static readonly BindableProperty IsFooterEnabledProperty = BindableProperty.Create("IsFooterEnabled", typeof(bool), typeof(FooterNormalStatus), true); + + public bool IsFooterEnabled + { + get { return (bool)GetValue(IsFooterEnabledProperty); } + set { SetValue(IsFooterEnabledProperty, value); } + } + /// /// Identifies the SourceList bindable property /// ), typeof(VideoTab), default(IEnumerable)); + public static readonly BindableProperty SourceListProperty = BindableProperty.Create("SourceList", typeof(IEnumerable), typeof(FooterNormalStatus), default(IEnumerable)); /// /// Gets or sets list about source of contents @@ -33,7 +53,7 @@ namespace TVMediaHub.Tizen.Views /// /// Identifies the SortOptions bindable property /// ), typeof(VideoTab), default(IEnumerable)); + public static readonly BindableProperty SortOptionsProperty = BindableProperty.Create("SortOptions", typeof(IEnumerable), typeof(FooterNormalStatus), default(IEnumerable)); /// /// Gets or sets sort options @@ -47,7 +67,7 @@ namespace TVMediaHub.Tizen.Views /// /// Identifies the OptionList bindable property /// ), typeof(VideoTab), default(IEnumerable)); + public static readonly BindableProperty OptionListProperty = BindableProperty.Create("OptionList", typeof(IEnumerable), typeof(FooterNormalStatus), default(IEnumerable)); /// /// Gets or sets list about options @@ -71,7 +91,7 @@ namespace TVMediaHub.Tizen.Views /// /// A EventHandler for DropdownOption ItemSelected event /// - public EventHandler OnDropdownOptionItemSelected; + public EventHandler OnSelectedOptionIndexChanged; /// /// A DropdownList for displaying sources of contents @@ -84,9 +104,10 @@ namespace TVMediaHub.Tizen.Views private DropdownList DropdownSort; /// - /// A DropdownList for displaying page options + /// A Button for displaying page options /// - private DropdownList DropdownOption; + private Button ButtonOption; + private bool isPopupShowing; /// /// A Constructor @@ -94,7 +115,7 @@ namespace TVMediaHub.Tizen.Views public FooterNormalStatus() { InitializeComponent(); - InitializeDropdownLists(); + InitializeFooterItems(); PropertyChanged += FooterNormalStatusPropertyChanged; } @@ -108,23 +129,40 @@ namespace TVMediaHub.Tizen.Views { DropdownSort.ItemsSource = SortOptions; } - else if (e.PropertyName.Equals("OptionList")) + else if (e.PropertyName.Equals("IsFooterEnabled")) { - DropdownOption.ItemsSource = OptionList; + DropdownSource.IsEnabled = IsFooterEnabled; + DropdownSort.IsEnabled = IsFooterEnabled; + ButtonOption.IsEnabled = IsFooterEnabled; + if (!IsFooterEnabled) + { + ButtonOption.Text = ""; + } + else + { + ButtonOption.Text = "OPTION"; + } } } /// - /// A method for initializing DropdownLists + /// A method for initializing footer items /// - private void InitializeDropdownLists() + private void InitializeFooterItems() { DropdownSource = new DropdownList(); DropdownSort = new DropdownList(); - DropdownOption = new DropdownList(); + ButtonOption = new Button(); + + ButtonOption.Text = "OPTION"; + + DropdownSource.IsEnabled = IsFooterEnabled; + DropdownSort.IsEnabled = IsFooterEnabled; + ButtonOption.IsEnabled = IsFooterEnabled; + + DropdownSource.ItemsSource = SourceList; DropdownSort.ItemsSource = SortOptions; - DropdownOption.ItemsSource = OptionList; DropdownSource.ItemSelected += (s, e) => { @@ -136,10 +174,10 @@ namespace TVMediaHub.Tizen.Views OnDropdownSortItemSelected?.Invoke(s, e); }; - DropdownOption.ItemSelected += (s, e) => + ButtonOption.Command = new Command(() => { - OnDropdownOptionItemSelected?.Invoke(s, e); - }; + showContextPopup(); + }); // TODO : Change yConstraint. // Tab Size - 128 @@ -156,11 +194,51 @@ namespace TVMediaHub.Tizen.Views yConstraint: Constraint.Constant(SizeUtils.GetWidthSize(704)), xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(1226))); - Children.Add(DropdownOption, + Children.Add(ButtonOption, heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)), widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(300)), yConstraint: Constraint.Constant(SizeUtils.GetWidthSize(704)), xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(1526))); } + + private void showContextPopup() + { + if (isPopupShowing) + { + return; + } + + ContextPopup popup = new ContextPopup + { + IsAutoHidingEnabled = true, + Orientation = ContextPopupOrientation.Vertical, + DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down), + }; + + if (OptionList != null) + { + foreach(var item in OptionList) + { + popup.Items.Add(new ContextPopupItem(item)); + } + } + + //TODO: need to change the event callback + popup.SelectedIndexChanged += (s, args) => + { + var index = popup.SelectedIndex; + var item = popup.SelectedItem as ContextPopupItem; + OnSelectedOptionIndexChanged.Invoke(s, new ContextPopupSelectedEventArgs(index, item)); + popup.Dismiss(); + }; + + popup.Dismissed += (s, args) => + { + isPopupShowing = false; + }; + + popup.Show(ButtonOption); + isPopupShowing = true; + } } } diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml deleted file mode 100644 index 1e57b28..0000000 --- a/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - Horizontal - - - - \ No newline at end of file diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml.cs deleted file mode 100644 index d1915b5..0000000 --- a/TVMediaHub/TVMediaHub.Tizen/Views/FooterSelectedStatus.xaml.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace TVMediaHub.Tizen.Views -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class FooterSelectedStatus : StackLayout - { - public FooterSelectedStatus() - { - InitializeComponent(); - } - } -} diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml index 00e0cb6..3e3ce88 100755 --- a/TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml +++ b/TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml @@ -21,6 +21,7 @@ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"/> + diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml index 81df9c0..986fe63 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml +++ b/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml @@ -4,29 +4,20 @@ x:Class="TVMediaHub.Tizen.Views.MusicTab" xmlns:Views="clr-namespace:TVMediaHub.Tizen.Views" Title="Music"> - - - - - - - - - - - - - - - - - - + + + + \ No newline at end of file diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml.cs index 6a892ef..52f70b4 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml.cs +++ b/TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml.cs @@ -14,6 +14,8 @@ * limitations under the License. */ +using System; +using TVMediaHub.Tizen.Utils; using Xamarin.Forms; namespace TVMediaHub.Tizen.Views @@ -23,6 +25,13 @@ namespace TVMediaHub.Tizen.Views public MusicTab() { InitializeComponent(); + InitializeSize(); + } + + private void InitializeSize() + { + // TODO : Fix to Guide + NoContentsLabel.FontSize = SizeUtils.GetFontSize(33); } } } diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml deleted file mode 100644 index cf5c91b..0000000 --- a/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml.cs deleted file mode 100644 index 7ede968..0000000 --- a/TVMediaHub/TVMediaHub.Tizen/Views/RecentlyWatchedVideoContent.xaml.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using TVMediaHub.Tizen.Utils; -using Xamarin.Forms; - -namespace TVMediaHub.Tizen.Views -{ - public partial class RecentlyWatchedVideoContent : Grid - { - public RecentlyWatchedVideoContent() - { - InitializeComponent(); - InitializeSize(); - } - - private void InitializeSize() - { - HeightRequest = SizeUtils.GetHeightSize(880); - WidthRequest = SizeUtils.GetWidthSize(642); - - ContentTitle.FontSize = SizeUtils.GetFontSize(40); - ContentTitle.TextColor = Color.FromRgb(255,255,255); - ContentDescription.FontSize = SizeUtils.GetFontSize(22); - ContentDescription.TextColor = Color.FromRgb(137,137,137); - } - } -} diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml index 6f8d3e2..43c6213 100644 --- a/TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml +++ b/TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml @@ -25,6 +25,7 @@ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"/>