Adding layout in ListItemView 71/271771/2
authoraman.jeph <aman.jeph@samsung.com>
Mon, 28 Feb 2022 10:39:08 +0000 (16:09 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Mon, 28 Feb 2022 10:56:17 +0000 (16:26 +0530)
Change-Id: I1384a072ab1f64b39d18a4c239af377effc9c994
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
music-player/Views/ListItemLayout.cs
packaging/org.tizen.MusicPlayer-1.0.0.tpk

index e94d88678322a41538472e927bd3b85455838de9..ae2547a5030a1f84dfae214b084ed7f651327410 100755 (executable)
@@ -9,18 +9,13 @@ namespace MusicPlayer.Views
 {\r
     class ListItemLayout : RecyclerViewItem\r
     {\r
-        private static int Width = 1792;\r
-        private static int Height = 108;\r
         private static bool AnimationRequired;\r
 \r
         private const int IconSize = 64;\r
-        private const int LayoutMargin = 16;\r
-        private const int LayoutPadding = 32;\r
-        private const int SeperatorHeight = 1;\r
-        private const int LeftPadding = 64;\r
-        private const int x = 0;\r
+        private const int SeperatorHeight = 2;\r
 \r
         private View itemSeperator;\r
+        private View textView;\r
         private TextLabel titleLabel;\r
         private TextLabel subtitleLabel;\r
         private ImageView icon;\r
@@ -60,54 +55,79 @@ defaultValueCreator: (bindable) => ((ListItemLayout)bindable).playingStatus);
 \r
         public ListItemLayout(bool animationRequired = false, int width = 1792, int height = 108) : base()\r
         {\r
-            base.OnInitialize();\r
-            Width = width;\r
-            Height = height;\r
+            OnInitialize();\r
             AnimationRequired = animationRequired;\r
-            WidthSpecification = Width;\r
-            HeightSpecification = Height;\r
-            Size2D = new Size2D(Width, Height).DpToPx();\r
-            // to show the rounded rect of the bg\r
-            BackgroundColor = Color.Transparent;\r
+            WidthSpecification = LayoutParamPolicies.MatchParent;\r
+            HeightSpecification = height.DpToPx();\r
+\r
+            Layout = new RelativeLayout()\r
+            {\r
+                Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),\r
+            };\r
 \r
             icon = new ImageView()\r
             {\r
-                Size2D = new Size2D(IconSize, IconSize).DpToPx(),\r
-                Position2D = new Position2D(x, ((Height / 2) - (IconSize / 2))).DpToPx(),\r
+                WidthSpecification = IconSize.DpToPx(),\r
+                HeightSpecification = IconSize.DpToPx(),\r
             };\r
-            base.Add(icon);\r
+            Add(icon);\r
+            RelativeLayout.SetVerticalAlignment(icon, RelativeLayout.Alignment.Center);\r
+            RelativeLayout.SetHorizontalAlignment(icon, RelativeLayout.Alignment.Start);\r
+            RelativeLayout.SetLeftRelativeOffset(icon, 0.0f);\r
 \r
-            itemSeperator = new View()\r
+            textView = new View()\r
             {\r
-                Size2D = new Size2D((Width - (2 * LeftPadding)), SeperatorHeight).DpToPx(),\r
-                ExcludeLayouting = true,\r
-                Position2D = new Position2D(x, Height - SeperatorHeight).DpToPx(),\r
-                BackgroundColor = UIColors.ItemSeperator,\r
+                HeightSpecification = 76.DpToPx(),\r
+                Layout = new LinearLayout()\r
+                {\r
+                    LinearOrientation = LinearLayout.Orientation.Vertical,\r
+                    HorizontalAlignment = HorizontalAlignment.Begin,\r
+                    VerticalAlignment = VerticalAlignment.Top,\r
+                    Margin = new Extents(32, 0, 0, 0).DpToPx(),\r
+                }\r
             };\r
-            base.Add(itemSeperator);\r
+            Add(textView);\r
+            RelativeLayout.SetLeftTarget(textView, icon);\r
+            RelativeLayout.SetLeftRelativeOffset(textView, 1.0f);\r
+            RelativeLayout.SetRightRelativeOffset(textView, 1.0f);\r
+            RelativeLayout.SetVerticalAlignment(textView, RelativeLayout.Alignment.Center);\r
 \r
             titleLabel = new TextLabel()\r
             {\r
-                Size2D = new Size2D((Width - (2 * LeftPadding) - IconSize - LayoutPadding), 40).DpToPx(),\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 40.DpToPx(),\r
                 PixelSize = 32.DpToPx(),\r
                 FontFamily = "BreezeSans",\r
+                HorizontalAlignment = HorizontalAlignment.Begin,\r
                 VerticalAlignment = VerticalAlignment.Center,\r
-                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin).DpToPx(),\r
+                Ellipsis = true,\r
             };\r
             titleLabel.FontStyle = UIFontStyles.NormalLight;\r
-            base.Add(titleLabel);\r
+            textView.Add(titleLabel);\r
 \r
             subtitleLabel = new TextLabel()\r
             {\r
-                Size2D = new Size2D((Width - (2 * LeftPadding) - IconSize - LayoutPadding), 36).DpToPx(),\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 36.DpToPx(),\r
                 PixelSize = 28.DpToPx(),\r
                 FontFamily = "BreezeSans",\r
+                HorizontalAlignment = HorizontalAlignment.Begin,\r
                 VerticalAlignment = VerticalAlignment.Center,\r
-                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin + 40).DpToPx(),\r
+                Ellipsis = true,\r
             };\r
             subtitleLabel.FontStyle = UIFontStyles.AllNormal;\r
-            base.Add(subtitleLabel);\r
+            textView.Add(subtitleLabel);\r
             UpdateLabelColors();\r
+\r
+            itemSeperator = new View()\r
+            {\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = SeperatorHeight.DpToPx(),\r
+                BackgroundColor = UIColors.ItemSeperator,\r
+            };\r
+            Add(itemSeperator);\r
+            RelativeLayout.SetVerticalAlignment(itemSeperator, RelativeLayout.Alignment.End);\r
+\r
             ThemeManager.ThemeChanged += OnThemeUpdated;\r
         }\r
         public ImageView Icon\r
@@ -172,7 +192,6 @@ defaultValueCreator: (bindable) => ((ListItemLayout)bindable).playingStatus);
         {\r
             if(currentValue)\r
             {\r
-                Tizen.Log.Debug(AppConstants.LogTag, "Adding animation/play-pause icon and setting highlight color");\r
                 if(titleLabel != null)\r
                 {\r
                     titleLabel.TextColor = UIColors.HEX1473E6;\r
@@ -192,7 +211,6 @@ defaultValueCreator: (bindable) => ((ListItemLayout)bindable).playingStatus);
             }\r
             else\r
             {\r
-                Tizen.Log.Debug(AppConstants.LogTag, "Remove animation/play-pause icon and setting normal color");\r
                 UpdateLabelColors();\r
                 if(AnimationRequired == true && isAnimating)\r
                 {\r
index ab90b7469f21aceacc938057f6b825220db79126..a4f7c26dcfd0095a44d0c948743d5a688d110c97 100755 (executable)
Binary files a/packaging/org.tizen.MusicPlayer-1.0.0.tpk and b/packaging/org.tizen.MusicPlayer-1.0.0.tpk differ