From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs | 138 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 112 insertions(+), 26 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs
index 8554310..f67e435 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs
@@ -5,7 +5,7 @@
namespace Shared.Phone.UserCenter
{
/// <summary>
- /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢,鏈夊埛鏂板姛鑳�(瀹冧笉浼氳皟鏁撮珮搴�)
+ /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢,鏈夊埛鏂板姛鑳�(鏈夋甯�,瀹冧笉浼氳皟鏁撮珮搴�)
/// </summary>
public class VerticalFrameRefreshControl : VerticalRefreshLayout
{
@@ -31,6 +31,11 @@
}
}
+ /// <summary>
+ /// 涓�涓复鏃剁殑涓滆タ
+ /// </summary>
+ private FrameLayout frameBackTemp = null;
+
#endregion
#region 鈻� 鍒濆鍖朹____________________________
@@ -43,6 +48,13 @@
{
rowSpace = Application.GetRealHeight(i_rowSpace);
this.VerticalScrollBarEnabled = false;
+#if iOS
+ //鑷姩鍋忕Щ鍙栨秷
+ if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
+ {
+ (this.uiView as UIKit.UIScrollView).ContentInsetAdjustmentBehavior = UIKit.UIScrollViewContentInsetAdjustmentBehavior.Never;
+ }
+#endif
}
/// <summary>
@@ -57,7 +69,7 @@
this.m_frameTable = new FrameLayout();
this.m_frameTable.Width = this.Width;
this.m_frameTable.Height = this.Height;
- this.AddChidren(this.m_frameTable);
+ base.AddChidren(this.m_frameTable);
}
#endregion
@@ -65,24 +77,51 @@
#region 鈻� 娣诲姞瀛愭帶浠禵________________________
/// <summary>
- /// 娣诲姞Frame瀛愭帶浠�
+ /// 娣诲姞瀛愭帶浠�(娉ㄦ剰,瀹冩槸寰�涓嬪姞鎺т欢,姝ゆ柟娉曟槸鍙敼鍙榊杞�)
/// </summary>
/// <param name="view"></param>
- public void AddChidrenFrame(FrameLayout frame)
+ public override void AddChidren(View view)
{
//鍒濆鍖栨甯冩帶浠�
this.InitFrameTable();
- var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1);
- if (child != null)
+ int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
+ if (value != -1)
{
- frame.Y = child.Bottom + rowSpace;
+ view.Y = value + rowSpace;
}
- this.m_frameTable.AddChidren(frame);
+ this.m_frameTable.AddChidren(view);
//璋冩暣妗屽竷楂樺害
- if (this.m_frameTable.Height < frame.Bottom)
+ if (this.m_frameTable.Height < view.Bottom)
{
- this.m_frameTable.Height = frame.Bottom;
+ this.m_frameTable.Height = view.Bottom;
+ }
+ }
+
+ /// <summary>
+ /// 娣诲姞瀛愭帶浠�(娉ㄦ剰,瀹冩槸寰�涓嬪姞鎺т欢,姝ゆ柟娉曟槸鏀瑰彉楂樺害)
+ /// </summary>
+ /// <param name="view"></param>
+ public void AddChidren2(View view)
+ {
+ //鍒濆鍖栨甯冩帶浠�
+ this.InitFrameTable();
+
+ //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+ int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
+ if (value != -1)
+ {
+ view.Y = value;
+ }
+ this.m_frameTable.AddChidren(view);
+ if (rowSpace > 0)
+ {
+ view.Height += rowSpace;
+ }
+ //璋冩暣妗屽竷楂樺害
+ if (this.m_frameTable.Height < view.Bottom)
+ {
+ this.m_frameTable.Height = view.Bottom;
}
}
@@ -97,31 +136,38 @@
/// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param>
public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace)
{
- var child = frame.GetChildren(frame.ChildrenCount - 1);
- if (child != null)
+ //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+ int value = this.GetLocationMostLastViewBottom(frame);
+ if (value != -1)
{
//璋冩暣妗屽竷楂樺害
- if (frame.Height < child.Bottom + buttomSpace)
- {
- frame.Height = child.Bottom + buttomSpace;
- }
+ frame.Height = value + buttomSpace;
}
}
/// <summary>
/// 璋冩暣妗屽竷楂樺害
/// </summary>
- public void AdjustTableHeight()
+ /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param>
+ public void AdjustTableHeight(int buttomSpace = 0)
{
- var child = this.m_frameTable?.GetChildren(this.m_frameTable.ChildrenCount - 1);
- if (child != null)
+ //2020.05.25杩藉姞
+ if (this.frameBackTemp != null && this.frameBackTemp.Parent != null)
+ {
+ this.frameBackTemp.RemoveFromParent();
+ }
+
+ //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+ int value = this.GetLocationMostLastViewBottom(this.m_frameTable);
+ if (value != -1)
{
//璋冩暣妗屽竷楂樺害
- this.m_frameTable.Height = child.Bottom;
- //if (this.m_frameTable.Height < child.Bottom)
- //{
- // this.m_frameTable.Height = child.Bottom;
- //}
+ this.m_frameTable.Height = value + buttomSpace;
+ }
+ else
+ {
+ //杩樺師涓哄師鏉ョ殑楂樺害
+ this.RecoverTableHeight();
}
}
@@ -131,6 +177,9 @@
/// <param name="correctionsValue">Y杞磋ˉ姝e��(鐪熷疄鍊�,鍒楄〃鎺т欢涓嶅湪bodyFramelayout鐨勬椂鍊欎娇鐢�)</param>
public void AdjustRealHeightByBottomButton(int correctionsValue = 0)
{
+ //璋冩暣妗屽竷楂樺害 2020.05.25杩藉姞
+ this.AdjustTableHeight();
+
var btnTemp = new BottomClickButton();
if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue)
{
@@ -138,9 +187,46 @@
return;
}
//娣诲姞涓存椂鎺т欢,鐩磋嚦鍙互婊戝姩瓒呰繃搴曢儴鎸夐挳
- var frameBackTemp = new FrameLayout();
+ int oldRowSpace = this.rowSpace;
+ this.rowSpace = 0;
+
+ this.frameBackTemp = new FrameLayout();
frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23);
- this.AddChidrenFrame(frameBackTemp);
+ this.AddChidren(frameBackTemp);
+
+ this.rowSpace = oldRowSpace;
+ }
+
+ /// <summary>
+ /// 杩樺師妗屽竷楂樺害
+ /// </summary>
+ public void RecoverTableHeight()
+ {
+ if (this.m_frameTable != null)
+ {
+ m_frameTable.Height = this.Height;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+ /// </summary>
+ /// <returns></returns>
+ private int GetLocationMostLastViewBottom(FrameLayout frame)
+ {
+ int bottomHeight = -1;
+
+ if (frame == null) { return bottomHeight; }
+
+ for (int i = 0; i < frame.ChildrenCount; i++)
+ {
+ var child = frame.GetChildren(i);
+ if (child.Bottom > bottomHeight)
+ {
+ bottomHeight = child.Bottom;
+ }
+ }
+ return bottomHeight;
}
#endregion
--
Gitblit v1.8.0