| | |
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 底部弹窗项目选择界面(列表数尽可能别弄那么多)
|
| | | /// 底部弹窗项目选择界面
|
| | | /// </summary>
|
| | | public class BottomItemSelectForm : DialogCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 完成选择的事件(参数为选择的是列表的第几行,从0开始)
|
| | | /// <para>完成选择的事件(参数为选择的是列表的第几行,从0开始)</para>
|
| | | /// <para>当CancelCallEvent=true时,点击确认按钮时,参数为:-1</para>
|
| | | /// </summary>
|
| | | public Action<int> FinishSelectEvent = null;
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | public bool CancelCallEvent = false;
|
| | | /// <summary>
|
| | | /// 选择的行能否取消
|
| | | /// 选择的行能否取消(默认可以取消)
|
| | | /// </summary>
|
| | | public bool SelectRowCanCancel = true;
|
| | |
|
| | |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_topText">头部标题</param>
|
| | | /// <param name="i_listText">需要显示的列表信息(列表数尽可能别弄那么多)</param> |
| | | /// <param name="i_listText">需要显示的列表信息</param> |
| | | /// <param name="i_listBottomText">需要显示的列表信息(底部),如果只是单行显示,则此值设置为null(如果不为null,但是索引所指向的值为null,则该行强制单行显示)</param>
|
| | | /// <param name="i_selectNo">设置哪个文本为默认选择(不设置填-1)</param> |
| | | public void ShowForm(string i_topText, List<string> i_listText, int i_selectNo) |
| | | public void ShowForm(string i_topText, List<string> i_listText, List<string> i_listBottomText, int i_selectNo) |
| | | { |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(i_topText, i_listText, i_selectNo); |
| | | this.InitMiddleFrame(i_topText, i_listText, i_listBottomText, i_selectNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="i_topText">头部标题</param> |
| | | /// <param name="i_listText">需要显示的列表信息</param> |
| | | /// <param name="i_listBottomtext">需要显示的列表信息(底部)</param>
|
| | | /// <param name="i_selectNo">默认选择</param> |
| | | private void InitMiddleFrame(string i_topText, List<string> i_listText, int i_selectNo) |
| | | private void InitMiddleFrame(string i_topText, List<string> i_listText, List<string> i_listBottomtext, int i_selectNo) |
| | | {
|
| | | //弧度的圆的一半的高度(固定)
|
| | | int halfRoundHeigth = Application.GetRealHeight(116) / 2; |
| | | //头部高度 |
| | | int topHeight = Application.GetRealHeight(195);
|
| | | //底部高度
|
| | | int bottomHeight = Application.GetRealHeight(57); |
| | | //明细高度 |
| | | int detailHeight = (ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12)) * i_listText.Count;
|
| | | //不能够滑动的东西
|
| | | FrameListControl listDetailView1 = null; |
| | | //能够滑动的东西 |
| | | VerticalListControl listDetailView2 = null;
|
| | |
|
| | | //搞一个透明的框
|
| | | var frameTransparent = new FrameLayout();
|
| | | frameTransparent.Y = bodyFrameLayout.Height - topHeight - bottomHeight - detailHeight; |
| | | frameTransparent.Height = topHeight + bottomHeight + detailHeight + halfRoundHeigth * 2;//高度就是要它超过,随便搞的
|
| | | frameTransparent.BackgroundColor = UserCenterColor.Current.Transparent; |
| | | bodyFrameLayout.AddChidren(frameTransparent);
|
| | | //★★从下往上添加控件★★ |
| | |
|
| | | //明细列表的桌布,白色背景(它与实际高度小了半个弧度的圆)
|
| | | var detailBackFrame = new FrameLayout(); |
| | | detailBackFrame.Y = halfRoundHeigth; |
| | | detailBackFrame.Height = frameTransparent.Height;
|
| | | detailBackFrame.BackgroundColor = UserCenterColor.Current.White; |
| | | frameTransparent.AddChidren(detailBackFrame);
|
| | | //明细高度(初始最多只显示9行) |
| | | int detailHeight = ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12);
|
| | | if (i_listText.Count > 9)
|
| | | {
|
| | | //63:上部间距 58:下部间距
|
| | | detailHeight = detailHeight * 9 + Application.GetRealHeight(63 + 58);
|
| | | listDetailView2 = new VerticalListControl(12);
|
| | | listDetailView2.Height = detailHeight;
|
| | | listDetailView2.Gravity = Gravity.BottomCenter;
|
| | | listDetailView2.BackgroundColor = UserCenterColor.Current.White; |
| | | bodyFrameLayout.AddChidren(listDetailView2);
|
| | | }
|
| | | else
|
| | | { |
| | | //63:上部间距 58:下部间距 |
| | | detailHeight = detailHeight * i_listText.Count + Application.GetRealHeight(63 + 58);
|
| | | listDetailView1 = new FrameListControl(12);
|
| | | listDetailView1.Height = detailHeight;
|
| | | listDetailView1.Gravity = Gravity.BottomCenter;
|
| | | listDetailView1.BackgroundColor = UserCenterColor.Current.White; |
| | | bodyFrameLayout.AddChidren(listDetailView1);
|
| | | }
|
| | | //线
|
| | | int lineYY = listDetailView1 != null ? listDetailView1.Y : listDetailView2.Y;
|
| | | var btnLine = new NormalViewControl(bodyFrameLayout.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.Y = lineYY - ControlCommonResourse.BottomLineHeight;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | bodyFrameLayout.AddChidren(btnLine);
|
| | |
|
| | | //弧度的圆
|
| | | var rowRound = new FrameLayout(); |
| | | rowRound.Width = bodyFrameLayout.Width; |
| | | rowRound.Height = halfRoundHeigth * 2; |
| | | rowRound.BackgroundColor = UserCenterColor.Current.White; |
| | | rowRound.Radius = (uint)halfRoundHeigth; |
| | | frameTransparent.AddChidren(rowRound); |
| | | //头部白色背景
|
| | | var topBackFame = new FrameLayout(); |
| | | topBackFame.Y = btnLine.Y - Application.GetRealHeight(138); |
| | | topBackFame.BackgroundColor = UserCenterColor.Current.White; |
| | | topBackFame.Height = Application.GetRealHeight(138); |
| | | topBackFame.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
|
| | | bodyFrameLayout.AddChidren(topBackFame); |
| | | |
| | | //头部信息
|
| | | var btnTitle = new NormalViewControl(detailBackFrame.Width, Application.GetRealHeight(63), false); |
| | | btnTitle.Y = Application.GetRealHeight(35); |
| | | var btnTitle = new NormalViewControl(topBackFame.Width, Application.GetRealHeight(65), false); |
| | | btnTitle.Y = Application.GetRealHeight(34); |
| | | btnTitle.Text = i_topText; |
| | | btnTitle.TextColor = UserCenterColor.Current.TextColor4; |
| | | btnTitle.TextSize = 16; |
| | | btnTitle.TextAlignment = TextAlignment.Center; |
| | | rowRound.AddChidren(btnTitle); |
| | | topBackFame.AddChidren(btnTitle); |
| | | |
| | | //取消 |
| | | var btnCancel = new NormalViewControl(200, 58, true); |
| | |
| | | btnCancel.Y = Application.GetRealHeight(40); |
| | | btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1; |
| | | btnCancel.TextID = R.MyInternationalizationString.uCancel; |
| | | rowRound.AddChidren(btnCancel); |
| | | topBackFame.AddChidren(btnCancel); |
| | | btnCancel.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.CloseForm();
|
| | |
| | | btnFinish.TextAlignment = TextAlignment.CenterRight; |
| | | btnFinish.TextColor = 0xfffb744a; |
| | | btnFinish.TextID = R.MyInternationalizationString.uFinish; |
| | | rowRound.AddChidren(btnFinish); |
| | | topBackFame.AddChidren(btnFinish); |
| | | btnFinish.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (FinishSelectEvent != null && oldSelectContr != null)
|
| | |
| | | this.CloseForm();
|
| | | };
|
| | |
|
| | | //线
|
| | | var btnLine = new NormalViewControl(detailBackFrame.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.Y = Application.GetRealHeight(138) - ControlCommonResourse.BottomLineHeight - halfRoundHeigth;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; |
| | | detailBackFrame.AddChidren(btnLine); |
| | | //添加一个白色的间距
|
| | | var frameSpace = new FrameLayout();
|
| | | frameSpace.Height = Application.GetRealHeight(63);
|
| | | listDetailView1?.AddChidren(frameSpace); |
| | | listDetailView2?.AddChidren(frameSpace); |
| | | |
| | | //列表控件
|
| | | var listView = new FrameListControl(12); |
| | | listView.Height = detailHeight + bottomHeight; |
| | | listView.Y = topHeight - halfRoundHeigth; |
| | | detailBackFrame.AddChidren(listView); |
| | | //明细列表控件
|
| | | int rowSpace = listDetailView1 != null ? listDetailView1.rowSpace : listDetailView2.rowSpace; |
| | | for (int i = 0; i < i_listText.Count; i++)
|
| | | {
|
| | | var btnRow = new NormalSelectControl(i_listText[i], listView.rowSpace / 2);
|
| | | NormalSelectControl btnRow = null;
|
| | | if (i_listBottomtext == null || i_listBottomtext[i] == null)
|
| | | {
|
| | | //只显示一行
|
| | | btnRow = new NormalSelectControl(i_listText[i], rowSpace / 2);
|
| | | }
|
| | | else
|
| | | {
|
| | | //显示上下两行
|
| | | btnRow = new NormalSelectControl(i_listText[i], i_listBottomtext[i], rowSpace / 2);
|
| | | }
|
| | | btnRow.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;//向右偏移
|
| | | btnRow.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);//向左偏移
|
| | | listView.AddChidren(btnRow);
|
| | | listDetailView1?.AddChidren(btnRow);
|
| | | listDetailView2?.AddChidren(btnRow);
|
| | |
|
| | | btnRow.InitControl();
|
| | | btnRow.MainKeys = i.ToString();
|
| | | btnRow.ButtonClickEvent += (sender, e) =>
|
| | |
| | | btnRow.AddBottomLine();
|
| | | }
|
| | | } |
| | | |
| | | //如果是滑动控件,则添加底部间距
|
| | | if (listDetailView2 != null)
|
| | | {
|
| | | var frameSpace2 = new FrameLayout();
|
| | | frameSpace2.Height = Application.GetRealHeight(58);
|
| | | listDetailView2?.AddChidren(frameSpace2);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|