1. Adding Scalable Features to Selector, Search View. 09/272109/4
authorshivamv <shivam.v2@samsung.com>
Wed, 9 Mar 2022 08:58:31 +0000 (14:28 +0530)
committershivamv <shivam.v2@samsung.com>
Thu, 10 Mar 2022 08:45:24 +0000 (14:15 +0530)
2. Modifying TopRightView in Player View.

Change-Id: I95c1e69b9d46c943801292e13f0421ea73dec661
Signed-off-by: shivamv <shivam.v2@samsung.com>
music-player/Views/BaseContentView.cs
music-player/Views/BaseSubContentView.cs
music-player/Views/ListItemLayout.cs
music-player/Views/LyricsView.cs
music-player/Views/PlayerView.cs
music-player/Views/SearchView.cs
music-player/Views/SelectListLayout.cs
music-player/Views/SelectorView.cs
music-player/music-player.csproj
packaging/org.tizen.MusicPlayer-1.0.0.tpk

index 47e750fc34e6f0ebab50eaf0e19b52ff5d4ae69b..fd4f821e58ab63483ca49ad06f9867f354f5da64 100755 (executable)
@@ -38,7 +38,7 @@ namespace MusicPlayer.Views
                 Layout = new LinearLayout()
                 {
                     LinearOrientation = LinearLayout.Orientation.Vertical,
-                    Padding = DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0).DpToPx(),
+                    Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),
                 },
             };
             base.Add(contentViewContainer);
@@ -59,8 +59,6 @@ namespace MusicPlayer.Views
             {
                 ThemeChangeSensitive = true,
                 StyleName = "ListBackground",
-                Size2D = new Size2D(1792, 108).DpToPx(),
-                Margin = new Extents(0, 0, 0, 2),
                 ItemsLayouter = new LinearLayouter(),
                 ScrollingDirection = ScrollableBase.Direction.Vertical,
                 WidthSpecification = LayoutParamPolicies.MatchParent,
@@ -142,26 +140,26 @@ namespace MusicPlayer.Views
                         Direction = FlexLayout.FlexDirection.Column,
                         ItemsAlignment = FlexLayout.AlignmentType.Center,
                         Justification = FlexLayout.FlexJustification.FlexStart,
-                        Padding = new Extents(0, 0, 40, 0),
+                        Padding = (DeviceInfo.IsPortrait ? new Extents(0, 0, 343, 0) : new Extents(0, 0, 24, 0)).DpToPx(),
                     }
                 };
                 noItemsAnimation = new LottieAnimationView()
                 {
                     URL = Resources.GetLottiePath() + "no_items_folder.json",
-                    Size2D = new Size2D(700, 560),
+                    Size2D = new Size2D(700, 560).DpToPx(),
                     LoopCount = -1,
                     BackgroundColor = Color.Transparent,
                 };
                 noItemView.Add(noItemsAnimation);
                 TextLabel textLabel = new TextLabel()
                 {
-                    StyleName = "LabelText",
-                    Size2D = new Size2D(1124, 36),
-                    Text = "No results found",
-                    PixelSize = 28,
+                    StyleName = "TitleText",
+                    Size2D = new Size2D(234, 36).DpToPx(),
+                    Text = "No items in folder",
+                    PixelSize = 28.DpToPx(),
                     FontFamily = "BreezeSans",
                     HorizontalAlignment = HorizontalAlignment.Center,
-                    Margin = new Extents(0, 0, 32, 0),
+                    Margin = new Extents(0, 0, 8, 0).DpToPx(),
                 };
                 noItemView.Add(textLabel);
             }
index 7da21d8a5db0260499be844016a8c75e18198b5d..26e053a3f9abce00f48fd999ed43e10e300a24d5 100755 (executable)
@@ -101,8 +101,6 @@ namespace MusicPlayer.Views
             {
                 ThemeChangeSensitive = true,
                 StyleName = "ListBackground",
-                //Size2D = new Size2D(1792, 108),
-                Margin = new Extents(0, 0, 0, 2),
                 ItemsLayouter = new LinearLayouter(),
                 ScrollingDirection = ScrollableBase.Direction.Vertical,
                 WidthSpecification = LayoutParamPolicies.MatchParent,
@@ -139,13 +137,13 @@ namespace MusicPlayer.Views
                         Direction = FlexLayout.FlexDirection.Column,
                         ItemsAlignment = FlexLayout.AlignmentType.Center,
                         Justification = FlexLayout.FlexJustification.FlexStart,
-                        Padding = new Extents(0, 0, 24, 0),
+                        Padding = (DeviceInfo.IsPortrait ? new Extents(0, 0, 343, 0) : new Extents(0, 0, 24, 0)).DpToPx(),
                     }
                 };
                 noItemsAnimation = new LottieAnimationView()
                 {
                     URL = Resources.GetLottiePath() + "no_items_folder.json",
-                    Size2D = new Size2D(700, 560),
+                    Size2D = new Size2D(700, 560).DpToPx(),
                     LoopCount = -1,
                     BackgroundColor = Color.Transparent,
                 };
