From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs | 228 +++++++++++++++++++-------------------------------------
1 files changed, 79 insertions(+), 149 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs
index fe4e545..88d8da6 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs
@@ -12,25 +12,13 @@
#region 鈻� 鍙橀噺澹版槑___________________________
/// <summary>
- /// 妗屽竷鎺т欢
+ /// 鍒楄〃鎺т欢
/// </summary>
- private FrameLayout frameTable = null;
- /// <summary>
- /// 涓夎褰㈠浘鏍�
- /// </summary>
- private PicViewControl btnTriangle = null;
- /// <summary>
- /// 澶撮儴鍦嗚鎺т欢
- /// </summary>
- private NormalViewControl btnTopRadius = null;
- /// <summary>
- /// 搴曢儴鍦嗚鎺т欢
- /// </summary>
- private NormalViewControl btnBottomRadius = null;
+ private VerticalListControl listView = null;
/// <summary>
/// 鍓嶅洖閫夋嫨鐨勮
/// </summary>
- private FrameLayoutControl oldRowFrame = null;
+ private FrameRowControl oldRowFrame = null;
/// <summary>
/// 琛岄珮搴�
/// </summary>
@@ -38,20 +26,11 @@
/// <summary>
/// 琛屽搴�
/// </summary>
- //private int RowWidth = 449;
private int RowWidth = 395;
/// <summary>
/// 琛屾暟
/// </summary>
private int RowCount = 0;
- /// <summary>
- /// 鑿滃崟璁℃暟
- /// </summary>
- private int menuCount = 0;
- /// <summary>
- /// 鍦嗚搴�
- /// </summary>
- private int tableRadius = Application.GetMinRealAverage(12);
#endregion
@@ -60,22 +39,31 @@
/// <summary>
/// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢
/// </summary>
- /// <param name="frame">鐖跺鍣ㄦ帶浠�</param>
- /// <param name="i_RowCount">涓�鍏辨湁鍑犺</param>
- /// <param name="i_width">杩欎釜鑿滃崟鏈夊瀹�</param>
- public TopRightMenuControl(FrameLayout frame, int i_RowCount, int i_width = 395)
+ /// <param name="i_RowCount">涓�鍏辨湁鍑犺(涓嶅惈鏍囬)</param>
+ /// <param name="i_widthType">杩欎釜鑿滃崟鐨勫搴︽ā寮�,鐩墠鍙敮鎸�
+ /// <para>1: 395瀹藉害</para>
+ /// <para>2: 449瀹藉害</para>
+ /// </param>
+ /// <param name="titleText">鏍囬鏂囨湰(濡傛灉涓嶄负绌�,鑿滃崟妯″紡鍙樻洿涓烘嫢鏈夋爣棰樼殑妯″紡)</param>
+ public TopRightMenuControl(int i_RowCount, int i_widthType, string titleText = null)
{
this.RowCount = i_RowCount;
- this.RowWidth = i_width;
+ if (i_widthType == 1)
+ {
+ this.RowWidth = 395;
+ }
+ else if (i_widthType == 2)
+ {
+ this.RowWidth = 449;
+ }
//鍒濆鍖栫敾闈㈢殑鎺т欢
- this.InitFormControl(frame);
+ this.InitFormControl(titleText, i_widthType);
}
/// <summary>
/// 鍒濆鍖栫敾闈㈢殑鎺т欢
/// </summary>
- /// <param name="frame">鐖跺鍣ㄦ帶浠�</param>
- private void InitFormControl(FrameLayout frame)
+ private void InitFormControl(string titleText, int i_widthType)
{
this.BackgroundColor = UserCenterColor.Current.DialogBackColor;
this.MouseUpEventHandler += (sender2, e2) =>
@@ -83,43 +71,53 @@
//鍏抽棴鑷韩
this.RemoveFromParent();
};
+ var frame = (FrameLayout)UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
frame.AddChidren(this);
- //妗屽竷
- this.frameTable = new FrameLayout();
- //frameTable.X = Application.GetRealWidth(596);
- //frameTable.Y = Application.GetRealHeight(184);
- frameTable.X = Application.GetRealWidth(662 - (RowWidth - 395));
- frameTable.Y = Application.GetRealHeight(158 + 15 + 1);
- frameTable.Width = Application.GetRealWidth(RowWidth);
- frameTable.Height = Application.GetRealHeight(RowHeight * this.RowCount) + (this.RowCount - 1) * ControlCommonResourse.BottomLineHeight;
- frameTable.BackgroundColor = UserCenterColor.Current.White;
- frameTable.Radius = (uint)tableRadius / 2;
- this.AddChidren(frameTable);
-
- //澶撮儴鍦嗚鎺т欢
- btnTopRadius = new NormalViewControl(frameTable.Width, tableRadius * 2, false);
- btnTopRadius.Radius = (uint)tableRadius;
- //btnTopRadius.BackgroundColor = UserCenterColor.Current.BlackBackGround;
- frameTable.AddChidren(btnTopRadius);
- if (RowCount == 1)
+ //鏈�澶ф樉绀�5涓�
+ int rowCount = this.RowCount > 5 ? 5 : this.RowCount;
+ if (rowCount < 5 && titleText != null)
{
- btnTopRadius.BackgroundColor = UserCenterColor.Current.White;
+ //鑿滃崟+1
+ rowCount++;
}
- //搴曢儴鍦嗚鎺т欢
- btnBottomRadius = new NormalViewControl(frameTable.Width, tableRadius * 2, false);
- btnBottomRadius.Y = frameTable.Height - tableRadius * 2;
- btnBottomRadius.Radius = (uint)tableRadius;
- btnBottomRadius.BackgroundColor = UserCenterColor.Current.White;
- frameTable.AddChidren(btnBottomRadius);
+ //鑳屾櫙
+ var frameBack = new FrameLayout();
+ frameBack.X = Application.GetRealWidth(662 - (RowWidth - 395));
+ frameBack.Y = Application.GetRealHeight(161);
+ frameBack.Width = Application.GetRealWidth(RowWidth);
+ frameBack.Height = Application.GetRealHeight(RowHeight * rowCount + 16);
+ frameBack.BackgroundImagePath = "MenuGroud/TopRightMenu" + i_widthType + "_" + rowCount + ".png";
+ this.AddChidren(frameBack);
- //涓夎褰㈠浘鏍�
- btnTriangle = new PicViewControl(31, 15);
- btnTriangle.X = Application.GetRealWidth(980);
- //btnTriangle.Y = Application.GetRealHeight(169);
- btnTriangle.Y = Application.GetRealHeight(158);
- btnTriangle.UnSelectedImagePath = "Item/UpperTriangle.png";
- this.AddChidren(btnTriangle);
+ var frameTable = new FrameLayout();
+ frameTable.Y = Application.GetRealHeight(16);
+ frameBack.AddChidren(frameTable);
+
+ if (titleText != null)
+ {
+ var btnTitle = new NormalViewControl(frameBack.Width - Application.GetRealWidth(81), Application.GetRealHeight(58), false);
+ btnTitle.X = Application.GetRealWidth(81);
+ btnTitle.Y = Application.GetRealHeight(58 + 16);
+ btnTitle.Text = titleText;
+ frameTable.AddChidren(btnTitle);
+ }
+
+ //鍒楄〃鎺т欢
+ this.listView = new VerticalListControl();
+ listView.Height = frameTable.Height;
+ if (rowCount == 5)
+ {
+ //杩炲甫鏍囬,鍙兘鏄剧ず5琛�
+ listView.Height = frameTable.Height - Application.GetRealHeight(RowHeight);
+ }
+ if (titleText != null)
+ {
+ //鎷ユ湁鏍囬
+ listView.Y = Application.GetRealHeight(RowHeight);
+ }
+ listView.Radius = (uint)Application.GetRealHeight(17);
+ frameTable.AddChidren(listView);
}
#endregion
@@ -136,72 +134,36 @@
/// <param name="closeOnClick">鍗曞嚮鐨勬椂鍊欙紝鍏抽棴鑿滃崟</param>
public void AddRowMenu(string TextValue, string unSelectPic, string selectPic, Action action, bool closeOnClick = true)
{
- NormalViewControl btnLine = null;
- if (menuCount > 0)
- {
- //鐢荤嚎
- btnLine = new NormalViewControl(Application.GetRealWidth(RowWidth - 81), ControlCommonResourse.BottomLineHeight, false);
- btnLine.X = Application.GetRealWidth(81);
- btnLine.Y = Application.GetRealHeight(RowHeight * menuCount) + menuCount * ControlCommonResourse.BottomLineHeight;
- btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
- frameTable.AddChidren(btnLine);
- }
- menuCount++;
-
- var rowFrame = new FrameLayoutControl();
+ var rowFrame = new FrameRowControl();
+ rowFrame.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;
rowFrame.Height = Application.GetRealHeight(RowHeight);
- rowFrame.Name = "Menu" + menuCount;
- if (btnLine != null)
- {
- rowFrame.Y = btnLine.Bottom;
- }
- if (this.RowCount == 1)
- {
- //鍙湁涓�涓彍鍗�
- rowFrame.Y = tableRadius;
- rowFrame.Height = Application.GetRealHeight(RowHeight) - tableRadius * 2;
- }
- frameTable.AddChidren(rowFrame);
+ listView.AddChidren(rowFrame);
+ rowFrame.MainKeys = listView.ChildrenCount.ToString();
//鍥炬爣
- var btnIcon = new IconViewControl(81);
- btnIcon.X = Application.GetRealWidth(81);
- btnIcon.Gravity = Gravity.CenterVertical;
+ var btnIcon = rowFrame.AddLeftIcon(81);
btnIcon.UnSelectedImagePath = unSelectPic;
btnIcon.SelectedImagePath = selectPic;
- rowFrame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
//鏄剧ず鏂囧瓧
- var btnText = new NormalViewControl(RowWidth - 173, 58, true);
+ var btnText = rowFrame.AddLeftCaption(TextValue, RowWidth - 173);
btnText.X = Application.GetRealWidth(173);
- btnText.Text = TextValue;
- btnText.Gravity = Gravity.CenterVertical;
- rowFrame.AddChidren(btnText, ChidrenBindMode.BindEventOnly);
- if (menuCount > 1)
+ //搴曠嚎
+ if (listView.ChildrenCount != this.RowCount)
{
- btnIcon.IsSelected = false;
- btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
+ var btnLine = rowFrame.AddBottomLine();
+ btnLine.X = Application.GetRealWidth(81);
}
- if (this.RowCount == 1)
+ if (listView.ChildrenCount == 1)
{
- //濡傛灉鍙湁涓�涓彍鍗�
- }
- else if (menuCount == 1)
- {
- //澶氫釜鑿滃崟妯″紡鐨勭涓�涓彍鍗�
- rowFrame.Y = tableRadius;
- rowFrame.Height -= tableRadius;
- btnIcon.Y -= tableRadius / 2;
- btnText.Y -= tableRadius / 2;
//绗竴涓彍鍗曢粯璁よ缃负閫夋嫨鐘舵��
this.SetRowSelectStatu(rowFrame, true);
this.oldRowFrame = rowFrame;
}
- else if (menuCount == this.RowCount)
+ else
{
- //澶氫釜鑿滃崟妯″紡鐨勬渶鍚庝竴涓彍鍗�
- rowFrame.Height -= tableRadius;
- btnIcon.Y += tableRadius / 2;
- btnText.Y += tableRadius / 2;
+ //鍏朵粬鑿滃崟涓虹伆鑹�
+ btnIcon.IsSelected = false;
+ btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
}
//閫夋嫨鐘舵��
@@ -235,7 +197,7 @@
/// </summary>
/// <param name="frame">琛屾帶浠�</param>
/// <param name="select">閫夋嫨鐨勭姸鎬�</param>
- private void SetRowSelectStatu(FrameLayoutControl frame, bool select)
+ private void SetRowSelectStatu(FrameRowControl frame, bool select)
{
//鍥炬爣
var btnIcon = (IconViewControl)frame.GetChildren(0);
@@ -247,46 +209,14 @@
var btnText = (NormalViewControl)frame.GetChildren(1);
if (btnText != null)
{
- //btnText.TextColor = select == true ? UserCenterColor.Current.TextColor3 : UserCenterColor.Current.TextColor1;
btnText.TextColor = select == true ? UserCenterColor.Current.TextColor1 : UserCenterColor.Current.TextGrayColor1;
}
- //鑳屾櫙鑹�
- //frame.BackgroundColor = select == true ? UserCenterColor.Current.BlackBackGround : UserCenterColor.Current.White;
-
- if (this.RowCount == 1)
- {
- //濡傛灉鍙湁涓�涓彍鍗曠殑璇�
- //this.btnTopRadius.BackgroundColor = UserCenterColor.Current.BlackBackGround;
- //this.btnBottomRadius.BackgroundColor = UserCenterColor.Current.BlackBackGround;
- return;
- }
//鍓嶅洖閫夋嫨鐨勮彍鍗曚负null,鎴栬�呮槸鐩稿悓鐨勪笢瑗�,鍒欎笉澶勭悊
- if (this.oldRowFrame == null || this.oldRowFrame.Name == frame.Name)
+ if (this.oldRowFrame == null || this.oldRowFrame.MainKeys == frame.MainKeys)
{
return;
}
- if (frame.Name == "Menu1")
- {
- //濡傛灉鐐瑰嚮鐨勬槸绗竴涓彍鍗曠殑璇�,鍙橀粦鑹�
- //this.btnTopRadius.BackgroundColor = UserCenterColor.Current.BlackBackGround;
- }
- else
- {
- //鍙樺洖鐧借壊
- //this.btnTopRadius.BackgroundColor = UserCenterColor.Current.White;
- }
-
- if (frame.Name == "Menu" + this.RowCount)
- {
- //濡傛灉鐐瑰嚮鐨勬槸鏈�鍚庝竴涓彍鍗曠殑璇�,鍙橀粦鑹�
- //this.btnBottomRadius.BackgroundColor = UserCenterColor.Current.BlackBackGround;
- }
- else
- {
- //鍙樺洖鐧借壊
- //this.btnBottomRadius.BackgroundColor = UserCenterColor.Current.White;
- }
//鍓嶅洖閫夋嫨鐨勮杩樺師
this.SetRowSelectStatu(this.oldRowFrame, false);
}
--
Gitblit v1.8.0