| | |
| | | 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; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Aks |
| | | { |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public class DetailPage : FrameLayout |
| | | { |
| | | public DetailPage() |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="remoteControlEntity">遥控器对象</param> |
| | | /// <param name="movieLibrary">影片对象</param> |
| | | public DetailPage(RemoteControlEntity remoteControlEntity, MovieLibrary movieLibrary) |
| | | { |
| | | this.remoteControl = remoteControlEntity; |
| | | this.movieLibrary = movieLibrary; |
| | | //从缓存获取 |
| | | this.movieLibraryInfo = AksCommonMethod.Current.GetMovieLibraryInfo(remoteControl.rcId + "_" + movieLibrary.movieId); |
| | | } |
| | | /// <summary> |
| | | /// 当前的遥控器对象 |
| | | /// </summary> |
| | | RemoteControlEntity remoteControl; |
| | | /// <summary> |
| | | /// 影片详情 |
| | | /// </summary> |
| | | MovieLibraryInfoEntity movieLibraryInfo; |
| | | |
| | | /// <summary> |
| | | /// 头部布局 |
| | | /// </summary> |
| | | private TopView topView; |
| | | /// <summary> |
| | | /// 删除设备后需要更新界面的回调 |
| | | /// </summary> |
| | | public Action action; |
| | | |
| | | /// <summary> |
| | | /// 立即播放 |
| | | /// </summary> |
| | | Button btnPaly; |
| | | |
| | | /// <summary> |
| | | /// 影片 |
| | | /// </summary> |
| | | MovieLibrary movieLibrary; |
| | | |
| | | /// <summary> |
| | | /// 年份 |
| | | /// </summary> |
| | | Button btnYear; |
| | | /// <summary> |
| | | /// 地区 |
| | | /// </summary> |
| | | Button btnRegion; |
| | | /// <summary> |
| | | /// 收藏 |
| | | /// </summary> |
| | | Button btnCollectImage; |
| | | Button btnCollectText; |
| | | /// <summary> |
| | | /// 电影简介内容 |
| | | /// </summary> |
| | | Button btnIntroduceContent; |
| | | /// <summary> |
| | | /// 演员图片列表容器 |
| | | /// </summary> |
| | | HorizontalScrolViewLayout horizontalFram; |
| | | |
| | | public Action<bool> action; |
| | | |
| | | |
| | | private bool isOldState; |
| | | |
| | | |
| | | public void Show() |
| | | { |
| | |
| | | //初始化事件 |
| | | this.EventListener(); |
| | | //读取数据 |
| | | ReadData(); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private void InitMiddle() |
| | | { |
| | | var vv = new VerticalScrolViewLayout |
| | | var vv = new VerticalRefreshLayout |
| | | { |
| | | Y = topView.fLayout.Bottom, |
| | | Height = Application.GetRealHeight(H_W.H - H_W.T_Height), |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | }; |
| | | this.AddChidren(vv); |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | vv.EndHeaderRefreshing(); |
| | | movieLibraryInfo = null; |
| | | ReadData(); |
| | | }; |
| | | |
| | | BaseFramLayout baseFramLayout = new BaseFramLayout(); |
| | | vv.AddChidren(baseFramLayout); |
| | | |
| | | Button btnImage = new Button |
| | | ImageView btnImage = new ImageView |
| | | { |
| | | 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), |
| | | ImageBytes = movieLibrary.imageBytes, |
| | | }; |
| | | baseFramLayout.AddChidren(btnImage); |
| | | //电影名称 |
| | |
| | | Y = Application.GetRealHeight(36), |
| | | Width = Application.GetRealWidth(178), |
| | | Height = Application.GetRealHeight(45), |
| | | Text = "嗨起来了兄弟们,年底分红,你拿7份,我拿3份", |
| | | Text = movieLibrary.name, |
| | | TextColor = MusicColor.TextColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsBold = true, |
| | | IsMoreLines=true, |
| | | IsMoreLines = true, |
| | | }; |
| | | baseFramLayout.AddChidren(btnName); |
| | | this.AdjustRealWidth(btnName, 178); |
| | | |
| | | //年份 |
| | | Button btnYear = new 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, |
| | | Text = movieLibraryInfo == null ? "" : movieLibraryInfo.releaseDate, |
| | | }; |
| | | baseFramLayout.AddChidren(btnYear); |
| | | this.AdjustRealWidth(btnYear, 34); |
| | |
| | | baseFramLayout.AddChidren(btnSlope); |
| | | |
| | | //地区 |
| | | Button btnRegion = new 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, |
| | | Text = movieLibraryInfo == null ? "" : movieLibraryInfo.area, |
| | | }; |
| | | baseFramLayout.AddChidren(btnRegion); |
| | | this.AdjustRealWidth(btnRegion, 140); |
| | |
| | | Y = btnYear.Bottom + Application.GetRealHeight(20), |
| | | Width = Application.GetRealWidth(45), |
| | | Height = Application.GetRealHeight(43), |
| | | Text = "9.9", |
| | | Text = movieLibraryInfo == null ? "" : movieLibraryInfo.rating, |
| | | TextSize = 32, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | baseFramLayout.AddChidren(btnScore); |
| | | |
| | | |
| | | Button btnCollectImage = new Button |
| | | btnCollectImage = new Button |
| | | { |
| | | X = btnImage.Right + Application.GetRealWidth(167), |
| | | Y = btnRegion.Bottom + Application.GetRealHeight(12), |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "MusicIcon/collect.png", |
| | | SelectedImagePath = "MusicIcon/collectSelected.png", |
| | | IsSelected = movieLibraryInfo == null ? false : movieLibraryInfo.collect, |
| | | }; |
| | | baseFramLayout.AddChidren(btnCollectImage); |
| | | |
| | | Button btnCollectText = new Button |
| | | |
| | | btnCollectText = new Button |
| | | { |
| | | X = btnImage.Right + Application.GetRealWidth(169), |
| | | Y = btnCollectImage.Bottom + Application.GetRealHeight(2), |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | baseFramLayout.AddChidren(btnCollectText); |
| | | if (btnCollectImage.IsSelected) { |
| | | btnCollectText.TextID = StringId.yishoucang; |
| | | } else { |
| | | btnCollectText.TextID = StringId.weishoucang; |
| | | } |
| | | isOldState = btnCollectImage.IsSelected; |
| | | |
| | | //电影简介 |
| | | Button btnIntroduceTitle = new Button |
| | | { |
| | | X =Application.GetRealWidth(16), |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnImage.Bottom + Application.GetRealHeight(28), |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(23), |
| | | //TextID = StringId., |
| | | Text= "电影简介", |
| | | Text = "电影简介", |
| | | TextColor = MusicColor.TextColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsBold=true, |
| | | IsBold = true, |
| | | }; |
| | | baseFramLayout.AddChidren(btnIntroduceTitle); |
| | | |
| | | |
| | | //电影简介内容 |
| | | Button btnIntroduceContent = new 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, |
| | | IsMoreLines = true, |
| | | Text = movieLibraryInfo == null ? "" : movieLibraryInfo.introduction, |
| | | }; |
| | | baseFramLayout.AddChidren(btnIntroduceContent); |
| | | |
| | |
| | | }; |
| | | baseFramLayout.AddChidren(btnActor); |
| | | |
| | | |
| | | HorizontalScrolViewLayout horizontalFram = new HorizontalScrolViewLayout { |
| | | Y= btnActor.Bottom+ Application.GetRealHeight(12), |
| | | |
| | | horizontalFram = new HorizontalScrolViewLayout |
| | | { |
| | | Y = btnActor.Bottom + Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Height =Application.GetRealHeight(112), |
| | | Width=Application.GetRealWidth(375-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); |
| | | } |
| | | |
| | | LoadActorPage(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | TextColor = MusicColor.WhiteColor, |
| | | TextSize = TextSize.Text16, |
| | | TextAlignment = TextAlignment.Center, |
| | | Gravity=Gravity.CenterHorizontal, |
| | | BackgroundColor=MusicColor.SelectedColor, |
| | | Radius=(uint)Application.GetRealHeight(22), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundColor = MusicColor.SelectedColor, |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | }; |
| | | baseFramLayout.AddChidren(btnPaly); |
| | | |
| | | baseFramLayout.AdjustRealHeight(37); |
| | | } |
| | | /// <summary> |
| | | /// 加载演员图片列表 |
| | | /// </summary> |
| | | private void LoadActorPage() |
| | | { |
| | | if (this.movieLibraryInfo == null || this.movieLibraryInfo.actors.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | for (int i = 0; i < this.movieLibraryInfo.actors.Count; i++) |
| | | { |
| | | var actors = this.movieLibraryInfo.actors[i]; |
| | | FrameLayout actorFrame = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(112), |
| | | Width = Application.GetRealWidth(72), |
| | | }; |
| | | horizontalFram.AddChidren(actorFrame); |
| | | |
| | | ImageView btnActorImage = new ImageView |
| | | { |
| | | Width = Application.GetRealWidth(72), |
| | | Height = Application.GetRealHeight(84), |
| | | Radius = (uint)Application.GetRealHeight(8), |
| | | ImageBytes = actors.imageBytes, |
| | | }; |
| | | 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 = actors.actorName, |
| | | }; |
| | | actorFrame.AddChidren(btnActorName); |
| | | |
| | | //间隔,弄个空的进去占位置 |
| | | Button btnSpacing = new Button |
| | | { |
| | | Width = Application.GetRealWidth(8), |
| | | }; |
| | | horizontalFram.AddChidren(btnSpacing); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 注册事件 |
| | | /// </summary> |
| | |
| | | //返回 |
| | | this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | action?.Invoke(isOldState != btnCollectImage.IsSelected); |
| | | this.RemoveFromParent(); |
| | | }; |
| | | //立即播放 |
| | | this.btnPaly.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | CommonMethod.Current.Loading.Start(); |
| | | CommonMethod.Current.SunThread(() => |
| | | { |
| | | try |
| | | { |
| | | SendMethod.Current.MovieLibraryPlay(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | CommonMethod.Current.Loading.Hide(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | //收藏 |
| | | EventHandler<MouseEventArgs> CollectClick = (sender, e) => |
| | | { |
| | | btnCollectImage.IsSelected = !btnCollectImage.IsSelected; |
| | | if (btnCollectImage.IsSelected) |
| | | { |
| | | btnCollectText.TextID = StringId.yishoucang; |
| | | } |
| | | else |
| | | { |
| | | btnCollectText.TextID = StringId.weishoucang; |
| | | } |
| | | CommonMethod.Current.Loading.Start(); |
| | | CommonMethod.Current.SunThread(() => |
| | | { |
| | | try |
| | | { |
| | | var isBool = SendMethod.Current.IsCollect(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId, btnCollectImage.IsSelected); |
| | | if (isBool) |
| | | { |
| | | //更新缓存数据 |
| | | movieLibraryInfo.collect = btnCollectImage.IsSelected; |
| | | //成功后才更新缓存数据 |
| | | if (btnCollectImage.IsSelected) |
| | | { |
| | | |
| | | AksCommonMethod.Current.AddCollectMovie(movieLibrary); |
| | | } |
| | | else |
| | | { |
| | | AksCommonMethod.Current.DelCollectMovie(movieLibrary); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | CommonMethod.Current.Loading.Hide(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | btnCollectImage.MouseUpEventHandler += CollectClick; |
| | | btnCollectText.MouseUpEventHandler += CollectClick; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始数据 |
| | | /// </summary> |
| | | private void ReadData() |
| | | { |
| | | if (this.movieLibraryInfo != null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | CommonMethod.Current.Loading.Start(); |
| | | CommonMethod.Current.SunThread(() => |
| | | { |
| | | try |
| | | { |
| | | this.movieLibraryInfo = SendMethod.Current.GetMovieLibraryInfo(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId); |
| | | if (movieLibraryInfo.actors.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | for (int i = 0; i < movieLibraryInfo.actors.Count; i++) |
| | | { |
| | | movieLibraryInfo.actors[i].imageBytes = SendMethod.Current.GetImage(movieLibraryInfo.actors[i].actorUrl); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | CommonMethod.Current.Loading.Hide(); |
| | | btnYear.Text = movieLibraryInfo.releaseDate; |
| | | btnRegion.Text = movieLibraryInfo.area; |
| | | btnCollectImage.IsSelected = movieLibraryInfo.collect; |
| | | btnIntroduceContent.Text = movieLibraryInfo.introduction; |
| | | LoadActorPage(); |
| | | AksCommonMethod.Current.AddMovieLibraryInfo(movieLibraryInfo); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 重新计算button宽度 |
| | | /// </summary> |