黄学彪
2019-11-04 c7698e163e43cea9e7f8ee45f8e3f91c9265cca4
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs
@@ -5,7 +5,7 @@
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 密码输入控件(自制的手动按键输入类型,请实现【ActionPswFinish】事件)
    /// 数字按键密码输入控件(自制的手动按键输入类型,请实现【ActionPswFinish】事件)
    /// </summary>
    public class PswNumberInputControl : FrameLayout
    {
@@ -38,11 +38,23 @@
        /// <summary>
        /// 标题控件
        /// </summary>
        private NormalViewControl btnTitle = null;
        public NormalViewControl btnTitle = null;
        /// <summary>
        /// 错误信息提示控件
        /// </summary>
        private NormalViewControl btnError = null;
        public NormalViewControl btnError = null;
        /// <summary>
        /// 显示密码黑点的Frame(有可能需要调整它的位置)
        /// </summary>
        public FrameLayout framePswIcon = null;
        /// <summary>
        /// 数字表盘的Frame(有可能需要调整它的位置)
        /// </summary>
        public FrameLayout frameNumberIcon = null;
        /// <summary>
        /// 数字表盘按键的背景色
        /// </summary>
        public uint NumberIconBackColor = 0xfff5f6fa;
        /// <summary>
        /// 删除控件
        /// </summary>
@@ -69,7 +81,7 @@
            //加间距
            this.Width = Application.GetMinRealAverage(NumberSize * 3 + NumberLeftRightSpace * 2 + 80);
            this.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
            this.btnTitle = new NormalViewControl(Application.CurrentWidth, Application.GetRealWidth(63), false);
            this.btnTitle = new NormalViewControl(Application.CurrentWidth, Application.GetRealWidth(75), false);
            btnTitle.Text = i_title;
        }
@@ -81,7 +93,7 @@
            //标题
            btnTitle.Width = this.Width;
            btnTitle.TextAlignment = TextAlignment.Center;
            btnTitle.TextSize = 16;
            btnTitle.TextSize = 18;
            this.AddChidren(btnTitle);
            //初始化密码图标
@@ -91,17 +103,16 @@
            this.InitNumberTableControl();
            //错误信息提示
            this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(58), false);
            btnError.Y = Application.GetRealHeight(224);
            this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(60), false);
            btnError.Y = Application.GetRealHeight(222);
            btnError.TextAlignment = TextAlignment.Center;
            btnError.TextColor = 0xfff75858;
            btnError.TextSize = 12;
            this.AddChidren(btnError);
            //删除控件
            this.btnDelete = new NormalViewControl(200, 58, true);
            this.btnDelete = new NormalViewControl(200, 60, true);
            btnDelete.X = this.Width - Application.GetRealWidth(200) - Application.GetMinRealAverage(40);
            btnDelete.Y = this.Height - Application.GetRealHeight(58);
            btnDelete.Y = this.Height - Application.GetRealHeight(60);
            btnDelete.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnDelete.TextAlignment = TextAlignment.Center;
            btnDelete.TextID = R.MyInternationalizationString.uDelete;
@@ -147,12 +158,12 @@
                space = value;
            }
            var frameBack = new FrameLayout();
            frameBack.Height = iconSize;
            frameBack.Width = iconSize * passwordLength + space * (passwordLength - 1);
            frameBack.Y = Application.GetRealHeight(149);
            frameBack.Gravity = Gravity.CenterHorizontal;
            this.AddChidren(frameBack);
            this.framePswIcon = new FrameLayout();
            framePswIcon.Height = iconSize;
            framePswIcon.Width = iconSize * passwordLength + space * (passwordLength - 1);
            framePswIcon.Y = Application.GetRealHeight(149);
            framePswIcon.Gravity = Gravity.CenterHorizontal;
            this.AddChidren(framePswIcon);
            for (int i = 0; i < passwordLength; i++)
            {
@@ -164,7 +175,7 @@
                {
                    btnIcon.X = listPswIcon[listPswIcon.Count - 1].Right + space;
                }
                frameBack.AddChidren(btnIcon);
                framePswIcon.AddChidren(btnIcon);
                listPswIcon.Add(btnIcon);
            }
        }
