From 18a7f9f40e5fab3bee5d4ac3d8fd0273dea052d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期日, 26 四月 2020 12:05:28 +0800
Subject: [PATCH] 先上传一个非最新的版本
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs | 145 +++++++++++++++++++++++++++++++++++++----------
1 files changed, 113 insertions(+), 32 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
index a1b5606..62f0a2b 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
@@ -9,70 +9,151 @@
/// </summary>
public class InformationEditorControl
{
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙
+ /// </summary>
+ private FrameLayout detailBackFrame = null;
+ /// <summary>
+ /// 鍒楄〃鎺т欢
+ /// </summary>
+ private FrameListControl listview = null;
+ /// <summary>
+ /// 鏈�灏忛珮搴�
+ /// </summary>
+ private int minHeight = -1;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
/// <summary>
/// 鍒濆鍖栨帶浠�(杩斿洖鐨勬槸淇℃伅瀹瑰櫒鎺т欢)
/// </summary>
- /// <param name="bodyFrameLayout">bodyFrameLayout</param>
+ /// <param name="bodyFrameLayout">鐖舵帶浠�</param>
/// <param name="title">鏍囬鏂囨湰</param>
- /// <param name="Y">bodyFrameLayout閲岄潰鐨刌杞村潗鏍�</param>
/// <param name="Height">钃濇箹UI閲岄潰瀹冪殑楂樺害</param>
/// <returns>淇℃伅瀹瑰櫒鎺т欢</returns>
- public VerticalListControl InitControl(FrameLayout bodyFrameLayout, string title, int Y, int Height)
+ public FrameListControl InitControl(FrameLayout bodyFrameLayout, string title, int Height)
{
- //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾)
- int halfRoundHeigth = Application.GetRealHeight(116) / 2;
- //寮у害鐨勫渾
- var btnRound = new NormalViewControl(bodyFrameLayout.Width, halfRoundHeigth * 2, false);
- btnRound.Y = Application.GetRealHeight(Y);
- btnRound.BackgroundColor = UserCenterColor.Current.White;
- btnRound.Radius = (uint)halfRoundHeigth;
- bodyFrameLayout.AddChidren(btnRound);
- //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瑕嗙洊寮у害鐨勫渾鐨勫崐杈�)
- var detailBackFrame = new FrameLayout();
- detailBackFrame.Y = btnRound.Bottom - btnRound.Height / 2;
- detailBackFrame.Height = Application.GetRealHeight(Height);//楂樺害灏辨槸瑕佸畠瓒呰繃
+ //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙
+ this.detailBackFrame = new FrameLayout();
+ detailBackFrame.Height = Application.GetRealHeight(Height);
detailBackFrame.BackgroundColor = UserCenterColor.Current.White;
+ detailBackFrame.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+ detailBackFrame.Gravity = Gravity.BottomCenter;
bodyFrameLayout.AddChidren(detailBackFrame);
+ this.minHeight = detailBackFrame.Height;
//淇℃伅缂栬緫
var btnTile = new NormalViewControl(800, 60, true);
btnTile.X = ControlCommonResourse.XXLeft;
+ btnTile.Y = Application.GetRealHeight(81);
btnTile.TextSize = 15;
btnTile.TextColor = UserCenterColor.Current.TextColor2;
btnTile.Text = title;
detailBackFrame.AddChidren(btnTile);
- var listview = new VerticalListControl(12);
+ //鍒楄〃鎺т欢
+ this.listview = new FrameListControl(12);
listview.Y = btnTile.Bottom + Application.GetRealHeight(17);
- listview.Height = Application.GetRealHeight(Height) - halfRoundHeigth - btnTile.Bottom - Application.GetRealHeight(17);
+ listview.Height = Application.GetRealHeight(Height) - btnTile.Bottom - Application.GetRealHeight(17);
detailBackFrame.AddChidren(listview);
return listview;
}
/// <summary>
- /// 瀹屾垚鍒濆鍖�(褰撹鏁板鐨勬椂鍊�,杩欎釜鍑芥暟寰堟湁鐢ㄣ�傝鏁颁笉瓒呰繃瀹瑰櫒鏃讹紝璋冧笉璋冪敤杩欎釜鍑芥暟閮芥病浜�)
+ /// 瀹屾垚鍒濆鍖�
/// </summary>
- /// <param name="bodyFrameLayout">bodyFrameLayout</param>
- /// <param name="listview">瀹瑰櫒鎺т欢</param>
- public void FinishInitControl(FrameLayout bodyFrameLayout, VerticalListControl listview)
+ /// <param name="HadBottomButton">杩欎釜鎺т欢鎵�鍦ㄧ殑鐣岄潰,搴曢儴鏈夋病鏈変繚瀛樻寜閽�</param>
+ /// <param name="mandatoryAdjustment">寮哄埗璋冩暣楂樺害</param>
+ public void FinishInitControl(bool HadBottomButton = true, bool mandatoryAdjustment = false)
{
- var btnFinish = new BottomClickButton();
- //鍊熺敤Y杞村潗鏍�(璁╄繖涓尯鍩熶笉鑳界偣鍑昏彍鍗�)
- var frameBack = new FrameLayout();
- frameBack.Y = btnFinish.Yaxis;
- frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis;
- bodyFrameLayout.AddChidren(frameBack);
-
- var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount;
- if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height)
+ if (HadBottomButton == true)
{
+ var btnFinish = new BottomClickButton();
+ //璁╁畠鍒敼鍙樺潗鏍�
+ int tempSpace = listview.rowSpace;
+ listview.rowSpace = 0;
//淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
var frameTemp = new FrameLayout();
- frameTemp.Height = frameBack.Height + Application.GetRealHeight(115);
+ frameTemp.Height = ControlCommonResourse.BodyFrameHeight - btnFinish.Yaxis + Application.GetRealHeight(23);
listview.AddChidren(frameTemp);
+
+ listview.rowSpace = tempSpace;
}
- btnFinish = null;
+
+ //璋冩暣瀹瑰櫒楂樺害澶у皬
+ int value = this.GetLocationMostLastViewBottom();
+ if (mandatoryAdjustment == false)
+ {
+ if (value + Application.GetRealHeight(23) < listview.Height)
+ {
+ //涓嶉渶瑕佽皟鏁�
+ return;
+ }
+ }
+ //璋冩暣澶у皬
+ listview.Height = value + Application.GetRealHeight(23);
+
+ int backHeigth = listview.Bottom;
+ if (minHeight > backHeigth)
+ {
+ //瀹冩湁涓渶灏忛珮搴�
+ backHeigth = minHeight;
+ }
+ this.detailBackFrame.Height = backHeigth;
+
+ //鑾峰彇listview鎵�鍦ㄧ殑鍏ㄥ眬瀹瑰櫒鎺т欢
+ var contrFather = GetVerticalFrameControl(listview);
+ //璋冩暣妗屽竷澶у皬
+ contrFather?.AdjustTableHeight();
}
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 鑾峰彇listview鎵�鍦ㄧ殑鍏ㄥ眬瀹瑰櫒鎺т欢
+ /// </summary>
+ /// <param name="listview"></param>
+ /// <returns></returns>
+ private VerticalFrameControl GetVerticalFrameControl(FrameListControl listview)
+ {
+ var myContr = listview.Parent;
+ while (myContr != null)
+ {
+ if (myContr is VerticalFrameControl)
+ {
+ return (VerticalFrameControl)myContr;
+ }
+ myContr = myContr.Parent;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+ /// </summary>
+ /// <returns></returns>
+ private int GetLocationMostLastViewBottom()
+ {
+ int bottomHeight = -1;
+
+ for (int i = 0; i < this.listview.ChildrenCount; i++)
+ {
+ var child = this.listview.GetChildren(i);
+ if (child.Bottom > bottomHeight)
+ {
+ bottomHeight = child.Bottom;
+ }
+ }
+ return bottomHeight;
+ }
+
+ #endregion
}
}
--
Gitblit v1.8.0