| | |
| | | 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 CollectPage : FrameLayout |
| | | { |
| | | public CollectPage() |
| | | public CollectPage(RemoteControlEntity remoteControlEntity) |
| | | { |
| | | this.remoteControl = remoteControlEntity; |
| | | //读缓存数据 |
| | | var collectList = AksCommonMethod.Current.CollectList; |
| | | this.mMovieCollectList .AddRange(collectList); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 影片收藏列表 |
| | | /// </summary> |
| | | private List<MovieLibrary> mMovieCollectList =new List<MovieLibrary>(); |
| | | /// <summary> |
| | | /// 当前的遥控器对象 |
| | | /// </summary> |
| | | RemoteControlEntity remoteControl; |
| | | /// <summary> |
| | | /// 影片列表上下滑动容器 |
| | | /// </summary> |
| | | VerticalRefreshLayout vv; |
| | | /// <summary> |
| | | /// 影片容器 |
| | | /// </summary> |
| | | CornerFramLayout imageFLayout; |
| | | /// <summary> |
| | | /// 头部布局 |
| | | /// </summary> |
| | | private TopView topView; |
| | | /// <summary> |
| | | /// 删除设备后需要更新界面的回调 |
| | | /// 当前页数 |
| | | /// </summary> |
| | | public Action action; |
| | | private int pageNo=1; |
| | | |
| | | |
| | | |
| | | public void Show() |
| | | { |
| | | //初始化UI |
| | | this.InitTop(); |
| | | this.InitUi(); |
| | | this.InitMiddle(); |
| | | //初始化事件 |
| | | this.EventListener(); |
| | | //读取数据 |
| | | ReadData(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化头部界面 |
| | | /// </summary> |
| | | private void InitTop() |
| | | private void InitUi() |
| | | { |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | this.topView = new TopView(); |
| | | this.topView.setBtn.Visible = false; |
| | | //this.topView.topNameBtn.TextID = StringId.shanchushebei; |
| | | this.topView.topNameBtn.Text ="我的收藏"; |
| | | |
| | | this.AddChidren(topView.TopFLayoutView()); |
| | | } |
| | | /// <summary> |
| | | /// 初始化中部界面 |
| | | /// </summary> |
| | | private void InitMiddle() |
| | | { |
| | | |
| | | var vv = new VerticalRefreshLayout |
| | | 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 += () => |
| | | { |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | }; |
| | | CornerFramLayout imageFLayout = new CornerFramLayout(343, 20 * 168, 0); |
| | | vv.AddChidren(imageFLayout); |
| | | imageFLayout.X = Application.GetRealWidth(16); |
| | | imageFLayout.LoadImagePage(new List<Entity.MovieLibrary>()); |
| | | imageFLayout.selectAction += (index) => |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | DetailPage detailPage = new DetailPage(); |
| | | MainPage.BasePageView.AddChidren(detailPage); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | detailPage.Show(); |
| | | }); |
| | | }; |
| | | imageFLayout.AdjustRealHeight(16); |
| | | } |
| | | /// <summary> |
| | | /// 注册事件 |
| | | /// </summary> |
| | | private void EventListener() |
| | | { |
| | | //返回 |
| | | this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 初始化中部界面 |
| | | /// </summary> |
| | | private void InitMiddle() |
| | | { |
| | | if (vv == null) |
| | | { |
| | | return; |
| | | } |
| | | vv.RemoveAll(); |
| | | int count = this.mMovieCollectList == null ? 0 : this.mMovieCollectList .Count; |
| | | imageFLayout = new CornerFramLayout(343, count * 168, 0); |
| | | vv.AddChidren(imageFLayout); |
| | | imageFLayout.X = Application.GetRealWidth(16); |
| | | imageFLayout.LoadImagePage(this.mMovieCollectList ); |
| | | imageFLayout.AdjustRealHeight(16); |
| | | |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | //强制更新 |
| | | mMovieCollectList .Clear(); |
| | | ReadData(); |
| | | }; |
| | | imageFLayout.selectImageAction += (movieLibrary) => |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | DetailPage detailPage = new DetailPage(remoteControl, movieLibrary); |
| | | MainPage.BasePageView.AddChidren(detailPage); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | detailPage.Show(); |
| | | detailPage.action += (isUpdate) => |
| | | { |
| | | //是否要更新 |
| | | if (isUpdate) |
| | | { |
| | | |
| | | this.mMovieCollectList = AksCommonMethod.Current.CollectList; |
| | | InitMiddle(); |
| | | } |
| | | }; |
| | | }); |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始数据 |
| | | /// </summary> |
| | | private void ReadData() |
| | | { |
| | | if (mMovieCollectList .Count > 0) |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | //有缓存数据直接加载 |
| | | InitMiddle(); |
| | | }); |
| | | return; |
| | | } |
| | | CommonMethod.Current.Loading.Start(); |
| | | CommonMethod.Current.SunThread(() => |
| | | { |
| | | try |
| | | { |
| | | this.mMovieCollectList = SendMethod.Current.GetcollectPage(this.remoteControl.deviceId, this.remoteControl.rcId, pageNo, SendMethod.pageSize); |
| | | for (int i = 0; i < this.mMovieCollectList .Count; i++) |
| | | { |
| | | var mMovieLibrary = this.mMovieCollectList [i]; |
| | | var bytes = SendMethod.Current.GetImage(mMovieLibrary.posterUrl); |
| | | mMovieLibrary.imageBytes = bytes; |
| | | //缓存数据 |
| | | AksCommonMethod.Current.AddCollectMovie(mMovieLibrary); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | CommonMethod.Current.MainThread(() => |
| | | { |
| | | CommonMethod.Current.Loading.Hide(); |
| | | InitMiddle(); |
| | | |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |