using Shared;
using System;
using System.Collections.Generic;
using System.Text;
using HDL_ON.UI.CSS;
using HDL_ON.Entity;
using HDL_ON.DriverLayer;
using HDL_ON.UI.Music;
using HDL_ON.UI.UI2.Intelligence.Automation;
using System.Linq;
using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView;
using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
namespace HDL_ON.UI.UI2.FuntionControlView.Aks
{
///
/// 影片详情界面
///
public class DetailPage : FrameLayout
{
public DetailPage()
{
}
///
/// 头部布局
///
private TopView topView;
///
/// 删除设备后需要更新界面的回调
///
public Action action;
///
/// 立即播放
///
Button btnPaly;
public void Show()
{
//初始化UI
this.InitTop();
this.InitMiddle();
//初始化事件
this.EventListener();
//读取数据
}
///
/// 初始化头部界面
///
private void InitTop()
{
this.BackgroundColor = MusicColor.ViewColor;
this.topView = new TopView();
this.topView.setBtn.Visible = false;
this.topView.topNameBtn.TextID = StringId.yingpianjieshao;
this.AddChidren(topView.TopFLayoutView());
}
///
/// 初始化中部界面
///
private void InitMiddle()
{
var vv = new VerticalScrolViewLayout
{
Y = topView.fLayout.Bottom,
Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
BackgroundColor = MusicColor.WhiteColor,
};
this.AddChidren(vv);
BaseFramLayout baseFramLayout = new BaseFramLayout();
vv.AddChidren(baseFramLayout);
Button btnImage = new Button
{
X = Application.GetRealWidth(16),
Y = Application.GetRealHeight(16),
Width = Application.GetRealWidth(140),
Height = Application.GetRealHeight(180),
BackgroundColor = 0xff765723,
//UnSelectedImagePath = "AksIcon/kai.png",
Radius = (uint)Application.GetRealHeight(12),
};
baseFramLayout.AddChidren(btnImage);
//电影名称
Button btnName = new Button
{
X = btnImage.Right + Application.GetRealWidth(16),
Y = Application.GetRealHeight(36),
Width = Application.GetRealWidth(178),
Height = Application.GetRealHeight(45),
Text = "嗨起来了兄弟们,年底分红,你拿7份,我拿3份",
TextColor = MusicColor.TextColor,
TextSize = TextSize.Text16,
TextAlignment = TextAlignment.CenterLeft,
IsBold = true,
IsMoreLines=true,
};
baseFramLayout.AddChidren(btnName);
this.AdjustRealWidth(btnName, 178);
//年份
Button btnYear = new Button
{
X = btnImage.Right + Application.GetRealWidth(16),
Y = btnName.Bottom + Application.GetRealHeight(12),
Width = Application.GetRealWidth(34),
Height = Application.GetRealHeight(20),
Text = "2023",
TextColor = MusicColor.TextColor,
TextSize = TextSize.Text14,
TextAlignment = TextAlignment.CenterLeft,
};
baseFramLayout.AddChidren(btnYear);
this.AdjustRealWidth(btnYear, 34);
//"/"
Button btnSlope = new Button
{
X = btnYear.Right + Application.GetRealWidth(8),
Y = btnName.Bottom + Application.GetRealHeight(12),
Width = Application.GetRealWidth(34),
Height = Application.GetRealHeight(20),
Text = "/",
TextColor = MusicColor.LineColor,
TextSize = TextSize.Text14,
};
baseFramLayout.AddChidren(btnSlope);
//地区
Button btnRegion = new Button
{
X = btnSlope.Right + Application.GetRealWidth(8),
Y = btnName.Bottom + Application.GetRealHeight(12),
Width = Application.GetRealWidth(140),
Height = Application.GetRealHeight(20),
Text = "中国好电影",
TextColor = MusicColor.TextColor,
TextSize = TextSize.Text14,
TextAlignment = TextAlignment.CenterLeft,
};
baseFramLayout.AddChidren(btnRegion);
this.AdjustRealWidth(btnRegion, 140);
//电影分数
Button btnGrade = new Button
{
X = btnImage.Right + Application.GetRealWidth(16),
Y = btnYear.Bottom + Application.GetRealHeight(20),
Width = Application.GetRealWidth(45),
Height = Application.GetRealHeight(43),
Text = "9.9",
TextSize = 32,
TextColor = MusicColor.TextColor,
TextAlignment = TextAlignment.CenterLeft,
IsBold = true,
};
baseFramLayout.AddChidren(btnGrade);
this.AdjustRealWidth(btnGrade, 45);
//
Button btnScore = new Button
{
X = btnGrade.Right + Application.GetRealWidth(8),
Y = btnYear.Bottom + Application.GetRealHeight(46),
Width = Application.GetRealWidth(26),
Height = Application.GetRealHeight(17),
TextID = StringId.pingfen,
TextColor = 0xffA5AEBC,
TextSize = TextSize.Text12,
TextAlignment = TextAlignment.CenterLeft,
};
baseFramLayout.AddChidren(btnScore);
Button btnCollectImage = new Button
{
X = btnImage.Right + Application.GetRealWidth(167),
Y = btnRegion.Bottom + Application.GetRealHeight(12),
Width = Application.GetRealWidth(32),
Height = Application.GetRealWidth(32),
UnSelectedImagePath = "MusicIcon/collect.png",
SelectedImagePath = "MusicIcon/collectSelected.png",
};
baseFramLayout.AddChidren(btnCollectImage);
Button btnCollectText = new Button
{
X = btnImage.Right + Application.GetRealWidth(169),
Y = btnCollectImage.Bottom + Application.GetRealHeight(2),
Width = Application.GetRealWidth(36),
Height = Application.GetRealHeight(17),
TextID = StringId.weishoucang,
TextColor = 0xffA5AEBC,
TextSize = TextSize.Text12,
TextAlignment = TextAlignment.CenterLeft,
};
baseFramLayout.AddChidren(btnCollectText);
//电影简介
Button btnIntroduceTitle = new Button
{
X =Application.GetRealWidth(16),
Y = btnImage.Bottom + Application.GetRealHeight(28),
Width = Application.GetRealWidth(300),
Height = Application.GetRealHeight(23),
//TextID = StringId.,
Text= "电影简介",
TextColor = MusicColor.TextColor,
TextSize = TextSize.Text16,
TextAlignment = TextAlignment.CenterLeft,
IsBold=true,
};
baseFramLayout.AddChidren(btnIntroduceTitle);
//电影简介内容
Button btnIntroduceContent = new Button
{
X = Application.GetRealWidth(16),
Y = btnIntroduceTitle.Bottom + Application.GetRealHeight(12),
Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(140),
//TextID = StringId.,
Text = "电影名称:《可怕的一堂课》电影长度:大约1小时左右演员介绍:主人公:本人(也就是我)配角:表哥、表哥的妈妈、本人的妈妈、可怕的老师和一些学生影片简介:在一个阳光明媚的早晨,我和表哥被各自的妈妈逼着去一个英语学校学英语。虽然早晨阳光明媚,但我的心里却在下着大雨(心情很不好),要是英语课能变成电脑课就好了(我的强项)",
TextColor = MusicColor.TextCancelColor,
TextSize = TextSize.Text14,
TextAlignment = TextAlignment.TopLeft,
IsBold = true,
IsMoreLines=true,
};
baseFramLayout.AddChidren(btnIntroduceContent);
#region -----演员照片 名称------
//演员
Button btnActor = new Button
{
X = Application.GetRealWidth(16),
Y = btnIntroduceContent.Bottom + Application.GetRealHeight(28),
Width = Application.GetRealWidth(300),
Height = Application.GetRealHeight(23),
//TextID = StringId.yan,
Text = "演员",
TextColor = MusicColor.TextColor,
TextSize = TextSize.Text16,
TextAlignment = TextAlignment.CenterLeft,
IsBold = true,
};
baseFramLayout.AddChidren(btnActor);
HorizontalScrolViewLayout horizontalFram = new HorizontalScrolViewLayout {
Y= btnActor.Bottom+ Application.GetRealHeight(12),
X = Application.GetRealWidth(16),
Height =Application.GetRealHeight(112),
Width=Application.GetRealWidth(375-16),
};
baseFramLayout.AddChidren(horizontalFram);
for (int i = 0; i < 6; i++)
{
FrameLayout actorFrame = new FrameLayout
{
Height = Application.GetRealHeight(112),
Width = Application.GetRealWidth(72),
};
horizontalFram.AddChidren(actorFrame);
Button btnActorImage = new Button
{
Width = Application.GetRealWidth(72),
Height = Application.GetRealHeight(84),
Radius = (uint)Application.GetRealHeight(8),
//UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
BackgroundColor = 0xff765876,
};
actorFrame.AddChidren(btnActorImage);
Button btnActorName = new Button
{
Y = btnActorImage.Bottom + Application.GetRealHeight(8),
Width = Application.GetRealWidth(72),
Height = Application.GetRealHeight(20),
TextSize = TextSize.Text14,
TextColor = MusicColor.TextColor,
TextAlignment = TextAlignment.Center,
IsMoreLines = true,
Text = "刘德华",
};
actorFrame.AddChidren(btnActorName);
//间隔,弄个空的进去占位置
Button btnSpacing = new Button
{
Width = Application.GetRealWidth(8),
};
horizontalFram.AddChidren(btnSpacing);
}
#endregion
//立即播放
btnPaly = new Button
{
Y = horizontalFram.Bottom + Application.GetRealHeight(70),
Width = Application.GetRealWidth(220),
Height = Application.GetRealHeight(44),
TextID = StringId.lijibofang,
TextColor = MusicColor.WhiteColor,
TextSize = TextSize.Text16,
TextAlignment = TextAlignment.Center,
Gravity=Gravity.CenterHorizontal,
BackgroundColor=MusicColor.SelectedColor,
Radius=(uint)Application.GetRealHeight(22),
};
baseFramLayout.AddChidren(btnPaly);
baseFramLayout.AdjustRealHeight(37);
}
///
/// 注册事件
///
private void EventListener()
{
//返回
this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
this.RemoveFromParent();
};
//立即播放
this.btnPaly.MouseUpEventHandler += (sender, e) =>
{
};
}
///
/// 重新计算button宽度
///
/// 控件
/// 宽度最大最
/// 内边距
private void AdjustRealWidth(Button button, int widthMax = 0, int padding = 0)
{
if (button == null)
{
return;
}
int width;
if (widthMax == 0)
{
//内边距
width = button.GetTextWidth() + Application.GetRealWidth(padding * 2);
}
else
{
if (button.GetTextWidth() > Application.GetRealWidth(widthMax))
{
width = Application.GetRealWidth(widthMax);
}
else
{
width = button.GetTextWidth();
}
}
button.Width = width;
}
}
}