class AlbumDetailLayout : RecyclerViewItem\r
{\r
private View itemSeperator;\r
+ private View textView;\r
private TextLabel titleLabel;\r
private TextLabel subtitleLabel;\r
private TextLabel additionalLabel;\r
\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
-\r
public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create(nameof(IsPlaying), typeof(bool), typeof(AlbumDetailLayout), false, propertyChanged: (bindable, oldValue, newValue) =>\r
{\r
var instance = (AlbumDetailLayout)bindable;\r
},\r
defaultValueCreator: (bindable) => ((AlbumDetailLayout)bindable).isPlaying);\r
\r
- public AlbumDetailLayout(int width = 832, int height = 108) : base()\r
+ public AlbumDetailLayout() : base()\r
{\r
- base.OnInitialize();\r
- WidthSpecification = width;\r
- HeightSpecification = height;\r
- Size2D = new Size2D(width, height).DpToPx();\r
- // to show the rounded rect of the bg\r
+ OnInitialize();\r
+ WidthSpecification = LayoutParamPolicies.MatchParent;\r
+ HeightSpecification = 108.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
BackgroundColor = Color.Transparent;\r
\r
- titleLabel = CreateTitleLabel();\r
- subtitleLabel = CreateSubTitleLabel();\r
- additionalLabel = CreateAdditionalLabel(width);\r
- itemSeperator = CreateItemSeparator(width, height);\r
+ CreateAdditionalLabel();\r
+ CreateTextView();\r
+ CreateTitleLabel();\r
+ CreateSubTitleLabel();\r
+ CreateItemSeparator();\r
UpdateLabelColors();\r
ThemeManager.ThemeChanged += OnThemeUpdated;\r
}\r
\r
- private TextLabel CreateTitleLabel()\r
+ private void CreateTextView()\r
+ {\r
+ textView = new View()\r
+ {\r
+ HeightSpecification = 76.DpToPx(),\r
+ WidthSpecification = (DeviceInfo.IsPortrait ? 748 : 564).DpToPx(),\r
+ BackgroundColor = Color.Transparent,\r
+ Layout = new LinearLayout()\r
+ {\r
+ LinearOrientation = LinearLayout.Orientation.Vertical,\r
+ HorizontalAlignment = HorizontalAlignment.Begin,\r
+ VerticalAlignment = VerticalAlignment.Top,\r
+ },\r
+ };\r
+ Add(textView);\r
+ RelativeLayout.SetRightTarget(textView, additionalLabel);\r
+ RelativeLayout.SetRightRelativeOffset(textView, 0.0f);\r
+ RelativeLayout.SetVerticalAlignment(textView, RelativeLayout.Alignment.Center);\r
+ RelativeLayout.SetHorizontalAlignment(textView, RelativeLayout.Alignment.Start);\r
+ RelativeLayout.SetLeftRelativeOffset(textView, 0.0f);\r
+ }\r
+\r
+ private void CreateTitleLabel()\r
{\r
- TextLabel titleLabel = new TextLabel()\r
+ titleLabel = new TextLabel()\r
{\r
- Size2D = new Size2D(596, 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
- Padding = new Extents(LayoutPadding,0,0,0).DpToPx(),\r
FontStyle = UIFontStyles.NormalLight,\r
- Position2D = new Position2D(X , LayoutMargin).DpToPx(),\r
+ Ellipsis = true,\r
};\r
- base.Add(titleLabel);\r
- return titleLabel;\r
+ textView.Add(titleLabel);\r
}\r
\r
- private TextLabel CreateSubTitleLabel()\r
+ private void CreateSubTitleLabel()\r
{\r
- TextLabel subtitleLabel = new TextLabel()\r
+ subtitleLabel = new TextLabel()\r
{\r
- Size2D= new Size2D(596,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
- Padding = new Extents(LayoutPadding, 0, 0, 0).DpToPx(),\r
FontStyle = UIFontStyles.AllNormal,\r
- Position2D = new Position2D(X, LayoutMargin + 40).DpToPx()\r
+ Ellipsis = true,\r
};\r
- base.Add(subtitleLabel);\r
- return subtitleLabel;\r
+ textView.Add(subtitleLabel);\r
}\r
\r
- private TextLabel CreateAdditionalLabel(int width)\r
+ private void CreateAdditionalLabel()\r
{\r
- TextLabel additionalLabel = new TextLabel()\r
+ additionalLabel = new TextLabel()\r
{\r
- Size2D= new Size2D(108,36).DpToPx(),\r
+ WidthSpecification = 108.DpToPx(),\r
+ HeightSpecification = 36.DpToPx(),\r
PixelSize = 28.DpToPx(),\r
FontFamily = "BreezeSans",\r
VerticalAlignment = VerticalAlignment.Center,\r
HorizontalAlignment = HorizontalAlignment.End,\r
FontStyle = UIFontStyles.AllNormal,\r
- Position2D = new Position2D(width-LayoutPadding-LeftPadding-108, 36).DpToPx()\r
+ Margin = new Extents(32, 0, 0, 0).DpToPx(),\r
+ Ellipsis = true,\r
};\r
- base.Add(additionalLabel);\r
- return additionalLabel;\r
+ Add(additionalLabel);\r
+ RelativeLayout.SetRightRelativeOffset(additionalLabel, 1.0f);\r
+ RelativeLayout.SetVerticalAlignment(additionalLabel, RelativeLayout.Alignment.Center);\r
+ RelativeLayout.SetHorizontalAlignment(additionalLabel, RelativeLayout.Alignment.End);\r
}\r
\r
- private View CreateItemSeparator(int width, int height)\r
+ private void CreateItemSeparator()\r
{\r
- View itemSeperator = new View()\r
+ itemSeperator = new View()\r
{\r
- Size2D = new Size2D(width, SeperatorHeight).DpToPx(),\r
- ExcludeLayouting = true,\r
- Position2D = new Position2D(X , height - SeperatorHeight).DpToPx(),\r
+ WidthSpecification = LayoutParamPolicies.MatchParent,\r
+ HeightSpecification = 2.DpToPx(),\r
BackgroundColor = UIColors.ItemSeperator,\r
};\r
- base.Add(itemSeperator);\r
- return itemSeperator;\r
+ Add(itemSeperator);\r
+ RelativeLayout.SetVerticalAlignment(itemSeperator, RelativeLayout.Alignment.End);\r
}\r
\r
public TextLabel TitleLabel\r
if(DeviceInfo.IsPortrait)\r
{\r
baseLayout.LinearOrientation = LinearLayout.Orientation.Vertical;\r
- baseLayout.Padding = new Extents(32, 32, 0, 0);\r
baseLayout.VerticalAlignment = VerticalAlignment.Top;\r
baseLayout.HorizontalAlignment = HorizontalAlignment.Center;\r
}\r
else\r
{\r
baseLayout.LinearOrientation = LinearLayout.Orientation.Horizontal;\r
- baseLayout.Padding = new Extents(64, 64, 0, 0);\r
baseLayout.VerticalAlignment = VerticalAlignment.Center;\r
baseLayout.HorizontalAlignment = HorizontalAlignment.Begin;\r
}\r
Layout = baseLayout;\r
albumInfoView = CreateLeftView();\r
- AddListContainer();\r
countLabel.BindingContext = viewModel;\r
countLabel.SetBinding(TextLabel.TextProperty, "TotalTracks");\r
+ collectionView.BindingContext = viewModel;\r
UpdateCollectionView();\r
+ Add(listContainer);\r
AddAlbumArt();\r
AddAlbumInfo();\r
TouchEvent += (object source, TouchEventArgs e) => false;\r
return leftView;\r
}\r
\r
- private void AddListContainer()\r
- {\r
- listContainer.WidthSpecification = LayoutParamPolicies.MatchParent;\r
- listContainer.HeightSpecification = LayoutParamPolicies.MatchParent;\r
- base.Add(listContainer);\r
- }\r
-\r
- private View CreateRightView()\r
- {\r
- View rightView = new View()\r
- {\r
- BackgroundColor = Color.Transparent,\r
- Weight = 1.0f,\r
- Layout = new FlexLayout\r
- {\r
- Direction = FlexLayout.FlexDirection.Column,\r
- ItemsAlignment = FlexLayout.AlignmentType.Center,\r
- Justification = FlexLayout.FlexJustification.FlexStart,\r
- },\r
- };\r
- if (DeviceInfo.IsPortrait)\r
- {\r
- rightView.WidthSpecification = LayoutParamPolicies.MatchParent;\r
- }\r
- else\r
- {\r
- rightView.HeightSpecification = LayoutParamPolicies.MatchParent;\r
- }\r
- base.Add(rightView);\r
- return rightView;\r
- }\r
-\r
private void AddAlbumArt()\r
{\r
albumArtIcon = new ImageView()\r
{
class ArtistDetailGroupLayout : RecyclerViewItem
{
- private static int Width = 1792;
- private static int Height = 108;
-
private const int IconSize = 64;
- private const int LayoutPadding = 32;
- private const int SeperatorHeight = 1;
- private const int LeftPadding = 64;
- private const int x = 0;
private View itemSeperator;
private TextLabel titleLabel;
private ImageView icon;
- public ArtistDetailGroupLayout(int width = 1792, int height = 108) : base()
+ public ArtistDetailGroupLayout() : base()
{
- base.OnInitialize();
- base.IsCreateByXaml = true;
- Width = width;
- Height = height;
- WidthSpecification = Width;
- HeightSpecification = Height;
- Size2D = new Size2D(Width, Height).DpToPx();
- // to show the rounded rect of the bg
+ OnInitialize();
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = 108.DpToPx();
+
+ Layout = new RelativeLayout()
+ {
+ Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),
+ };
BackgroundColor = Color.Transparent;
- ThemeChangeSensitive = true;
icon = CreateIcon();
titleLabel = CreateTitleLabel();
itemSeperator = CreateItemSeparator();
- IsCreateByXaml = true;
}
private ImageView CreateIcon()
{
ImageView icon = new ImageView()
{
- Size2D = new Size2D(IconSize, IconSize).DpToPx(),
- Position2D = new Position2D(x, (Height / 2) - (IconSize / 2)).DpToPx(),
+ WidthSpecification = IconSize.DpToPx(),
+ HeightSpecification = IconSize.DpToPx(),
};
- base.Add(icon);
+ Add(icon);
+ RelativeLayout.SetVerticalAlignment(icon, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetHorizontalAlignment(icon, RelativeLayout.Alignment.Start);
+ RelativeLayout.SetLeftRelativeOffset(icon, 0.0f);
return icon;
}
{
View itemSeperator = new View()
{
- Size2D = new Size2D((Width - (2 * LeftPadding)), SeperatorHeight).DpToPx(),
- ExcludeLayouting = true,
- Position2D = new Position2D(x, Height - SeperatorHeight).DpToPx(),
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = 2.DpToPx(),
BackgroundColor = UIColors.ItemSeperator,
};
- base.Add(itemSeperator);
+ Add(itemSeperator);
+ RelativeLayout.SetVerticalAlignment(itemSeperator, RelativeLayout.Alignment.End);
return itemSeperator;
}
TextLabel titleLabel = new TextLabel()
{
StyleName = "ItemLabel",
- ThemeChangeSensitive = true,
- Size2D = new Size2D((Width - (2 * LeftPadding) - IconSize - LayoutPadding), 40).DpToPx(),
+ HeightSpecification = 40.DpToPx(),
PixelSize = 32.DpToPx(),
FontFamily = "BreezeSans",
+ HorizontalAlignment = HorizontalAlignment.Begin,
VerticalAlignment = VerticalAlignment.Center,
- Position2D = new Position2D(x + IconSize + LayoutPadding, 34).DpToPx(),
+ FontStyle = UIFontStyles.NormalLight,
+ Margin = new Extents(32, 0, 0, 0).DpToPx(),
+ Ellipsis = true,
};
- base.Add(titleLabel);
+ Add(titleLabel);
+ RelativeLayout.SetLeftTarget(titleLabel, icon);
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 1.0f);
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 1.0f);
+ RelativeLayout.SetHorizontalAlignment(titleLabel, RelativeLayout.Alignment.Start);
+ RelativeLayout.SetFillHorizontal(titleLabel, true);
+ RelativeLayout.SetVerticalAlignment(titleLabel, RelativeLayout.Alignment.Center);
return titleLabel;
}
{
class ArtistDetailItemLayout : RecyclerViewItem
{
- private static int Width = 1792;
- private static int Height = 108;
-
- private const int LayoutPadding = 32;
- private const int SeperatorHeight = 1;
- private const int LeftPadding = 64;
- private const int x = 0;
-
private View itemSeperator;
private TextLabel titleLabel;
private TextLabel extraLabel;
},
defaultValueCreator: (bindable) => ((ArtistDetailItemLayout)bindable).isPlaying);
- public ArtistDetailItemLayout(int width = 1792, int height = 108) : base()
+ public ArtistDetailItemLayout() : base()
{
- base.OnInitialize();
- Width = width;
- Height = height;
- WidthSpecification = Width;
- HeightSpecification = Height;
- Size2D = new Size2D(Width, Height).DpToPx();
- // to show the rounded rect of the bg
+ OnInitialize();
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = 108.DpToPx();
+
+ Layout = new RelativeLayout()
+ {
+ Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).DpToPx(),
+ };
BackgroundColor = Color.Transparent;
- titleLabel = CreateTitleLabel();
- extraLabel = CreateExtraLabel();
- itemSeperator = CreateItemSeparator();
+ CreateExtraLabel();
+ CreateTitleLabel();
+ CreateItemSeparator();
UpdateLabelColors();
ThemeManager.ThemeChanged += OnThemeUpdated;
}
- private View CreateItemSeparator()
+ private void CreateItemSeparator()
{
- View itemSeperator = new View()
+ itemSeperator = new View()
{
- Size2D = new Size2D((Width - (2 * LeftPadding)), SeperatorHeight).DpToPx(),
- ExcludeLayouting = true,
- Position2D = new Position2D(x, Height - SeperatorHeight).DpToPx(),
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = 2.DpToPx(),
BackgroundColor = UIColors.ItemSeperator,
};
- base.Add(itemSeperator);
- return itemSeperator;
+ Add(itemSeperator);
+ RelativeLayout.SetVerticalAlignment(itemSeperator, RelativeLayout.Alignment.End);
}
- private TextLabel CreateTitleLabel()
+ private void CreateTitleLabel()
{
- TextLabel titleLabel = new TextLabel()
+ titleLabel = new TextLabel()
{
- Size2D = new Size2D(1272, 40).DpToPx(),
+ HeightSpecification = 40.DpToPx(),
PixelSize = 32.DpToPx(),
FontFamily = "BreezeSans",
HorizontalAlignment = HorizontalAlignment.Begin,
VerticalAlignment = VerticalAlignment.Center,
FontStyle = UIFontStyles.NormalLight,
- Position2D = new Position2D(x, 34).DpToPx(),
+ Ellipsis = true,
};
- base.Add(titleLabel);
- return titleLabel;
+ Add(titleLabel);
+ RelativeLayout.SetRightTarget(titleLabel, extraLabel);
+ RelativeLayout.SetRightRelativeOffset(titleLabel, 0.0f);
+ RelativeLayout.SetVerticalAlignment(titleLabel, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetHorizontalAlignment(titleLabel, RelativeLayout.Alignment.Start);
+ RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);
}
- private TextLabel CreateExtraLabel()
+ private void CreateExtraLabel()
{
- TextLabel extraLabel = new TextLabel()
+ extraLabel = new TextLabel()
{
- Size2D = new Size2D(360, 36).DpToPx(),
+ WidthSpecification = 160.DpToPx(),
+ HeightSpecification = 36.DpToPx(),
PixelSize = 28.DpToPx(),
FontFamily = "BreezeSans",
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.End,
FontStyle = UIFontStyles.AllNormal,
- Position2D = new Position2D((x + 1272 + LayoutPadding), 36).DpToPx()
+ Margin = new Extents(32, 0, 0, 0).DpToPx(),
+ Ellipsis = true,
};
- base.Add(extraLabel);
- return extraLabel;
+ Add(extraLabel);
+ RelativeLayout.SetRightRelativeOffset(extraLabel, 1.0f);
+ RelativeLayout.SetVerticalAlignment(extraLabel, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetHorizontalAlignment(extraLabel, RelativeLayout.Alignment.End);
}
public TextLabel TitleLabel
RelativeLayout.SetLeftRelativeOffset(textView, 1.0f);\r
RelativeLayout.SetRightRelativeOffset(textView, 1.0f);\r
RelativeLayout.SetVerticalAlignment(textView, RelativeLayout.Alignment.Center);\r
+ RelativeLayout.SetFillHorizontal(textView, true);\r
\r
titleLabel = new TextLabel()\r
{\r
CreateTopRightView();
CreateLeftView();
CreateRightView();
+ AddListActionButtons();
}
private void CreateLeftView()
};
if (DeviceInfo.IsPortrait)
{
- topRightView.Margin = new Extents(0, 32, 0, 0).DpToPx();
+ topRightView.Margin = new Extents(0, 46, 0, 0).DpToPx();
}
- AddListActionButtons();
}
private void AddListActionButtons()
}),
GroupHeaderTemplate = new DataTemplate(() =>
{
- DefaultTitleItem group = new DefaultTitleItem("DefaultTitle")
- {
- Padding = new Extents(0, 0, 0, 0).DpToPx(),
- Margin = new Extents(0, 0, 0, 0).DpToPx()
- };
+ DefaultTitleItem group = new DefaultTitleItem("DefaultTitle");
group.Label.FontStyle = UIFontStyles.AllNormal;
group.Label.SetBinding(TextLabel.TextProperty, "DataCount");
group.Label.HorizontalAlignment = HorizontalAlignment.Begin;
RelativeLayout.SetLeftRelativeOffset(textView, 1.0f);
RelativeLayout.SetRightRelativeOffset(textView, 1.0f);
RelativeLayout.SetVerticalAlignment(textView, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetFillHorizontal(textView, true);
titleLabel = new TextLabel()
{