From cf3d4880046912f8b46c9e54769986a179faa26c Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 08 四月 2021 18:01:13 +0800 Subject: [PATCH] 2021-04-08 1.更新音箱功能 --- HDL_ON/Common/Constant.cs | 32 + HDL-ON_Android/Assets/Language.ini | 14 HDL-ON_Android/Assets/Phone/PersonalCenter/SmartSpeaker.png | 0 HDL-ON_iOS/HDL-ON_iOS.csproj | 1 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 35 ++ DLL/Shared.IOS.TBL.dll | 0 HDL_ON/HDL_ON.projitems | 2 HDL-ON_Android/HDL-ON_Android.csproj | 1 HDL-ON_iOS/Resources/Language.ini | 8 HDL_ON/DAL/Server/NewAPI.cs | 40 +- HDL_ON/DAL/Server/NewApiRes.cs | 141 ++++++++ HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 118 +++++- HDL_ON/Common/R.cs | 19 + HDL_ON/DAL/Server/HttpServerRequest.cs | 62 +++ .vs/HDL_APP_Project/xs/UserPrefs.xml | 31 - HDL-ON_iOS/Resources/Phone/PersonalCenter/SmartSpeaker.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs | 490 ++++++++++++++++++++++++++++ 17 files changed, 924 insertions(+), 70 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index e7457db..3e157e6 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,6 +1,9 @@ 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> - <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" /> - <MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.08FD445C-3EE8-4ED2-BF28-B42ADD0DA92C" /> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs"> + <Files> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs" Line="437" Column="36" /> + </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> @@ -8,27 +11,18 @@ <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> - <Node name="DriverLayer" expanded="True" /> - <Node name="Mqtt" expanded="True" /> - <Node name="Server" expanded="True"> - <Node name="HttpUtil.cs" selected="True" /> - </Node> + <Node name="Server" expanded="True" /> </Node> <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True"> - <Node name="Widget" expanded="True" /> - </Node> <Node name="UI2" expanded="True"> <Node name="4-PersonalCenter" expanded="True"> - <Node name="AboutOn" expanded="True" /> - </Node> - <Node name="FuntionControlView" expanded="True"> - <Node name="Video" expanded="True" /> + <Node name="SmartSpeaker" expanded="True"> + <Node name="SmartSpeakerListPage.cs" selected="True" /> + </Node> </Node> </Node> </Node> </Node> - <Node name="HDL-ON_iOS" expanded="True" /> </Node> </State> </Pad> @@ -40,11 +34,10 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> + <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> - <BreakpointStore> - <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs" relfile="HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs" line="50" column="1" /> - </BreakpointStore> + <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> </Properties> \ No newline at end of file diff --git a/DLL/Shared.IOS.TBL.dll b/DLL/Shared.IOS.TBL.dll index fba6a63..4567570 100644 --- a/DLL/Shared.IOS.TBL.dll +++ b/DLL/Shared.IOS.TBL.dll Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index d2b9e87..cd221c8 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -424,9 +424,7 @@ 437=Device List 438=humidity:{0}% air:{1} wind:{2} - - -1000=Indoor Humidity +1000=Room Humidity 1001=V-chip 1002=Anion 1003=Sterilization @@ -739,6 +737,10 @@ 9061=Find your password by clicking on "Forgot Password", or try again in {0} minute. 9062=Check 9063=You still have {0} times. +9064=Smart speaker +9065=Data management +9066=Remarks +9067=Remarks cannot be blank. 10000=Invalid password, please log in again. 10001=Fail to request server, please try again later. @@ -1290,7 +1292,6 @@ 1086=椋庨��3妗� - 4000=鍙瀵硅 4001=閫氳瘽璁板綍 4002=*浜戠鐓х墖鍙繚鐣�30澶� @@ -1306,7 +1307,6 @@ 4012=閰嶇疆鍙傛暟鏈夊紓甯�! 4013=闂ㄧ浜岀淮鐮� 4014=涓存椂瀵嗙爜 - 5000=闊充箰 5001=缁勫悎 @@ -1626,6 +1626,10 @@ 9061=璇烽�氳繃蹇樿瀵嗙爜鎵惧洖瀵嗙爜鎴杮0}鍒嗛挓鍚庨噸璇�. 9062=鏌ョ湅 9063=杩樻湁{0}娆℃満浼氥�� +9064=鏅鸿兘闊崇 +9065=鏁版嵁绠$悊 +9066=澶囨敞 +9067=澶囨敞涓嶈兘涓虹┖ 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL-ON_Android/Assets/Phone/PersonalCenter/SmartSpeaker.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/SmartSpeaker.png new file mode 100644 index 0000000..74b97d4 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/SmartSpeaker.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 156c832..d107344 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -1112,6 +1112,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> + <AndroidAsset Include="Assets\Phone\PersonalCenter\SmartSpeaker.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 733557b..f48a23a 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1219,6 +1219,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> + <BundleResource Include="Resources\Phone\PersonalCenter\SmartSpeaker.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 4cdd0dd..cd221c8 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -737,6 +737,10 @@ 9061=Find your password by clicking on "Forgot Password", or try again in {0} minute. 9062=Check 9063=You still have {0} times. +9064=Smart speaker +9065=Data management +9066=Remarks +9067=Remarks cannot be blank. 10000=Invalid password, please log in again. 10001=Fail to request server, please try again later. @@ -1622,6 +1626,10 @@ 9061=璇烽�氳繃蹇樿瀵嗙爜鎵惧洖瀵嗙爜鎴杮0}鍒嗛挓鍚庨噸璇�. 9062=鏌ョ湅 9063=杩樻湁{0}娆℃満浼氥�� +9064=鏅鸿兘闊崇 +9065=鏁版嵁绠$悊 +9066=澶囨敞 +9067=澶囨敞涓嶈兘涓虹┖ 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� 10001=璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 diff --git a/HDL-ON_iOS/Resources/Phone/PersonalCenter/SmartSpeaker.png b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SmartSpeaker.png new file mode 100644 index 0000000..74b97d4 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SmartSpeaker.png Binary files differ diff --git a/HDL_ON/Common/Constant.cs b/HDL_ON/Common/Constant.cs index 79920f1..9f79b2f 100644 --- a/HDL_ON/Common/Constant.cs +++ b/HDL_ON/Common/Constant.cs @@ -284,7 +284,35 @@ /// </summary> Error, } - + + public enum SpeakerType + { + /// <summary> + /// 灏忓害 + /// </summary> + DuerOS = 0, + /// <summary> + /// Google Home + /// </summary> + Google, + /// <summary> + /// Alexa Echo + /// </summary> + Alexa, + /// <summary> + /// Alice + /// </summary> + Alice, + /// <summary> + /// 澶╃尗绮剧伒 + /// </summary> + Aligenie, + /// <summary> + /// 鎬濆繀椹� + /// </summary> + AISpeech + } + #endregion -} + } diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 8595a72..5c4ed77 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -1313,6 +1313,25 @@ /// 杩樻湁{0}娆℃満浼氥�� /// </summary> public const int AFewMoreChances = 9063; + /// <summary> + /// 鏅鸿兘闊崇 + /// </summary> + public const int SmartSpeaker = 9064; + /// <summary> + /// 鏁版嵁绠$悊 + /// </summary> + public const int DataManagement = 9065; + /// <summary> + /// 澶囨敞 + /// </summary> + public const int Remarks = 9066; + /// <summary> + /// 澶囨敞涓嶈兘涓虹┖ + /// </summary> + public const int RemarksCannotBeBlank = 9067; + + + #region 缃戠粶璇锋眰鍝嶅簲閿欒鎻愮ず淇℃伅 /// <summary> diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index d693f04..b23c8ad 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -928,6 +928,9 @@ { try { + //鍏堟竻绌烘帹閫両D锛岄伩鍏嶄娇鐢ㄧ紦瀛樼殑PushId涓哄叾瀹冭处鍙风殑鎯呭喌锛屽鑷存煡璇㈠埌鍏跺畠璐﹀彿鐨勬帹閫佽褰� + OnAppConfig.Instance.PushId = ""; + string deviceType = PhoneDeviceType.Android.ToString(); #if __IOS__ deviceType = PhoneDeviceType.IOS.ToString(); @@ -2218,7 +2221,7 @@ #endregion - #region 钀ょ煶浜慡DK鐩稿叧鎺ュ彛 + #region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________ /// <summary> /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� /// </summary> @@ -2231,7 +2234,7 @@ #endregion - #region 鍙瀵硅 + #region 鈻� 鍙瀵硅_________________________ /// <summary> /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋楋紝骞惰幏鍙栭棬鍙f満鍒楄〃 /// </summary> @@ -2245,5 +2248,60 @@ return pack; } #endregion + + #region 鈻� 闊崇璇█鎺у埗鐩稿叧_________________________ + /// <summary> + /// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃 + /// </summary> + /// <returns></returns> + public ResponsePackNew GetSpeakerList() + { + var requestJson = HttpUtil.GetSignRequestJson(new GetSpeakerObj + { + homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, + }); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_List_Get, requestJson); + } + + /// <summary> + /// 缂栬緫闊崇鎺堟潈澶囨敞 + /// </summary> + /// <returns></returns> + public ResponsePackNew UpdateSpeakerRemark(UpdateSpeakerRemarkObj remarkObj) + { + var requestJson = HttpUtil.GetSignRequestJson(remarkObj); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Remark_Update, requestJson); + } + + /// <summary> + /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 + /// </summary> + /// <param name="getType">0 鏄煡璇㈠叏閮� 1鏄煡璇㈣澶� 2鏄煡璇㈠満鏅�</param> + /// <param name="tokenId"></param> + /// <returns></returns> + public ResponsePackNew GetSpeakerDeviceList(int getType, string tokenId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("tokenId", tokenId); + if (getType > 0) + { + d.Add("isDevice", getType == 1); + } + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Get, requestJson); + } + + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + /// <returns></returns> + public ResponsePackNew UpdateSpeakerDeviceList(UpdateSpeakerDeviceListObj updateSpeakerDeviceListObj) + { + var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson); + } + #endregion + } } \ No newline at end of file diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index dfb9735..fbce795 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -235,29 +235,23 @@ #endregion - #region 鈻� zigbeespeakerservice -- 璇煶鎺у埗鏈嶅姟___________________________ - - ///// <summary> - ///// 鑾峰彇闊崇鍒楄〃 - ///// </summary> - //public const string API_GET_Speaker_Auth = "/speakerservices/Auth"; - - ///// <summary> - ///// 淇敼闊崇澶囨敞 - ///// </summary> - //public const string API_PUT_Speaker_Auth_Rename = "/speakerservices/Auth"; - - ///// <summary> - ///// 鑾峰彇璁惧鍜屽満鏅垪琛� - ///// </summary> - //public const string API_GET_Speaker_BatchEdit_V2 = "/speakerservices/BatchEdit_V2"; - - ///// <summary> - ///// 娣诲姞璁惧鍜屽満鏅垪琛� - ///// </summary> - //public const string API_POST_Speaker_BatchEdit_V2 = "/speakerservices/BatchEdit_V2"; - - + #region 鈻� Speaker -- 璇煶鎺у埗鏈嶅姟___________________________ + /// <summary> + /// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃 + /// </summary> + public const string API_POST_Speaker_List_Get = "/smart-footstone/app/token/list"; + /// <summary> + /// 缂栬緫闊崇鎺堟潈澶囨敞 + /// </summary> + public const string API_POST_Speaker_Remark_Update = "/smart-footstone/app/token/update"; + /// <summary> + /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 + /// </summary> + public const string API_POST_Speaker_DeviceList_Get = "/home-wisdom/app/tokenRelation/list"; + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + public const string API_POST_Speaker_DeviceList_Update = "/home-wisdom/app/tokenRelation/save"; #endregion #region 鈻� PushSerivce -- 鎺ㄩ�佹湇鍔℃帴鍙__________________________ diff --git a/HDL_ON/DAL/Server/NewApiRes.cs b/HDL_ON/DAL/Server/NewApiRes.cs index c23dac9..21f66ff 100644 --- a/HDL_ON/DAL/Server/NewApiRes.cs +++ b/HDL_ON/DAL/Server/NewApiRes.cs @@ -1486,7 +1486,146 @@ /// </summary> public string expireTime; } - + + + #region 闊崇 + /// <summary> + /// 鑾峰彇闊崇鍒楄〃 + /// </summary> + [System.Serializable] + public class GetSpeakerObj : HomeIdObj + { + /// <summary> + /// 骞冲彴鍚嶇О + /// </summary> + public string platformName; + /// <summary> + /// 椤甸潰澶у皬 + /// </summary> + public int pageSize = 100; + /// <summary> + /// 椤甸潰搴忓彿 + /// </summary> + public int pageNo = 1; + } + + + [System.Serializable] + public class SpeakerObj : HomeIdObj + { + /// <summary> + /// 璁板綍鐨勪富閿甶d + /// </summary> + public string tokenId; + } + + /// <summary> + /// 鏇存柊闊崇澶囨敞 + /// </summary> + [System.Serializable] + public class UpdateSpeakerRemarkObj : SpeakerObj + { + /// <summary> + /// 澶囨敞 + /// </summary> + public string remark; + } + + + /// <summary> + /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 + /// </summary> + [System.Serializable] + public class GetSpeakerDeviceListObj : HomeIdObj + { + /// <summary> + /// 璁板綍鐨勪富閿甶d + /// </summary> + public string tokenId; + + } + + /// <summary> + /// + /// </summary> + [System.Serializable] + public class TargetInfo + { + /// <summary> + /// 鎺у埗鐨勭洰鏍嘔d锛屼簯绔殑璁惧Id鎴栬�呭満鏅疘d + /// </summary> + public string targetId; + /// <summary> + /// 鏄惁鏄澶囷紝鍦烘櫙涓篺alse + /// </summary> + public bool isDevice; + /// <summary> + /// 鐩爣鍚嶇О + /// </summary> + public string targetName; + } + + + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + [System.Serializable] + public class UpdateSpeakerDeviceListObj : SpeakerObj + { + /// <summary> + /// 澶囨敞 + /// </summary> + public List<TargetInfo> targetInfos; + } + + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + [System.Serializable] + public class SpeakerListRes + { + /// <summary> + /// 闊崇鍒楄〃 + /// </summary> + public List<SpeakerInfo> list; + } + + /// <summary> + /// 闊崇淇℃伅 + /// </summary> + [System.Serializable] + public class SpeakerInfo + { + /// <summary> + /// + /// </summary> + public string platformName { get; set; } + /// <summary> + /// + /// </summary> + public string remark { get; set; } + /// <summary> + /// + /// </summary> + public string tokenId { get; set; } + /// <summary> + /// + /// </summary> + public string userId { get; set; } + /// <summary> + /// + /// </summary> + public string userRegion { get; set; } + /// <summary> + /// + /// </summary> + public string homeId { get; set; } + /// <summary> + /// + /// </summary> + public string homeRegion { get; set; } + } + #endregion //#region 鏃ф帴鍙� ///// <summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 560e165..4406018 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -395,6 +395,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoSend.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\VideoMainView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\ObjectClass.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SmartSpeaker\SmartSpeakerListPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> @@ -438,5 +439,6 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\" /> <Folder Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\" /> + <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\SmartSpeaker\" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index df6caf4..17c99a0 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -140,7 +140,7 @@ /// <summary> /// 鑾峰彇鏀寔灏忓尯鍩� /// </summary> - FrameLayout supportView; + VerticalScrolViewLayout supportView; /// <summary> /// 鑾峰彇鏀寔鏂囨湰 /// </summary> @@ -150,6 +150,10 @@ /// 鍏充簬On鏂囨湰 /// </summary> Button btnAboutOnText; + /// <summary> + /// 鏅鸿兘闊崇鏂囨湰 + /// </summary> + Button btnSmartSpeakerText; #endregion @@ -724,9 +728,11 @@ //softSettingView.AddChidren(btnGeneralSettingsRight); #endregion #endregion - #region 鑾峰彇鏀寔 + + #region 鏅鸿兘闊崇銆佽幏鍙栨敮鎸併�佸叧浜嶰N+ 绛夎彍鍗曞垪琛� contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) }); - supportView = new FrameLayout() + + supportView = new VerticalScrolViewLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), @@ -735,18 +741,87 @@ Radius = (uint)Application.GetRealHeight(12), BorderColor = 0x00FFFFFF, BorderWidth = 0, + ScrollEnabled = false, + VerticalScrollBarEnabled = false,//闅愯棌婊氬姩鏉� }; contentView.AddChidren(supportView); + + + + #region 鏅鸿兘闊崇 + if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) + { + //supportView 鍔犻珮 鏄剧ず3琛� 3*44 + supportView.Height = Application.GetRealWidth(3*44); + + FrameLayout smartSpeakerView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + supportView.AddChidren(smartSpeakerView); + + //浣忓畢涓哄綋鍓嶈处鍙锋墠鏄剧ず鏅鸿兘闊崇鍏ュ彛 + Button btnSmartSpeakerIcon = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(10), + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + UnSelectedImagePath = "PersonalCenter/SmartSpeaker.png", + }; + smartSpeakerView.AddChidren(btnSmartSpeakerIcon); + + btnSmartSpeakerText = new Button() + { + X = Application.GetRealWidth(48), + Width = Application.GetRealWidth(270), + Height = Application.GetRealWidth(44), + TextID = StringId.SmartSpeaker, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize + }; + smartSpeakerView.AddChidren(btnSmartSpeakerText); + + Button btnSmartSpeakerRight = new Button() + { + X = Application.GetRealWidth(315), + Y = Application.GetRealWidth(14), + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + smartSpeakerView.AddChidren(btnSmartSpeakerRight); + + var btnSmartSpeakerViewLine = new Button() + { + X = Application.GetRealWidth(48), + Y = Application.GetRealWidth(43), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(279), + BackgroundColor = CSS_Color.DividingLineColor + }; + smartSpeakerView.AddChidren(btnSmartSpeakerViewLine); + } + + #endregion + + #region 鑾峰彇鏀寔 + FrameLayout supView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + supportView.AddChidren(supView); Button btnSupportIcon = new Button() { X = Application.GetRealWidth(12), - Y = Application.GetRealHeight(10), + Y = Application.GetRealWidth(10), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "PersonalCenter/SupportIcon.png", }; - supportView.AddChidren(btnSupportIcon); + supView.AddChidren(btnSupportIcon); btnSupportText = new Button() { @@ -758,7 +833,8 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize }; - supportView.AddChidren(btnSupportText); + supView.AddChidren(btnSupportText); + Button btnSupportRight = new Button() { X = Application.GetRealWidth(315), @@ -767,33 +843,39 @@ Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; - supportView.AddChidren(btnSupportRight); - - + supView.AddChidren(btnSupportRight); var btnSupportViewLine = new Button() { X = Application.GetRealWidth(48), - Y = btnSupportText.Bottom, + Y = Application.GetRealWidth(43), Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(279), BackgroundColor = CSS_Color.DividingLineColor }; - supportView.AddChidren(btnSupportViewLine); + supView.AddChidren(btnSupportViewLine); + #endregion + + #region 鍏充簬ON+ + FrameLayout aboutView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + supportView.AddChidren(aboutView); Button btnAboutOnIcon = new Button() { X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(54), + Y = Application.GetRealWidth(10), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "PersonalCenter/InfoOnIcon.png", }; - supportView.AddChidren(btnAboutOnIcon); + aboutView.AddChidren(btnAboutOnIcon); btnAboutOnText = new Button() { X = Application.GetRealWidth(48), - Y = btnSupportViewLine.Bottom, Width = Application.GetRealWidth(370), Height = Application.GetRealWidth(44), TextID = StringId.AboutOn, @@ -801,18 +883,18 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize }; - supportView.AddChidren(btnAboutOnText); + aboutView.AddChidren(btnAboutOnText); Button btnAboutOnRight = new Button() { X = Application.GetRealWidth(315), - Y = Application.GetRealWidth(58), + Y = Application.GetRealWidth(14), Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; - supportView.AddChidren(btnAboutOnRight); - + aboutView.AddChidren(btnAboutOnRight); + #endregion #endregion diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 6096b8e..0b28ac8 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using System.Collections.Generic; using HDL_ON.DAL.Server; using HDL_ON.Entity; using Shared; @@ -23,6 +24,7 @@ LoadEvent_SkipResdentialManagePage(); LoadEvent_GoMemberManagement(); LoadEvent_SkipbtnAddFunctionPage(); + LoadEvent_SkipSmartSpeakerPage(); } } @@ -299,6 +301,39 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; } + + /// <summary> + /// 璺宠浆鏅鸿兘闊崇椤甸潰 + /// </summary> + void LoadEvent_SkipSmartSpeakerPage() + { + btnSmartSpeakerText.MouseUpEventHandler = (sender, e) => + { + + //var page = new SmartSpeakerListPage(); + //MainPage.BasePageView.AddChidren(page); + //page.LoadPage(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + var mList = new List<string>(); + mList.Add("骞夸笢"); + mList.Add("婀栧崡"); + mList.Add("骞胯タ"); + + var mList2 = new List<List<string>>(); + mList2.Add(new List<string> { "骞垮窞", "娣卞湷", "涓滆帪", "浣涘北", "鎯犲窞" }); + mList2.Add(new List<string> { "闀挎矙", "宀抽槼", "鏍床", "鏍床" }); + mList2.Add(new List<string> { "妗傛灄", "鍗楀畞", "鐜夋灄" }); + //PickerView.ShowOneList(mList, null); + + PickerView.ShowSecondary(mList, mList2, (selectIndex1, selectIndex2) => + { + System.Console.WriteLine("selectIndex锛�" + mList[selectIndex1] + " - " + mList2[selectIndex1][selectIndex2]); + + //textView.Text = "selectIndex锛�" + mList[selectIndex1] + " - " + mList2[selectIndex1][selectIndex2]; + }, 1, 3, "璇烽�夋嫨0", "纭0", "鍙栨秷0"); + }; + } #endregion diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs new file mode 100644 index 0000000..1292090 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/SmartSpeaker/SmartSpeakerListPage.cs @@ -0,0 +1,490 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; +using System.Collections.Generic; +using System.Threading; +using HDL_ON.DAL.Server; + +namespace HDL_ON.UI +{ + + + /// <summary> + /// 鏅鸿兘闊崇鍒楄〃 + + /// </summary> + public class SmartSpeakerListPage : FrameLayout + { + FrameLayout bodyView; + /// <summary> + /// + /// </summary> + FrameLayout emptyTipFrameLayout; + /// <summary> + /// 褰撳墠 + /// </summary> + VerticalScrolViewLayout bodyScrolView; + /// <summary> + /// 鍐呭涓虹┖鎻愮ずView + /// </summary> + FrameLayout emptyTipView; + + /// 鐩墠瀵规帴鐨勯煶绠辩被鍨� + /// 灏忓害=DuerOS + /// Google Home = Google + /// Alexa Echo = Alexa + /// Alice = Alice + /// 澶╃尗绮剧伒=Aligenie + /// 鎬濆繀椹�=AISpeech + + + + /// <summary> + /// + /// </summary> + public SmartSpeakerListPage() + { + bodyView = this; + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + } + + /// <summary> + /// + /// </summary> + public void LoadPage() + { + new TopViewDiv(bodyView, Language.StringByID(StringId.SmartSpeaker)).LoadTopView(); + + int bodyY = Application.GetRealHeight(64); + bodyScrolView = new VerticalScrolViewLayout() + { + Y = bodyY, + Height = bodyView.Height - bodyY, + BackgroundColor = CSS_Color.BackgroundColor, + }; + bodyView.AddChidren(bodyScrolView); + + //AddEmptyTipView(); + + LoadSmartSpeakertListView(bodyScrolView); + } + + /// <summary> + /// 娣诲姞鍐呭涓虹┖鎻愮ず椤甸潰 + /// </summary> + void AddEmptyTipView() + { + emptyTipView = new FrameLayout() + { + Height = bodyScrolView.Height, + Width = bodyScrolView.Width, + }; + bodyScrolView.AddChidren(emptyTipView); + + var tipView = new EmptyTipView() + { + Gravity = Gravity.Center + }; + emptyTipView.AddChidren(tipView); + } + + /// <summary> + /// 鍔犺浇闊崇鍒楄〃 + /// </summary> + /// <param name="VerticalScrolViewMiddle"></param> + void LoadSmartSpeakertListView(VerticalScrolViewLayout VerticalScrolViewMiddle) + { + VerticalScrolViewMiddle.RemoveAll(); + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + System.Threading.Tasks.Task.Run(() => + { + try + { + + var revertObj = new HttpServerRequest().GetSpeakerList(); + if (revertObj.Code == StateCode.SUCCESS) + { + var speakerListRes = Newtonsoft.Json.JsonConvert.DeserializeObject<SpeakerListRes>(revertObj.Data.ToString()); + if (speakerListRes != null && speakerListRes.list != null && speakerListRes.list.Count > 0) + { + Application.RunOnMainThread(() => + { + foreach (var speaker in speakerListRes.list) + { + AddRowView(speaker, VerticalScrolViewMiddle); + } + + }); + } + else + { + Application.RunOnMainThread(() => + { + AddEmptyTipView(); + }); + } + } + else + { + Application.RunOnMainThread(() => + { + AddEmptyTipView(); + }); + //鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); + } + } + catch + { + + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }); + } + + + + /// <summary> + /// + /// </summary> + /// <param name="speakerInfo"></param> + /// <param name="VerticalScrolViewMiddle"></param> + void AddRowView(SpeakerInfo speakerInfo, VerticalScrolViewLayout VerticalScrolViewMiddle) + { + //閫忔槑濉厖鍒嗗壊view + var lineView = new FrameLayout() + { + Height = Application.GetRealWidth(12), + }; + VerticalScrolViewMiddle.AddChidren(lineView); + + var rowView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(200), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + BorderColor = 0x00000000, + BorderWidth = 0, + }; + VerticalScrolViewMiddle.AddChidren(rowView); + + #region 闊崇绫诲瀷 + var view1 = new FrameLayout() + { + Height = Application.GetRealWidth(49), + }; + rowView.AddChidren(view1); + + var btnSpeakerNameTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + Text = GetSpeakerTypeString(speakerInfo.platformName) + }; + view1.AddChidren(btnSpeakerNameTitle); + + Button line1 = new Button() + { + Y = view1.Bottom, + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealWidth(1), + Width = Application.GetRealWidth(311), + BackgroundColor = CSS_Color.DividingLineColor, + }; + rowView.AddChidren(line1); + + #endregion + + #region 澶囨敞 + var view2 = new FrameLayout() + { + Y = line1.Bottom, + Height = Application.GetRealWidth(49), + }; + rowView.AddChidren(view2); + + var btnNicknameTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Remarks, + }; + view2.AddChidren(btnNicknameTitle); + + var btnNickname = new Button() + { + Width = Application.GetRealWidth(295), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + Text = speakerInfo.remark + }; + view2.AddChidren(btnNickname); + + if (string.IsNullOrEmpty(speakerInfo.remark)) { + btnNickname.TextID = StringId.SmartSpeaker; + } + + var btnNicknameRight = new Button() + { + X = Application.GetRealWidth(311), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + view2.AddChidren(btnNicknameRight); + + Button line2 = new Button() + { + Y = view2.Bottom, + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealWidth(1), + Width = Application.GetRealWidth(311), + BackgroundColor = CSS_Color.DividingLineColor, + }; + rowView.AddChidren(line2); + + + //淇濆瓨浜嬩欢 + Action<string> renameAction = (newName) => + { + RenameAlexaRemark(newName, speakerInfo, btnNickname); + }; + + btnNickname.MouseUpEventHandler += (sender, e) => + { + new PublicAssmebly().LoadDialog_EditParater(StringId.Remarks, speakerInfo.remark, renameAction, StringId.RemarksCannotBeBlank, 0, new List<string>()); + + //HDLCommon.Current.ShowEditTextDialog(speakerInfo.remark, renameAction, Language.StringByID(R.MyInternationalizationString.rename)); + }; + #endregion + + #region 鏁版嵁绠$悊 + var view3 = new FrameLayout() + { + Y = line2.Bottom, + Height = Application.GetRealWidth(49), + }; + rowView.AddChidren(view3); + + var btnDataTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.DataManagement, + }; + view3.AddChidren(btnDataTitle); + + var btnDataRight = new Button() + { + X = Application.GetRealWidth(311), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + view3.AddChidren(btnDataRight); + + Button line3 = new Button() + { + Y = view3.Bottom, + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealWidth(1), + Width = Application.GetRealWidth(311), + BackgroundColor = CSS_Color.DividingLineColor, + }; + rowView.AddChidren(line3); + + EventHandler<MouseEventArgs> eHandler = (sender, e) => + { + //璺宠浆椤甸潰 + GotoSpeakerManagementPage(speakerInfo); + }; + view3.MouseUpEventHandler += eHandler; + btnDataTitle.MouseUpEventHandler += eHandler; + btnDataRight.MouseUpEventHandler += eHandler; + #endregion + + #region 瑙i櫎缁戝畾 + var view4 = new FrameLayout() + { + Y = line3.Bottom, + Height = Application.GetRealWidth(49), + }; + rowView.AddChidren(view4); + + var btnUnbindTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Unbind, + }; + view4.AddChidren(btnUnbindTitle); + + var btnUnbindRight = new Button() + { + X = Application.GetRealWidth(311), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + view4.AddChidren(btnUnbindRight); + + + #endregion + + + + } + + /// <summary> + /// 璇锋眰淇敼澶囨敞 + /// </summary> + /// <param name="newName"></param> + /// <param name="speakerInfo"></param> + /// <param name="btnName"></param> + void RenameAlexaRemark(string newName, SpeakerInfo speakerInfo, Button btnName) + { + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + System.Threading.Tasks.Task.Run(() => + { + try + { + var updateSpeakerRemarkObj = new UpdateSpeakerRemarkObj() + { + homeId = speakerInfo.homeId, + tokenId = speakerInfo.tokenId, + remark = newName + }; + + var revertObj = new HttpServerRequest().UpdateSpeakerRemark(updateSpeakerRemarkObj); + if (revertObj.Code == StateCode.SUCCESS) + { + //AmendTheSuccess 淇敼鎴愬姛 + Application.RunOnMainThread(() => + { + speakerInfo.remark = newName; + btnName.Text = newName; + Utlis.ShowTip(Language.StringByID(StringId.ModifySuccess)); + //Utlis.ShowAlertOnMainThread(Language.StringByID(R.MyInternationalizationString.AmendTheSuccess)); + + }); + } + else + { + //鎻愮ず閿欒 + IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); + } + } + catch + { + + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }); + + } + + /// <summary> + /// + /// </summary> + /// <param name="platformName"></param> + /// <returns></returns> + string GetSpeakerTypeString(string platformName){ + var name = platformName; + if (platformName == SpeakerType.DuerOS.ToString()) + { + name = "灏忓害"; + } + else if (platformName == SpeakerType.Google.ToString()){ + name = "Google Home"; + } + else if (platformName == SpeakerType.Alexa.ToString()) + { + name = "Alexa Echo"; + } + else if (platformName == SpeakerType.Alice.ToString()) + { + name = "Alice"; + } + else if (platformName == SpeakerType.Aligenie.ToString()) + { + name = "澶╃尗绮剧伒"; + } + else if (platformName == SpeakerType.AISpeech.ToString()) + { + name = "鎬濆繀椹�"; + } + + return name; + } + + /// <summary> + /// 璺宠浆AlexaDeviceListPage椤甸潰 + /// </summary> + /// <param name="speakerInfo"></param> + void GotoSpeakerManagementPage(SpeakerInfo speakerInfo) + { + ////娌$粦瀹氬繕璁版彁绀哄厛缁戝畾缃戝叧锛岀姝㈣烦杞� + //if (!UserConfig.Instance.CheckWhetherGatewayIdNotNull()) + //{ + // Utlis.ShowAlertOnMainThread(Language.StringByID(R.MyInternationalizationString.PleaseBindTheGatewayFirst)); + // return; + //} + + + ////璺宠浆Alexa绠$悊椤甸潰 + //AlexaDeviceListPage speakerInfoDeviceListPage = new AlexaDeviceListPage(speakerInfo); + //UserMiddle.SettingPageView.AddChidren(speakerInfoDeviceListPage); + //speakerInfoDeviceListPage.ShowPage(); + //UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1; + } + } + + + +} -- Gitblit v1.8.0