陈嘉乐
2021-02-23 780b8b391bc92fba473291ec8151df5860749408
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
using System;
using System.Collections.Generic;
using HDL_ON.UI.CSS;
using HDL_ON.UI.Music;
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
{
    public class TipView
    {
        /// <summary>
        /// 大框圆角值
        /// </summary>
        public int RradiusFrameLayout = 15;
        /// <summary>
        /// 小框圆角值
        /// </summary>
        public int radiusEditFrameLayout = 4;
 
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox(string tnputEditTxet, Action<string> confirmAction)
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = MusicColor.PopupBackgroundColor,
            };
 
            FrameLayout whiteView = new FrameLayout()
            {
                //Gravity = Gravity.Center,
                X = Application.GetRealWidth(53),
                Y = Application.GetRealHeight(264),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(201),
                BackgroundColor = MusicColor.WhiteColor,
                BorderColor = 0x00000000,
                BorderWidth = 0,
                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
            };
            dialog.AddChidren(whiteView);
 
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(22),
                Width = Application.GetRealWidth(200),
                TextColor = MusicColor.SelectedColor,
                TextSize = TextSize.Text16,
                TextAlignment = TextAlignment.Center,
                TextID = StringId.shuruyaokongqimingcheng,
 
            };
            whiteView.AddChidren(btnTitle);
 
            FrameLayout editBjView = new FrameLayout()
            {
                // Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                X = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(40),
                BackgroundColor = MusicColor.ViewColor,
                BorderColor = 0x00000000,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
            };
            whiteView.AddChidren(editBjView);
 
            EditText editText = new EditText()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(20),
                Text = tnputEditTxet,
                TextColor = MusicColor.TextColor,
                TextSize = TextSize.Text14,
                TextAlignment = TextAlignment.CenterLeft,
            };
            editBjView.AddChidren(editText);
 
            Button clearIconBtn = new Button
            {
                X = Application.GetRealWidth(194),
                Y = Application.GetRealHeight(8),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "MusicIcon/clear.png",
            };
            editBjView.AddChidren(clearIconBtn);
            clearIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                editText.Text = "";
            };
 
 
            Button btnTipText = new Button
            {
                X = Application.GetRealWidth(24),
                Y = editBjView.Bottom + Application.GetRealHeight(12),
                Width = Application.GetRealWidth(211),
                Height = Application.GetRealHeight(35),
                Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"),
                IsMoreLines = true,
                TextColor = MusicColor.MusicNoTxetColor,
                TextSize = TextSize.Text12,
                TextAlignment = TextAlignment.CenterLeft,
            };
            whiteView.AddChidren(btnTipText);
 
             Button btnLine = new Button()
            {
                Y = whiteView.Height -Application.GetRealHeight(44 + 1),
                Height = Application.GetRealHeight(1),
                BackgroundColor = MusicColor.LineColor,
            };
            whiteView.AddChidren(btnLine);
 
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = MusicColor.TextCancelColor,
                TextSize = TextSize.Text16,
                TextID = StringId.cancelMusic,
                Gravity = Gravity.BottomLeft,
            };
            whiteView.AddChidren(btnCancel);
            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
 
            Button btnConfirm = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                TextColor = MusicColor.WhiteColor,
                IsBold = true,
                TextSize = TextSize.Text16,
                TextID = StringId.confirmMusic,
                BackgroundColor = MusicColor.SelectedColor,
                Gravity = Gravity.BottomRight,
            };
            whiteView.AddChidren(btnConfirm);
            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
            dialog.Show();
            btnCancel.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
 
 
 
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                if (string.IsNullOrEmpty(editText.Text.Trim()))
                {
                    return;
                }
                confirmAction(editText.Text.Trim());
                dialog.Close();
            };
 
        }
 
 
 
 
 
    }
}