@@ -153,12 +151,12 @@ namespace MusicPlayer.Views
                 TextLabel textLabel = new TextLabel()
                 {
                     StyleName = "TitleText",
-                    Size2D = new Size2D(234, 36),
+                    Size2D = new Size2D(234, 36).DpToPx(),
                     Text = "No items in folder",
-                    PixelSize = 28,
+                    PixelSize = 28.DpToPx(),
                     FontFamily = "BreezeSans",
                     HorizontalAlignment = HorizontalAlignment.Center,
-                    Margin = new Extents(0, 0, 8, 0),
+                    Margin = new Extents(0, 0, 8, 0).DpToPx(),
                 };
                 noItemView.Add(textLabel);
                 listContainer.Add(noItemView);
index 4c19bcb12f4dec980c4797facc89a6c967e741ed..0fc4bee2cef16d094dd6227f53081c0454ba769d 100755 (executable)
@@ -101,9 +101,9 @@ defaultValueCreator: (bindable) => ((ListItemLayout)bindable).playingStatus);
                 FontFamily = "BreezeSans",\r
                 HorizontalAlignment = HorizontalAlignment.Begin,\r
                 VerticalAlignment = VerticalAlignment.Center,\r
+                FontStyle = UIFontStyles.NormalLight,\r
                 Ellipsis = true,\r
             };\r
-            titleLabel.FontStyle = UIFontStyles.NormalLight;\r
             textView.Add(titleLabel);\r
 \r
             subtitleLabel = new TextLabel()\r
@@ -114,9 +114,9 @@ defaultValueCreator: (bindable) => ((ListItemLayout)bindable).playingStatus);
                 FontFamily = "BreezeSans",\r
                 HorizontalAlignment = HorizontalAlignment.Begin,\r
                 VerticalAlignment = VerticalAlignment.Center,\r
+                FontStyle = UIFontStyles.AllNormal,\r
                 Ellipsis = true,\r
             };\r
-            subtitleLabel.FontStyle = UIFontStyles.AllNormal;\r
             textView.Add(subtitleLabel);\r
             UpdateLabelColors();\r
 \r
index af95a05f67eee4a522dcb3139520ec3c7ed5e110..f080f33faaeac386d6a1a62bdbecb466e5243f6d 100755 (executable)
@@ -27,6 +27,10 @@ namespace MusicPlayer.Views
             this.lyricsViewModel = lyricsViewModel;
             BindingContext = lyricsViewModel.lyricsModel;
             Size2D = new Size2D(ViewSize, ViewSize).DpToPx();
+            if (DeviceInfo.IsPortrait)
+            {
+                Margin = new Extents(0, 0, 24, 0).DpToPx();
+            }
             isAnimating = false;
             AddThumbnail();
             AddLyricsView();
index 61fdf606583f09957836f8b72c2b41f885c2099e..26a9f1ec475afdf59d4e220dfdc139afbfa33580 100755 (executable)
@@ -18,13 +18,9 @@ namespace MusicPlayer.Views
             AlbumArt,
             TrackList,
         }
-        private const int LayoutPadding = 64;
         private const int IconSize = 48;
-        private const int TopBarSize = 120;
-        private const int ControlViewWidth = 640;
         private const int ControlViewHeightLandscape = 386;
         private const int ControlViewHeightPortrait = 438;
-        private const int ControlViewMargin = 315;
         private const int TitleLabelHeight = 48;
         private const int ArtistLabelHeight = 36;
 
