From b562a582ac3a288193e6e4f57c5eff8a344305a4 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 27 九月 2024 13:52:17 +0800
Subject: [PATCH] Update AndroidManifest.xml
---
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs | 329 +++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 227 insertions(+), 102 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
index 656fa5f..746471b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -25,6 +25,10 @@
/// </summary>
Button btnFloor;
/// <summary>
+ /// 鍏ㄩ�夋寜閽�
+ /// </summary>
+ Button btnChooseAll;
+ /// <summary>
/// 鍔熻兘鍒楄〃闆嗗悎鏄剧ず鍖哄煙
/// </summary>
static VerticalScrolViewLayout functionListView;
@@ -89,15 +93,46 @@
btnFloor = new Button()
{
X = btnFloorDownIcon.Right,
- Y = Application.GetRealHeight(18),
+ //Y = Application.GetRealHeight(18),
Width = Application.GetRealWidth(200),
- Height = Application.GetMinRealAverage(16),
+ //Height = Application.GetMinRealAverage(16+18*2),
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
TextAlignment = TextAlignment.CenterLeft,
Text = DB_ResidenceData.Instance.CurFloor.roomName,
};
roomFloorChangeView.AddChidren(btnFloor);
+
+ btnChooseAll = new Button()
+ {
+ X = Application.GetRealWidth(245),
+ Width = Application.GetRealWidth(109),
+ TextAlignment = TextAlignment.CenterRight,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextID = StringId.SelectedAll,
+ };
+ if(sceneLishtList.Count>0)
+ {
+ btnChooseAll.TextID = StringId.Cancel;
+ }
+ roomFloorChangeView.AddChidren(btnChooseAll);
+ btnChooseAll.MouseUpEventHandler = (sender, e) => {
+ if (sceneLishtList.Count > 0)
+ {
+ sceneLishtList.Clear();
+ btnChooseAll.TextID = StringId.SelectAll;
+ btnConfrim.IsSelected = false;
+ }
+ else
+ {
+ sceneLishtList.AddRange(lightList);
+ btnChooseAll.TextID = StringId.Cancel;
+ btnConfrim.IsSelected = true;
+ }
+ LoadLightRow(lightList);
+ };
+
#endregion
functionListView = new VerticalScrolViewLayout()
@@ -157,44 +192,107 @@
}
/// <summary>
+ /// 鏄剧ず鐨勮澶囩殑鎬绘暟
+ /// </summary>
+ int showCount = -1;
+
+ /// <summary>
/// 鍔犺浇鍔熻兘row
/// </summary>
/// <param name="lightList"></param>
- void LoadLightRow(List<Function> functions)
+ void LoadLightRow(List<Function> functions, bool isAppend = false)
{
- functionListView.RemoveAll();
+ var waitPage = new Loading();
+ bodyView.AddChidren(waitPage);
+ waitPage.Start("");
- foreach (var function in functions)
+ new System.Threading.Thread(() =>
{
- var functionDiv = new LightRow(function)
+ try
{
- Gravity = Gravity.CenterHorizontal,
- Width = Application.GetRealWidth(343),
- Height = Application.GetRealHeight(62),
- Radius = (uint)Application.GetMinRealAverage(12),
- BorderColor = 0x00FFFFFF,
- BorderWidth = 1,
- BackgroundColor = CSS_Color.MainBackgroundColor,
- Tag = function.spk + function.sid
- };
+ Application.RunOnMainThread(() =>
+ {
+ if (!isAppend)
+ {
+ showCount = -1;
+ functionListView.RemoveAll();
+ }
+ for(var i =0;i<100;i++)
+ //foreach (var function in functions)
+ {
+ showCount++;
+ if (showCount >= functions.Count)
+ {
+ break;
+ }
+ var function = functions[showCount];
- Action setAction = () =>
+ var functionDiv = new LightRow(function)
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(62),
+ Radius = (uint)Application.GetMinRealAverage(12),
+ BorderColor = 0x00FFFFFF,
+ BorderWidth = 1,
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Tag = function.spk + function.sid
+ };
+
+ Action setAction = () =>
+ {
+ if (sceneLishtList.Count > 0)
+ {
+ btnConfrim.IsSelected = true;
+ }
+ else
+ {
+ btnConfrim.IsSelected = false;
+ }
+ };
+
+ functionDiv.LoadDiv(sceneLishtList, setAction);
+ functionListView.AddChidren(functionDiv);
+
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+ }
+
+ if (functions.Count > showCount)
+ {
+ var btnAppend = new Button()
+ {
+ Height = Application.GetRealHeight(60),
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextID = StringId.LoadMore,
+ };
+ functionListView.AddChidren(btnAppend);
+ btnAppend.MouseUpEventHandler = (sender, e) =>
+ {
+ btnAppend.RemoveFromParent();
+ LoadLightRow(functions, true);
+ };
+ }
+ });
+ }
+ catch (Exception ex)
{
- if (sceneLishtList.Count > 0)
+ MainPage.Log("ShowFunctionRowError : " + ex.Message);
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
{
- btnConfrim.IsSelected = true;
- }
- else
- {
- btnConfrim.IsSelected = false;
- }
- };
-
- functionDiv.LoadDiv(sceneLishtList,setAction);
- functionListView.AddChidren(functionDiv);
-
- functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
- }
+ if (waitPage != null)
+ {
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
+ });
+ }
+ })
+ { IsBackground = true }.Start();
}
@@ -211,6 +309,21 @@
var form = new FloorRoomSelectPopupView();
form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) =>
{
+ btnChooseAll.MouseUpEventHandler = (sender2, e2) => {
+ if (sceneLishtList.Count > 0)
+ {
+ sceneLishtList.Clear();
+ btnChooseAll.TextID = StringId.SelectAll;
+ btnConfrim.IsSelected = false;
+ }
+ else
+ {
+ sceneLishtList.AddRange(listFunc);
+ btnChooseAll.TextID = StringId.Cancel;
+ btnConfrim.IsSelected = true;
+ }
+ LoadLightRow(listFunc);
+ };
nowSelectId = selectId;
//閲嶆柊鍔犺浇鐣岄潰
LoadLightRow(listFunc);
@@ -259,79 +372,91 @@
/// </summary>
public void LoadDiv(List<Function> functions,Action action)
{
- btnIcon = new Button()
+ try
{
- X = Application.GetRealWidth(10),
- Y = Application.GetRealHeight(15),
- Width = Application.GetRealWidth(32),
- Height = Application.GetRealWidth(32),
- UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"
- };
- bodyDiv.AddChidren(btnIcon);
-
- btnName = new Button()
- {
- X = Application.GetRealWidth(8 + 10 + 32),
- Y = Application.GetRealHeight(10),
- Width = Application.GetRealWidth(200),
- Height = Application.GetRealHeight(24),
- Text = function.name,
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.FirstLevelTitleColor,
- TextSize = CSS_FontSize.TextFontSize,
- };
- bodyDiv.AddChidren(btnName);
-
- btnFromFloor = new Button()
- {
- X = Application.GetRealWidth(8 + 10 + 32),
- Y = Application.GetRealHeight(10 + 24),
- Width = Application.GetRealWidth(200),
- Height = Application.GetRealHeight(18),
- Text = function.GetRoomListName(),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.PromptingColor1,
- TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- };
- bodyDiv.AddChidren(btnFromFloor);
-
- btnSelect = new Button()
- {
- X = Application.GetRealWidth(303),
- Gravity = Gravity.CenterVertical,
- Width = Application.GetRealWidth(32),
- Height = Application.GetRealWidth(32),
- UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png",
- SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png",
- IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null
- };
- bodyDiv.AddChidren(btnSelect);
-
- btnSelect.MouseUpEventHandler = (sender, e) => {
- btnSelect.IsSelected = !btnSelect.IsSelected;
- if(btnSelect.IsSelected)
+ btnIcon = new Button()
{
- var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
- if (addTemp == null)
- {
- functions.Add(function);
- }
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"
+ };
+ bodyDiv.AddChidren(btnIcon);
+
+ btnName = new Button()
+ {
+ X = Application.GetRealWidth(8 + 10 + 32),
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetRealWidth(200),
+ Height = Application.GetRealHeight(24),
+ Text = function.name,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ };
+ bodyDiv.AddChidren(btnName);
+
+ btnFromFloor = new Button()
+ {
+ X = Application.GetRealWidth(8 + 10 + 32),
+ Y = Application.GetRealHeight(10 + 24),
+ Width = Application.GetRealWidth(200),
+ Height = Application.GetRealHeight(18),
+ Text = function.GetRoomListName(),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ };
+ bodyDiv.AddChidren(btnFromFloor);
+
+ btnSelect = new Button()
+ {
+ X = Application.GetRealWidth(303),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png",
+ SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png",
+ IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null,
+ Tag = "ChooseIcon"
+ };
+ if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
+ {
+ btnSelect.X = Application.GetRealWidth(323);
}
- else
+ bodyDiv.AddChidren(btnSelect);
+
+ btnSelect.MouseUpEventHandler = (sender, e) =>
{
- var removeTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
- if (removeTemp != null)
+ Application.HideSoftInput();
+ btnSelect.IsSelected = !btnSelect.IsSelected;
+ if (btnSelect.IsSelected)
{
- functions.Remove(removeTemp);
+ var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
+ if (addTemp == null)
+ {
+ functions.Add(function);
+ }
}
- }
- ///鍒锋柊鐣岄潰
- if (functions.Count == 0 || functions.Count == 1)
- {
+ else
+ {
+ var removeTemp = functions.Find((obj) => obj.sid == function.sid);
+ if (removeTemp != null)
+ {
+ functions.Remove(removeTemp);
+ }
+ }
+ ///鍒锋柊鐣岄潰
+ //if (functions.Count == 0 || functions.Count == 1)
+ //{
action();
- }
- };
+ //}
+ };
+ }catch (Exception ex)
+ {
+ }
}
@@ -405,7 +530,7 @@
{
if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness))
{
- commandDic.Add(FunctionAttributeKey.Brightness, lightCCT[0].GetAttrState(FunctionAttributeKey.Brightness));
+ commandDic.Add(FunctionAttributeKey.Brightness, lightDimming[0].GetAttrState(FunctionAttributeKey.Brightness));
}
}
@@ -888,7 +1013,7 @@
void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
{
string briValue = "";
- commandDic.TryGetValue(FunctionAttributeKey.Percent,out briValue);
+ commandDic.TryGetValue(FunctionAttributeKey.Brightness,out briValue);
var dimmingView = new FrameLayout()
{
@@ -908,7 +1033,7 @@
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
TextID = StringId.Brightness,
};
- btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Percent] + "%";
+ btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Brightness] + "%";
dimmingView.AddChidren(btnBrightnessText);
@@ -938,7 +1063,7 @@
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
ProgressBarColor = CSS_Color.AuxiliaryColor1,
MaxValue = 100,
- Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Percent]),
+ Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Brightness]),
SeekBarPadding = Application.GetRealWidth(20),
IsProgressTextShow = false,
ProgressChangeDelayTime = 0,
@@ -948,7 +1073,7 @@
btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
};
dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
- commandDic[FunctionAttributeKey.Percent] = dimmerBar.Progress.ToString();
+ commandDic[FunctionAttributeKey.Brightness] = dimmerBar.Progress.ToString();
btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
foreach (var light in lights)
@@ -994,7 +1119,7 @@
#region 鑹叉俯
string valueStr = "2700";
- commandDic.TryGetValue(FunctionAttributeKey.Percent, out valueStr);
+ commandDic.TryGetValue(FunctionAttributeKey.CCT, out valueStr);
int value = Convert.ToInt32(valueStr) / 100;
var cctView = new FrameLayout()
@@ -1110,7 +1235,7 @@
#region RGB
string value = "255,255,255";
- commandDic.TryGetValue(FunctionAttributeKey.Percent, out value);
+ commandDic.TryGetValue(FunctionAttributeKey.RGB, out value);
var rgbView = new FrameLayout()
{
--
Gitblit v1.8.0