From c7df85937f73fb347ee0b19e9c052d2d00a6df6c Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 18 九月 2020 13:58:19 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs |  164 +++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 105 insertions(+), 59 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs
index 6665467..1b9a476 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs
@@ -5,20 +5,29 @@
 namespace Shared.Phone.UserCenter
 {
     /// <summary>
-    /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�)
+    /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰
     /// </summary>
     public class BottomItemSelectForm : DialogCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
         /// <summary>
-        /// 瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�)
+        /// <para>瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�)</para>
+        /// <para>褰揅ancelCallEvent=true鏃�,鐐瑰嚮纭鎸夐挳鏃�,鍙傛暟涓�:-1</para>
         /// </summary>
         public Action<int> FinishSelectEvent = null;
         /// <summary>
         /// 鍓嶅洖閫夋嫨鐨勬帶浠�
         /// </summary>
         private NormalSelectControl oldSelectContr = null;
+        /// <summary>
+        /// 閫夋嫨鍙栨秷(涓嶆槸宸︿笅瑙�),骞朵笖鎸変笅纭畾閿椂,鏄惁璋冪敤鍥炶皟鍑芥暟(璋冪敤鏃朵紶閫掔殑鍙傛暟鏄� -1,榛樿涓嶅洖璋�)
+        /// </summary>
+        public bool CancelCallEvent = false;
+        /// <summary>
+        /// 閫夋嫨鐨勮鑳藉惁鍙栨秷(榛樿鍙互鍙栨秷)
+        /// </summary>
+        public bool SelectRowCanCancel = true;
 
         #endregion
 
@@ -28,12 +37,13 @@
         /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
         /// </summary>
         /// <param name="i_topText">澶撮儴鏍囬</param>
-        /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�)</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>
@@ -41,69 +51,81 @@
         /// </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);
+            var btnCancel = new NormalViewControl(Application.GetRealWidth(200), topBackFame.Height, true);
             btnCancel.X = Application.GetRealWidth(81);
-            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();
             };
 
             //瀹屾垚
-            var btnFinish = new NormalViewControl(200, 58, true);
-            btnFinish.X = Application.GetRealWidth(800);
-            btnFinish.Y = Application.GetRealHeight(40);
+            var btnFinish = new NormalViewControl(Application.GetRealWidth(200), topBackFame.Height, true);
+            btnFinish.X = topBackFame.Width - btnCancel.X - Application.GetRealWidth(200);
             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)
@@ -111,26 +133,40 @@
                     //鍥炶皟鍑芥暟
                     FinishSelectEvent.Invoke(Convert.ToInt32(oldSelectContr.MainKeys));
                 }
+                else if (FinishSelectEvent != null && this.CancelCallEvent == true)
+                {
+                    //鍥炶皟鍑芥暟
+                    FinishSelectEvent.Invoke(-1);
+                }
                 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) =>
@@ -138,8 +174,12 @@
                     //鍙栨秷閫夋嫨
                     if (btnRow.IsSelected == true)
                     {
-                        btnRow.IsSelected = false;
-                        oldSelectContr = null;
+                        //鍏佽鍙栨秷鐨勬椂鍊�,鎵嶈兘鍙栨秷
+                        if (this.SelectRowCanCancel == true)
+                        {
+                            btnRow.IsSelected = false;
+                            oldSelectContr = null;
+                        }
                         return;
                     }
                     if (oldSelectContr != null)
@@ -161,8 +201,14 @@
                     btnRow.AddBottomLine();
                 }
             }
-            //鍔ㄧ敾鏁堟灉
-            frameTransparent.Animate = Animate.DownToUp;
+            
+            //濡傛灉鏄粦鍔ㄦ帶浠�,鍒欐坊鍔犲簳閮ㄩ棿璺�
+            if (listDetailView2 != null)
+            {
+                var frameSpace2 = new FrameLayout();
+                frameSpace2.Height = Application.GetRealHeight(58);
+                listDetailView2?.AddChidren(frameSpace2);
+            }
         }
 
         #endregion

--
Gitblit v1.8.0