@@ -83,7 +79,7 @@ namespace MusicPlayer.Views
             {
                 BackgroundColor = Color.Transparent,
                 WidthSpecification = LayoutParamPolicies.MatchParent,
-                HeightSpecification =LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
                 Layout = new FlexLayout()
                 {
                     Direction = FlexLayout.FlexDirection.Column,
@@ -143,6 +139,7 @@ namespace MusicPlayer.Views
             playerContentView.Add(contentView);
             FlexLayout.SetFlexGrow(contentView, 1);
             FlexLayout.SetFlexShrink(contentView, 1);
+            CreateTopRightView();
             CreateLeftView();
             CreateRightView();
         }
@@ -164,7 +161,11 @@ namespace MusicPlayer.Views
             contentView.Add(leftView);
             if(DeviceInfo.IsPortrait)
             {
-                AddActionButtonAndThumbnail();
+                if (viewState == PlayerViewState.AlbumArt)
+                {
+                    leftView.Add(topRightView);
+                    topRightView.HeightSpecification = 48.DpToPx();
+                }
             }
             else
             {
@@ -188,9 +189,11 @@ namespace MusicPlayer.Views
                 Weight = 0.5f,
             };
             contentView.Add(rightView);
-            if (DeviceInfo.IsPortrait == false)
+            if (DeviceInfo.IsPortrait == false || viewState == PlayerViewState.TrackList)
             {
-                AddActionButtonAndThumbnail();
+                rightView.Add(topRightView);
+                topRightView.HeightSpecification = 200.DpToPx();
+                AddThumbnail();
             }
             AddControlView();
         }
@@ -845,27 +848,8 @@ namespace MusicPlayer.Views
             AddTotalTimeLabel();
         }
 
-        private void UpdateActionButtonView()
-        {
-            topRightView.Remove(actionButtonView);
-            topRightView.Remove(thumb);
-            if (DeviceInfo.IsPortrait && viewState == PlayerViewState.AlbumArt)
-            {
-                topRightView.Margin = new Extents(0, 0, 0, 24).DpToPx();
-                leftView.Add(topRightView);
-                topRightView.HeightSpecification = 48.DpToPx();
-                AddListActionButtons();
-            }
-            else
-            {
-                rightView.Add(topRightView);
-                topRightView.HeightSpecification = 200.DpToPx();
-                AddThumbnail();
-                AddListActionButtons();
-            }
-        }
 
-        private void AddActionButtonAndThumbnail()
+        private void CreateTopRightView()
         {
             topRightView = new View()
             {
@@ -878,7 +862,11 @@ namespace MusicPlayer.Views
                     CellPadding = new Size2D(92, 0).DpToPx(),
                 },
             };
-            UpdateActionButtonView();
+            if (DeviceInfo.IsPortrait)
+            {
+                topRightView.Margin = new Extents(0, 32, 0, 0).DpToPx();
+            }
+            AddListActionButtons();
         }
 
         private void AddListActionButtons()
@@ -985,7 +973,11 @@ namespace MusicPlayer.Views
                     contentView.Remove(leftView);
                     contentView.Add(rightView);
                     contentView.Add(leftView);
-                    UpdateActionButtonView();
+                    topRightView.Remove(actionButtonView);
+                    topRightView.HeightSpecification = 200.DpToPx();
+                    AddThumbnail();
+                    topRightView.Add(actionButtonView);
+                    rightView.Add(topRightView);
                     controlsView.Margin = new Extents(0, 0, 40, 0).DpToPx();
                     rightView.Add(controlsView);
                 }
@@ -1014,7 +1006,9 @@ namespace MusicPlayer.Views
                     contentView.Remove(rightView);
                     contentView.Add(leftView);
                     contentView.Add(rightView);
-                    UpdateActionButtonView();
+                    topRightView.Remove(thumb);
+                    topRightView.HeightSpecification = 48.DpToPx();
+                    leftView.Add(topRightView);
                 }
                 else
                 {
index 0ce951ccadb96bdb7a0775bf61fcfe178b59803c..feea89ffce4ae4721f375b0912dc6c6758d5d587 100755 (executable)
@@ -40,7 +40,9 @@ namespace MusicPlayer.Views
             Layout = new FlexLayout()
             {
                 Direction = FlexLayout.FlexDirection.Column,
-                Padding = new Extents(64, 64, 0, 0).DpToPx(),
+                ItemsAlignment = FlexLayout.AlignmentType.FlexStart,
+                Justification = FlexLayout.FlexJustification.FlexStart,
+                Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),
             };
             AddTopView();
             AddTopViewElements();