@@ -178,12 +189,12 @@
        /// </summary>
        private void InitNumberTableControl()
        {
            var frameBack = new FrameLayout();
            frameBack.Y = Application.GetRealHeight(368);
            frameBack.Width = this.Width;
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3);
            this.AddChidren(frameBack);
            this.frameNumberIcon = new FrameLayout();
            frameNumberIcon.Y = Application.GetRealHeight(368);
            frameNumberIcon.Width = this.Width;
            frameNumberIcon.Gravity = Gravity.CenterHorizontal;
            frameNumberIcon.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3);
            this.AddChidren(frameNumberIcon);
            //前一个控件的右坐标
            int btnTempRight = 0;
@@ -199,7 +210,7 @@
                    btnNum.X = btnTempRight + space;
                }
                frameBack.AddChidren(btnNum);
                frameNumberIcon.AddChidren(btnNum);
                btnNum.Y = (i - 1) / 3 * (btnNum.Height + Application.GetMinRealAverage(NumberTopButtomSpace));
                btnNum.ButtonClickEvent += (sender, e) =>
                {
@@ -216,11 +227,11 @@
            //0的数字盘
            var btnNum0 = this.InitNumberControl();
            btnNum0.X = Application.GetMinRealAverage(40) + frameBack.GetChildren(0).Height + space;
            btnNum0.X = Application.GetMinRealAverage(40) + frameNumberIcon.GetChildren(0).Height + space;
            btnNum0.Text = "0";
            frameBack.AddChidren(btnNum0);
            btnNum0.Y = 3 * (frameBack.GetChildren(0).Height + Application.GetMinRealAverage(NumberTopButtomSpace));
            frameNumberIcon.AddChidren(btnNum0);
            btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + Application.GetMinRealAverage(NumberTopButtomSpace));
            btnNum0.ButtonClickEvent += (sender, e) =>
            {
                //点击数字按键
@@ -237,7 +248,7 @@
            int iconSize = Application.GetMinRealAverage(NumberSize);
            var btnNum = new NormalClickButton(iconSize, iconSize, false);
            btnNum.X = Application.GetMinRealAverage(40);
            btnNum.BackgroundColor = 0xfff5f6fa;
            btnNum.BackgroundColor = this.NumberIconBackColor;
            btnNum.clickStatuColor = 0x7e656565;
            btnNum.Radius = (uint)iconSize / 2;
            btnNum.TextColor = UserCenterColor.Current.TextGrayColor3;
@@ -256,14 +267,13 @@
            {
                return;
            }
            if (btnError.Visible == true)
            {
                btnError.Visible = false;
            }
            //特效改变
            listPswIcon[inputPassword.Length].BackgroundColor = 0xff333333;
            inputPassword += strNum;
            if (inputPassword.Length == 1)
            {
                //将文字从取消变更为删除
                btnDelete.TextID = R.MyInternationalizationString.uDelete;
            }
            //输入结束
            if (FinishInputEvent != null && inputPassword.Length == passwordLength)
            {
@@ -280,7 +290,8 @@
        /// 重置控件
        /// </summary>
        /// <param name="i_title">标题信息</param>
        public void ResetControlInfo(string i_title)
        /// <param name="clearError">是否清除错误信息</param>
        public void ResetControlInfo(string i_title, bool clearError = true)
        {
            //标题
            btnTitle.Text = i_title;
@@ -291,8 +302,11 @@
            {
                listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent;
            }
            //错误信息
            btnError.Text = string.Empty;
            if (clearError == true)
            {
                //错误信息
                btnError.Text = string.Empty;
            }
        }
        #endregion
@@ -317,7 +331,7 @@
        #region ■ 变更删除按钮位置___________________
        /// <summary>
        /// 变更删除按钮位置(父控件的高度会自动调整)
        /// 变更删除按钮位置,它最初的默认位置是在最底部(父控件的高度会自动调整)
        /// </summary>
        /// <param name="XX">X轴(不变更请设置为-1)</param>
        /// <param name="YY">Y轴(不变更请设置为-1)</param>