{\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
\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
{\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
}\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