@@ -62,17 +64,11 @@ namespace MusicPlayer.Views
             topView = new View()
             {
                 BackgroundColor = Color.Transparent,
-                Size2D = new Size2D(Window.Instance.WindowSize.Width - 128, 120).DpToPx(),
-                Position2D = new Position2D(64, 0).DpToPx(),
-                Layout = new FlexLayout
-                {
-                    Direction = FlexLayout.FlexDirection.Row,
-                    ItemsAlignment = FlexLayout.AlignmentType.Center,
-                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = 120.DpToPx(),
+                Layout = new RelativeLayout(),
             };
             base.Add(topView);
-            FlexLayout.SetFlexGrow(topView, 0);
-            FlexLayout.SetFlexShrink(topView, 0);
         }
 
         private void AddTopViewElements()
@@ -84,20 +80,29 @@ namespace MusicPlayer.Views
                 Margin = new Extents(0, 24, 0, 0).DpToPx(),
             };
             topView.Add(backButton);
+            RelativeLayout.SetLeftTarget(backButton, topView);
+            RelativeLayout.SetLeftRelativeOffset(backButton, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(backButton, RelativeLayout.Alignment.Start);
+            RelativeLayout.SetVerticalAlignment(backButton, RelativeLayout.Alignment.Center);
             backButton.Clicked += BackButtonClicked;
 
             searchLabel = new TextLabel()
             {
                 StyleName = "PageLabel",
                 ThemeChangeSensitive = true,
-                Size2D = new Size2D(960, 48).DpToPx(),
+                HeightSpecification = 48.DpToPx(),
                 Text = "Search",
                 PixelSize = 36.DpToPx(),
                 FontFamily = "BreezeSans",
                 Margin = new Extents(0, 32, 0, 0).DpToPx(),
+                VerticalAlignment = VerticalAlignment.Center,
                 FontStyle = UIFontStyles.NormalLight,
             };
             topView.Add(searchLabel);
+            RelativeLayout.SetLeftTarget(searchLabel, backButton);
+            RelativeLayout.SetLeftRelativeOffset(searchLabel, 1.0f);
+            RelativeLayout.SetFillHorizontal(searchLabel, true);
+            RelativeLayout.SetVerticalAlignment(searchLabel, RelativeLayout.Alignment.Center);
         }
 
         private void AddSearchBox()
@@ -152,6 +157,12 @@ namespace MusicPlayer.Views
             searchBox.Add(crossButton);
             crossButton.Hide();
             topView.Add(searchBox);
+            RelativeLayout.SetLeftTarget(searchBox, searchLabel);
+            RelativeLayout.SetLeftRelativeOffset(searchLabel, 1.0f);
+            RelativeLayout.SetRightTarget(searchBox, topView);
+            RelativeLayout.SetRightRelativeOffset(searchBox, 1.0f);
+            RelativeLayout.SetHorizontalAlignment(searchBox, RelativeLayout.Alignment.End);
+            RelativeLayout.SetVerticalAlignment(searchBox, RelativeLayout.Alignment.Center);
         }
 
         private void TextFieldTextChanged(object sender, TextField.TextChangedEventArgs e)
@@ -188,15 +199,10 @@ namespace MusicPlayer.Views
                 ThemeChangeSensitive = true,
                 StyleName = "ListBackground",
                 WidthSpecification = LayoutParamPolicies.MatchParent,
-                Padding = new Extents(0, 0, 0, 0).DpToPx(),
                 ItemsLayouter = new LinearLayouter(),
                 ItemTemplate = new DataTemplate(() =>
                 {
-                    ListItemLayout layout = new ListItemLayout()
-                    {
-                        Padding = new Extents(0, 0, 0, 0).DpToPx(),
-                        Margin = new Extents(0, 0, 0, 0).DpToPx()
-                    };
+                    ListItemLayout layout = new ListItemLayout();
                     layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "Thumbnail");
                     layout.TitleLabel.SetBinding(TextLabel.TextProperty, "Title");
                     layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "SubTitle");
@@ -287,7 +293,7 @@ namespace MusicPlayer.Views
                             Direction = FlexLayout.FlexDirection.Column,
                             ItemsAlignment = FlexLayout.AlignmentType.Center,
                             Justification = FlexLayout.FlexJustification.FlexStart,
