using HDL_ON.UI.Music; using System; using Shared; namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView { public class TypeMultiFramLayout { private uint UpBackgroundColor = MusicColor.ViewColor; private uint DownBackgroundColor = 0xFFEFEFEF; /// /// 多个类型容器 /// public FrameLayout multiFramLayout = new FrameLayout { BackgroundColor = MusicColor.ViewColor, X = Application.GetRealWidth(16), Width = Application.GetRealWidth(311), Height = Application.GetRealHeight(40), Radius = (uint)Application.GetRealHeight(20), }; public FrameLayout leftFramLayout = new FrameLayout { X = Application.GetRealWidth(16), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(139), Height = Application.GetRealHeight(23), Radius = (uint)Application.GetRealHeight(20), }; public Button btnBottonLeftImage = new Button { Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "AksIcon/shixuqi.png", Gravity = Gravity.CenterVertical, Name = "btnBottonLeftImage", }; public Button btnBottonName = new Button { Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(23), TextID = StringId.shixuqi, TextSize = TextSize.Text16, TextColor = MusicColor.TextColor, TextAlignment = TextAlignment.CenterLeft, Gravity = Gravity.CenterVertical, IsMoreLines = true, }; public FrameLayout lineFramLayout = new FrameLayout { BackgroundColor = MusicColor.TextColor, Y = Application.GetRealHeight(10), Width = Application.GetRealWidth(1), Height = Application.GetRealHeight(20), }; public FrameLayout rightFramLayout = new FrameLayout { Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(138), Height = Application.GetRealHeight(23), Radius = (uint)Application.GetRealHeight(20), }; public Button btnBottonRightImage = new Button { Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "AksIcon/xuanze.png", Gravity = Gravity.CenterRight, }; public Button btnBottonRightName = new Button { Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(23), TextID = StringId.bofangqi, TextSize = TextSize.Text16, TextColor = MusicColor.TextColor, TextAlignment = TextAlignment.CenterRight, Gravity = Gravity.CenterVertical, IsMoreLines = true, }; public void AddView(FrameLayout layout) { layout.AddChidren(multiFramLayout); multiFramLayout.AddChidren(leftFramLayout); leftFramLayout.AddChidren(btnBottonLeftImage); leftFramLayout.AddChidren(btnBottonName); multiFramLayout.AddChidren(lineFramLayout); multiFramLayout.AddChidren(rightFramLayout); rightFramLayout.AddChidren(btnBottonRightImage); rightFramLayout.AddChidren(btnBottonRightName); btnBottonName.X = btnBottonLeftImage.Right + Application.GetRealWidth(4); lineFramLayout.X = leftFramLayout.Right; rightFramLayout.X = lineFramLayout.Right; btnBottonRightName.X = btnBottonLeftImage.Right + Application.GetRealWidth(4); } public void SetClickUpBackgroundColor(uint backgroundColor) { this.UpBackgroundColor = backgroundColor; } public void SetClickDownBackgroundColor(uint backgroundColor) { this.DownBackgroundColor = backgroundColor; } /// /// 序时器类型容器 /// /// 回调(第一个是父类对象 public void SetLeftFlClickListener(Action action) { EventHandler UpClick = (sender, e) => { //leftFramLayout.BackgroundColor = this.UpBackgroundColor; //弹起来还原背景颜色 }; leftFramLayout.MouseUpEventHandler += UpClick; btnBottonLeftImage.MouseUpEventHandler += UpClick; btnBottonName.MouseUpEventHandler += UpClick; EventHandler DownClick = (sender, e) => { //按下去改变背景颜色 //leftFramLayout.BackgroundColor = this.DownBackgroundColor; action?.Invoke(leftFramLayout); }; leftFramLayout.MouseDownEventHandler += DownClick; btnBottonLeftImage.MouseDownEventHandler += DownClick; btnBottonName.MouseDownEventHandler += DownClick; } /// /// 播放器类型容器 /// /// 回调(第一个是父类对象 public void SetRightFlClickListener(Action action) { EventHandler UpClick = (sender, e) => { //rightFramLayout.BackgroundColor = this.UpBackgroundColor; //弹起来还原背景颜色 }; rightFramLayout.MouseUpEventHandler += UpClick; btnBottonRightImage.MouseUpEventHandler += UpClick; btnBottonRightName.MouseUpEventHandler += UpClick; EventHandler DownClick = (sender, e) => { //按下去改变背景颜色 //rightFramLayout.BackgroundColor = this.DownBackgroundColor; action?.Invoke(rightFramLayout); }; rightFramLayout.MouseDownEventHandler += DownClick; btnBottonRightImage.MouseDownEventHandler += DownClick; btnBottonRightName.MouseDownEventHandler += DownClick; } } }