| | |
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 密码输入控件(自制的手动按键输入类型,请实现【ActionPswFinish】事件)
|
| | | /// 数字按键密码输入控件(自制的手动按键输入类型,请实现【ActionPswFinish】事件)
|
| | | /// </summary>
|
| | | public class PswNumberInputControl : FrameLayout
|
| | | {
|
| | |
| | | /// <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>
|
| | |
| | | //加间距
|
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | //标题
|
| | | btnTitle.Width = this.Width;
|
| | | btnTitle.TextAlignment = TextAlignment.Center;
|
| | | btnTitle.TextSize = 16;
|
| | | btnTitle.TextSize = 18;
|
| | | this.AddChidren(btnTitle);
|
| | |
|
| | | //初始化密码图标
|
| | |
| | | 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;
|
| | |
| | | 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++)
|
| | | {
|
| | |
| | | {
|
| | | btnIcon.X = listPswIcon[listPswIcon.Count - 1].Right + space;
|
| | | }
|
| | | frameBack.AddChidren(btnIcon);
|
| | | framePswIcon.AddChidren(btnIcon);
|
| | | listPswIcon.Add(btnIcon);
|
| | | }
|
| | | }
|
| | |
| | | /// </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;
|
| | |
| | | btnNum.X = btnTempRight + space;
|
| | | }
|
| | |
|
| | | frameBack.AddChidren(btnNum);
|
| | | frameNumberIcon.AddChidren(btnNum);
|
| | | btnNum.Y = (i - 1) / 3 * (btnNum.Height + Application.GetMinRealAverage(NumberTopButtomSpace));
|
| | | btnNum.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
| | |
|
| | | //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) =>
|
| | | {
|
| | | //点击数字按键
|
| | |
| | | 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;
|
| | |
| | | {
|
| | | 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)
|
| | | {
|
| | |
| | | /// 重置控件
|
| | | /// </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;
|
| | |
| | | {
|
| | | listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent;
|
| | | }
|
| | | //错误信息
|
| | | btnError.Text = string.Empty;
|
| | | if (clearError == true)
|
| | | {
|
| | | //错误信息
|
| | | btnError.Text = string.Empty;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | #region ■ 变更删除按钮位置___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 变更删除按钮位置(父控件的高度会自动调整)
|
| | | /// 变更删除按钮位置,它最初的默认位置是在最底部(父控件的高度会自动调整)
|
| | | /// </summary>
|
| | | /// <param name="XX">X轴(不变更请设置为-1)</param>
|
| | | /// <param name="YY">Y轴(不变更请设置为-1)</param>
|