-                            Padding = new Extents(0, 0, 40, 0).DpToPx(),
+                            Padding = (DeviceInfo.IsPortrait ? new Extents(0, 0, 482, 0) : new Extents(0, 0, 40, 0)).DpToPx(),
                         }
                     };
                     noItemsAnimation = new LottieAnimationView()
@@ -301,7 +307,8 @@ namespace MusicPlayer.Views
                     TextLabel textLabel = new TextLabel()
                     {
                         StyleName = "TitleText",
-                        Size2D = new Size2D(1124, 36).DpToPx(),
+                        WidthSpecification = LayoutParamPolicies.MatchParent,
+                        HeightSpecification = 36.DpToPx(),
                         Text = "No results found",
                         PixelSize = 28.DpToPx(),
                         FontFamily = "BreezeSans",
index c83fb9fceb7c308107b56a00e6acf9c8dc99f45e..7d20f070b566beee2da4b8dfa7bda051ae4114a3 100755 (executable)
@@ -7,84 +7,101 @@ namespace MusicPlayer.Views
 {
     class SelectListLayout : RecyclerViewItem
     {
-        private static int Width = 1792;
-        private static int Height = 108;
-
         private const int BoxSize = 36;
         private const int IconSize = 64;
-        private const int LayoutMargin = 16;
-        private const int LayoutPadding = 32;
-        private const int SeperatorHeight = 1;
-        private const int LeftPadding = 64;
-        private const int x = 0;
 
         private CheckBox checkBox;
         private View itemSeperator;
+        private View textView;
         private TextLabel titleLabel;
         private TextLabel subtitleLabel;
         private ImageView icon;
 
-        public SelectListLayout(int width = 1792, int height = 108) : base()
+        public SelectListLayout() : base()
         {
-            base.OnInitialize();
-            Width = width;
-            Height = height;
-            WidthSpecification = Width.DpToPx();
-            HeightSpecification = Height.DpToPx();
-
-            // to show the rounded rect of the bg
-            BackgroundColor = Color.Transparent;
+            OnInitialize();
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = 108.DpToPx();
 
-            checkBox = new CheckBox("CheckBox")
+            Layout = new RelativeLayout()
             {
-                Position2D = new Position2D(x, BoxSize).DpToPx(),
+                Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),
             };
+            BackgroundColor = Color.Transparent;
 
+            checkBox = new CheckBox("CheckBox");
             checkBox.Icon.Opacity = 1.0f;
             checkBox.Icon.Size = new Size2D(BoxSize, BoxSize).DpToPx();
-            base.Add(checkBox);
+            Add(checkBox);
+            RelativeLayout.SetVerticalAlignment(checkBox, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetHorizontalAlignment(checkBox, RelativeLayout.Alignment.Start);
+            RelativeLayout.SetLeftRelativeOffset(checkBox, 0.0f);
 
             icon = new ImageView()
             {
                 WidthSpecification = IconSize.DpToPx(),
                 HeightSpecification = IconSize.DpToPx(),
-                Position2D = new Position2D(x + BoxSize + LayoutPadding, ((Height / 2) - (IconSize / 2))).DpToPx(),
+                Margin = new Extents(32, 0, 0, 0).DpToPx(),
             };
-            base.Add(icon);
+            Add(icon);
+            RelativeLayout.SetLeftTarget(icon, checkBox);
+            RelativeLayout.SetLeftRelativeOffset(icon, 1.0f);
+            RelativeLayout.SetVerticalAlignment(icon, RelativeLayout.Alignment.Center);
 
-            itemSeperator = new View()
+            textView = new View()
             {
-                WidthSpecification = (Width - (2 * LeftPadding)).DpToPx(),
-                HeightSpecification = SeperatorHeight.DpToPx(),
-                ExcludeLayouting = true,
-                Position2D = new Position2D(x, Height - SeperatorHeight).DpToPx(),
-                BackgroundColor = UIColors.ItemSeperator,
+                BackgroundColor = Color.Transparent,
+                HeightSpecification = 76.DpToPx(),
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                    VerticalAlignment = VerticalAlignment.Top,
+                    Margin = new Extents(32, 0, 0, 0).DpToPx(),
+                }
             };
-            base.Add(itemSeperator);
+            Add(textView);
+            RelativeLayout.SetLeftTarget(textView, icon);
+            RelativeLayout.SetLeftRelativeOffset(textView, 1.0f);
+            RelativeLayout.SetRightRelativeOffset(textView, 1.0f);
+            RelativeLayout.SetVerticalAlignment(textView, RelativeLayout.Alignment.Center);
 
             titleLabel = new TextLabel()
             {
                 StyleName = "ItemLabel",
-                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - 2 * LayoutPadding - BoxSize).DpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = 40.DpToPx(),
                 PixelSize = 32.DpToPx(),
                 FontFamily = "BreezeSans",
+                HorizontalAlignment = HorizontalAlignment.Begin,
                 VerticalAlignment = VerticalAlignment.Center,
-                Position2D = new Position2D((x + IconSize + 2 * LayoutPadding + BoxSize), LayoutMargin).DpToPx(),
+                FontStyle = UIFontStyles.NormalLight,
+                Ellipsis = true,
             };
-            base.Add(titleLabel);
+            textView.Add(titleLabel);
 
             subtitleLabel = new TextLabel()
             {
                 StyleName = "ItemLabel",
-                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - 2* LayoutPadding - BoxSize).DpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = 36.DpToPx(),
                 PixelSize = 28.DpToPx(),
                 FontFamily = "BreezeSans",
+                HorizontalAlignment = HorizontalAlignment.Begin,
                 VerticalAlignment = VerticalAlignment.Center,
-                Position2D = new Position2D((x + IconSize + 2 * LayoutPadding + BoxSize), LayoutMargin + 40).DpToPx(),
+                FontStyle = UIFontStyles.AllNormal,
+                Ellipsis = true,
+            };
+            textView.Add(subtitleLabel);
+
+            itemSeperator = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = 2.DpToPx(),
+                BackgroundColor = UIColors.ItemSeperator,
             };
