wjc
2023-02-03 c484347d42f8c14f03f498e689069a14a45abc93
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
using System;
using Shared;
namespace HDL_ON.UI.Music.View
{
    public class SongView
    {
        /// <summary>
        /// 父控件
        /// </summary>
        public RowLayout musicViewFl = new RowLayout
        {
            Width = Application.GetRealWidth(375),
            Height = Application.GetRealHeight(44),
            LineColor= MusicColor.WhiteColor,
        };
 
        /// <summary>
        /// 列表当前播放音乐图标
        /// </summary>
        public Button playIconBtn = new Button
        {
            X = Application.GetRealWidth(16),
            Y = Application.GetRealHeight(10),
            Width = Application.GetRealWidth(24),
            Height = Application.GetRealWidth(24),
            UnSelectedImagePath = "MusicIcon/playStatus.png",
            Visible = false,
            Name = "playStatus",
        };
 
        /// <summary>
        /// 歌曲控件
        /// </summary>
        public Button songBtn = new Button
        {
            X = Application.GetRealWidth(16),
            Y = Application.GetRealHeight(11),
            // Width = wText + Application.GetRealWidth(5),
            Height = Application.GetRealHeight(22),
            TextColor = MusicColor.MusicTxet14Color,
            TextSize = TextSize.Text16,
            TextAlignment = TextAlignment.CenterLeft,
            Name = "song",
        };
        /// <summary>
        /// 歌手控件
        /// </summary>
        public Button singerBtn = new Button
        {
            Y = Application.GetRealHeight(11),
           //Width = Application.GetRealWidth(220) - wText,//歌名长度小于220才可以显示歌手出来
            Height = Application.GetRealHeight(22),
            TextColor = MusicColor.MusicNoTxetColor,
            TextSize = TextSize.Text12,
            TextAlignment = TextAlignment.CenterLeft,
            //Text =("-" +songs.Artist).Trim(),
            Name = "singer",
        };
 
        /// <summary>
        /// 添加喜爱音乐控件
        /// </summary>
        public Button loveIcon = new Button
        {
            X = Application.GetRealWidth(291),
            Y = Application.GetRealHeight(8),
            Width = Application.GetRealWidth(28),
            Height = Application.GetRealWidth(28),
            UnSelectedImagePath = "MusicIcon/love.png",
            SelectedImagePath = "MusicIcon/loveSelected.png",
        };
 
        /// <summary>
        /// 添加到我的列表
        /// </summary>
        public Button addIcon = new Button
        {
            X = Application.GetRealWidth(335),
            Y = Application.GetRealHeight(8),
            Width = Application.GetRealWidth(28),
            Height = Application.GetRealWidth(28),
            UnSelectedImagePath = "MusicIcon/addMusic1.png",
        };
        /// <summary>
        /// 点击控件
        /// </summary>
        public Button clickBtn = new Button
        {
            Width = Application.GetRealWidth(250),
            Height = Application.GetRealHeight(44),
        };
 
        /// <summary>
        /// 布局歌曲信息的View
        /// </summary>
        /// <returns></returns>
        public void SongFrameLayout(VerticalRefreshLayout refreshLayout, SongInfo songs)
        {
            musicViewFl.AddChidren(playIconBtn);
            musicViewFl.AddChidren(songBtn);
            //musicViewFl.AddChidren(singerBtn);
            musicViewFl.AddChidren(clickBtn);
            //musicViewFl.AddChidren(loveIcon);
            //musicViewFl.AddChidren(addIcon);
            refreshLayout.AddChidren(musicViewFl);
 
            playIconBtn.Tag = songs.URL;
            songBtn.Tag = songs.name;
            singerBtn.Tag = songs.name;
            clickBtn.Tag = songs;//标记播放哪一首歌曲
            songBtn.Text = string.IsNullOrEmpty(songs.name) ? "Unkonw" : songs.name.Trim();
            var wText = songBtn.GetTextWidth() + Application.GetRealWidth(15);
            if (wText > Application.GetRealWidth(250))
            {
                wText = Application.GetRealWidth(250);//(歌曲+歌手)宽度最大值时220
            }
            songBtn.Width = wText;
            singerBtn.X = songBtn.Right;
            singerBtn.Width = Application.GetRealWidth(220) - wText;//歌名长度小于220才可以显示歌手出来
            singerBtn.Text = string.IsNullOrEmpty(songs.name) ? "-Unkonw" : "-" + songs.name.Trim();
 
        }
 
    }
}