wjc
2023-08-03 72c7bdb62b203eeb6a590e96bf25a4e186bd45cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
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
{
    /// <summary>
    /// 影片详情界面
    /// </summary>
    public class DetailPage : FrameLayout
    {
        public DetailPage()
        {
        }
 
        /// <summary>
        /// 头部布局
        /// </summary>
        private TopView topView;
        /// <summary>
        /// 删除设备后需要更新界面的回调
        /// </summary>
        public Action action;
 
        /// <summary>
        /// 立即播放
        /// </summary>
        Button btnPaly;
 
        public void Show()
        {
            //初始化UI
            this.InitTop();
            this.InitMiddle();
            //初始化事件
            this.EventListener();
            //读取数据
 
        }
        /// <summary>
        /// 初始化头部界面
        /// </summary>
        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());
        }
        /// <summary>
        /// 初始化中部界面
        /// </summary>
        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);
        }
        /// <summary>
        /// 注册事件
        /// </summary>
        private void EventListener()
        {
            //返回
            this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
            //立即播放
            this.btnPaly.MouseUpEventHandler += (sender, e) =>
            {
 
            };
 
        }
        /// <summary>
        /// 重新计算button宽度
        /// </summary>
        /// <param name="button">控件</param>
        /// <param name="widthMax">宽度最大最</param>
        /// <param name="padding">内边距</param>
        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;
        }
    }
}