-            base.Add(subtitleLabel);
+            Add(itemSeperator);
+            RelativeLayout.SetVerticalAlignment(itemSeperator, RelativeLayout.Alignment.End);
             IsSelected = false;
         }
 
index e3aba09ebaa0f7af4bbc92260946d697350c782d..1c92dec4483b0dce740e7d7a8ce0304eca02e632 100755 (executable)
@@ -1,6 +1,4 @@
-using System.Collections;
-using System.Collections.Specialized;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using MusicPlayer.ViewModels;
 using Tizen.NUI.Components;
 using Tizen.NUI.BaseComponents;
@@ -20,9 +18,7 @@ namespace MusicPlayer.Views
     class SelectorView <T>: View where T : new()
     {
         private const int LayoutPadding = 64;
-        private const int TextLabelHeight = 48;
-        private const int TextButtonWidth = 260;
-        private const int LayoutMargin = 36;
+        private const int PortraitPadding = 32;
 
         private View topView;
         private View selAllView;
@@ -53,6 +49,7 @@ namespace MusicPlayer.Views
                 Direction = FlexLayout.FlexDirection.Column,
                 ItemsAlignment = FlexLayout.AlignmentType.FlexStart,
                 Justification = FlexLayout.FlexJustification.FlexStart,
+                Padding = (DeviceInfo.IsPortrait ? new Extents(PortraitPadding ,PortraitPadding, 0, 0) : new Extents(LayoutPadding, LayoutPadding, 0, 0)).DpToPx(),
             };
 
             topView = AddTopView();
@@ -74,12 +71,11 @@ namespace MusicPlayer.Views
 
         public List<string> SelectedItemList => selectedItemList;
 
-        private Button CreateButton(string url, int x, int y)
+        private Button CreateButton(string url)
         {
             Button button = new Button("TextButton")
             {
                 Text = url,
-                Position2D = new Position2D(x, y).DpToPx(),
                 IsEnabled = false,
             };
             return button;
@@ -90,13 +86,9 @@ namespace MusicPlayer.Views
             View topView = new View()
             {
                 BackgroundColor = Color.Transparent,
-                WidthSpecification = Window.Instance.WindowSize.Width.DpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = 120.DpToPx(),
-                Layout = new FlexLayout()
-                {
-                    Direction = FlexLayout.FlexDirection.Row,
-                    Padding = new Extents(LayoutPadding, LayoutPadding, LayoutMargin, LayoutMargin).DpToPx(),
-                },
+                Layout = new RelativeLayout(),
             };
             base.Add(topView);
             return topView;
@@ -107,8 +99,7 @@ namespace MusicPlayer.Views
             selectedCountLabel = new TextLabel()
             {
                 StyleName = "TitleText",
-                Size2D = new Size2D(1192, TextLabelHeight).DpToPx(),
-                Position2D = new Position2D(LayoutPadding, 0).DpToPx(),
+                HeightSpecification = 48.DpToPx(),
                 PixelSize = 36.DpToPx(),
                 FontFamily = "BreezeSans",
                 HorizontalAlignment = HorizontalAlignment.Begin,
@@ -118,11 +109,29 @@ namespace MusicPlayer.Views
             selectedCountLabel.BindingContext = viewModel;
             selectedCountLabel.SetBinding(TextLabel.TextProperty, "SelectedCount");
             topView.Add(selectedCountLabel);
+
+            RelativeLayout.SetLeftTarget(selectedCountLabel, topView);
+            RelativeLayout.SetLeftRelativeOffset(selectedCountLabel, 0.0f);
+            RelativeLayout.SetFillHorizontal(selectedCountLabel, true);
+            RelativeLayout.SetVerticalAlignment(selectedCountLabel, RelativeLayout.Alignment.Center);
         }
 
         private void AddButtons()
         {
-            cancelButton = CreateButton("Cancel", Window.Instance.WindowSize.Width - LayoutPadding - 2 * TextButtonWidth -40, LayoutMargin);
+            doneButton = CreateButton("Done");
+            doneButton.Margin = new Extents(40, 0, 0, 0).DpToPx();
+            topView.Add(doneButton);
+            doneButton.Clicked += (object o, ClickedEventArgs args) =>
+            {
+                OnDone();
+            };
+
+            RelativeLayout.SetRightTarget(doneButton, topView);
+            RelativeLayout.SetRightRelativeOffset(doneButton, 1.0f);
+            RelativeLayout.SetHorizontalAlignment(doneButton, RelativeLayout.Alignment.End);
+            RelativeLayout.SetVerticalAlignment(doneButton, RelativeLayout.Alignment.Center);
+
+            cancelButton = CreateButton("Cancel");
             cancelButton.Margin = new Extents(40, 0, 0, 0).DpToPx();
             cancelButton.IsEnabled = true;
             topView.Add(cancelButton);
@@ -131,13 +140,12 @@ namespace MusicPlayer.Views
                 OnCancel();
             };
 
-            doneButton = CreateButton("Done", Window.Instance.WindowSize.Width - LayoutPadding - TextButtonWidth, LayoutMargin);
-            doneButton.Margin = new Extents(40, 0, 0, 0).DpToPx();
-            topView.Add(doneButton);
-            doneButton.Clicked += (object o, ClickedEventArgs args) =>
-            {
-                OnDone();
-            };
+            RelativeLayout.SetRightTarget(cancelButton, doneButton);
+            RelativeLayout.SetRightRelativeOffset(cancelButton, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(cancelButton, RelativeLayout.Alignment.End);
+            RelativeLayout.SetVerticalAlignment(cancelButton, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetRightTarget(selectedCountLabel, cancelButton);
+            RelativeLayout.SetRightRelativeOffset(selectedCountLabel, 0.0f);
         }
 
         private void OnCancel()
@@ -204,10 +212,16 @@ namespace MusicPlayer.Views
             {
                 StyleName = "SelectAllBg",
                 ThemeChangeSensitive = true,
-                WidthSpecification = (Window.Instance.WindowSize.Width - 2 * LayoutPadding).DpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = 108.DpToPx(),
-                Position2D = new Position2D(LayoutPadding,120).DpToPx(),
-                Margin = new Extents(LayoutPadding,LayoutPadding,0,40).DpToPx(),
+                Margin = new Extents(0, 0, 0, 40).DpToPx(),
+                Layout = new LinearLayout
+                {
+                    LinearOrientation= LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    Padding = (DeviceInfo.IsPortrait ? new Extents(PortraitPadding, PortraitPadding, 34, 34) : new Extents(LayoutPadding, LayoutPadding, 34, 34)).DpToPx()
+                },
             };
             base.Add(selAllView);
             return selAllView;
@@ -218,8 +232,7 @@ namespace MusicPlayer.Views
             selAllButton = new CheckBox()
             {
                 Size2D = new Size2D(36, 36).DpToPx(),
-                Position2D = new Position2D(LayoutPadding, LayoutMargin).DpToPx(),
-                Margin = new Extents(LayoutPadding, 32, LayoutMargin, LayoutMargin).DpToPx(),
+                Margin = new Extents(0, 32, 2, 2).DpToPx(),
             };
             selAllView.Add(selAllButton);
             selAllButton.Clicked += OnSelAllClicked;
@@ -228,9 +241,7 @@ namespace MusicPlayer.Views
             {
                 StyleName ="LabelText",
                 Text = "Select All",
-                Size2D = new Size2D(1596, 40).DpToPx(),
-                Margin = new Extents(0,LayoutPadding,34,34).DpToPx(),
-                Position2D = new Position2D(LayoutPadding+36+32, 34).DpToPx(),
+                HeightSpecification = 40.DpToPx(),
                 PixelSize = 32.DpToPx(),
                 FontFamily = "BreezeSans",
                 HorizontalAlignment = HorizontalAlignment.Begin,
@@ -244,7 +255,6 @@ namespace MusicPlayer.Views
         {
             if(selAllButton.IsSelected)
             {
-                doneButton.IsEnabled = true;
                 foreach (object item in collectionView.ItemsSource)
                 {
                     if (!collectionView.SelectedItems.Contains(item))
@@ -253,6 +263,10 @@ namespace MusicPlayer.Views
                     }
                 }
                 itemCount = viewModel.TotalCount;
+                if (itemCount > 0)
+                {
+                    doneButton.IsEnabled = true;
+                }
             }
             else
             {
@@ -283,8 +297,7 @@ namespace MusicPlayer.Views
             {
                 ThemeChangeSensitive = true,
                 StyleName = "ListBackground",
-                Size2D = new Size2D(1792, 108).DpToPx(),
-                Margin = new Extents(LayoutPadding, LayoutPadding, 0, 0).DpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
                 ItemsLayouter = new LinearLayouter(),
                 ScrollingDirection = ScrollableBase.Direction.Vertical,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
@@ -377,7 +390,9 @@ namespace MusicPlayer.Views
                         artistItem.IsSelected = false;
                         string text = artistItem.ArtistName;
                         if (text == "Unknown")
-                            text = "";
+                        {
+                            text = string.Empty;
+                        }
                         List<AudioInfo> artistTrackList = ArtistDataProvider.GetArtistTrackList(text);
                         foreach (AudioInfo track in artistTrackList)
                         {
@@ -416,7 +431,9 @@ namespace MusicPlayer.Views
                         artistItem.IsSelected = true;
                         string text = artistItem.ArtistName;
                         if (text == "Unknown")
-                            text = "";
+                        {
+                            text = string.Empty;
+                        }
                         List<AudioInfo> artistTrackList = ArtistDataProvider.GetArtistTrackList(text);
                         foreach (AudioInfo track in artistTrackList)
                         {
@@ -441,17 +458,9 @@ namespace MusicPlayer.Views
             }
 
             viewModel.SelectedCount = itemCount.ToString();
-
-            if (itemCount == 0)
-                doneButton.IsEnabled = false;
-            else
-                doneButton.IsEnabled = true;
-
+            doneButton.IsEnabled = itemCount != 0;
             Tizen.Log.Debug(AppConstants.LogTag, "Total tracks selected " + selectedItemList.Count);
-            if (itemCount == viewModel.TotalCount)
-                selAllButton.IsSelected = true;
-            else
-                selAllButton.IsSelected = false;
+            selAllButton.IsSelected = itemCount == viewModel.TotalCount;
         }
     }
 }
index 55b1c15b99b43dec5e2e8a87df23d6552faebc20..b7b95f9a70713b6964996a8e942460397cbde298 100755 (executable)
@@ -19,7 +19,7 @@
   </ItemGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="10.0.0.16997">\r
+    <PackageReference Include="Tizen.NET" Version="10.0.0.17007">\r
       <ExcludeAssets>Runtime</ExcludeAssets>\r
     </PackageReference>\r
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.7" />\r
index d00fe57635dc88a4c9fed822f56810747760eff6..97f156845ee8c7468d672ec9baee93244943bc45 100755 (executable)
Binary files a/packaging/org.tizen.MusicPlayer-1.0.0.tpk and b/packaging/org.tizen.MusicPlayer-1.0.0.tpk differ