From 39c795a5de987ad14e40ba762320b92d77130726 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 20 三月 2023 17:00:12 +0800 Subject: [PATCH] 2023年03月20日16:59:29 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs | 202 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 133 insertions(+), 69 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs index f07cff2..3cb76da 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs @@ -2,6 +2,7 @@ using HDL_ON.Entity; using System.Collections.Generic; using Shared; +using Com.Videogo.Hdl; namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock { @@ -11,8 +12,15 @@ public class CommonMethod { private Loading loading; - private static CommonMethod commonMethod = null; + /// <summary> + /// 璁板綍褰撳墠鐣岄潰绱㈠紩鍊� + /// </summary> + private int pageLayoutIndexValue; + private static CommonMethod commonMethod = null; + /// <summary> + /// 鑾峰彇瀵硅薄 + /// </summary> public static CommonMethod Current { get @@ -30,26 +38,41 @@ #region --------- 璺宠浆鍒癆ndroid閭h竟鐨勬柟娉�(钀ょ煶瑙嗛闂ㄩ攣) -------- /// <summary> - /// 娣诲姞璁惧鍒颁簯绔� + /// 璇诲彇浜戠鐨勪笂璁惧鍒楄〃(android婧愮敓娣诲姞璁惧鍒颁簯绔垚鍔熷悗) /// <paramref name="devSerial"/>璁惧搴忓垪鍙�</param> /// </summary> public void SkipAddDeviceActivity(string devSerial) { - if (string.IsNullOrEmpty(devSerial)) return; - new System.Threading.Thread(() => + this.InitializationAndroidData((isBools) => { - var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock); - if (list.Count > 0) - { - var function = list.Find((o) => o.sid == devSerial); - if (function != null) - { - this.SaveFunctionFile(function); - } + if (!isBools) { + this.MainThread(()=> { + this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�"); + + }); } - }) - { IsBackground = true }.Start(); - //鏈疄鐜� + HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity); + HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, adnroidActionDevSerial) => + { + if (isBool) + { + + var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock); + if (list.Count > 0) + { + var function = list.Find((o) => o.sid == adnroidActionDevSerial); + if (function != null) + { + this.SaveFunctionFile(function); + } + } + + + } + + })); + }); + #if __IOS__ #else @@ -65,33 +88,66 @@ /// <param name="spk">璁惧spk(浜戦泙涓婂畾涔夊ソ鐨�)</param> public void SkipRTVActivity(string deviceSerial, string deviceId, string spk) { - Video.View.ShowDialog.Currnet.ClickBox(Language.StringByID(StringId.laizimenlinghujiao), (dialog) => + + this.InitializationAndroidData((isBools) => { - dialog.Close(); - }, (dialog) => - { - dialog.Close(); + if (!isBools) + { + this.MainThread(() => { + this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�"); + + }); + } + Video.View.ShowDialog.Currnet.ClickBox(Language.StringByID(StringId.laizimenlinghujiao), (dialog) => + { + dialog.Close(); + HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk); + }, (dialog) => + { + dialog.Close(); + }); + }); + #if __IOS__ #else #endif - //jumpToEZRealPlayActivity(Shared.Application.Activity, deviceId, deviceSerial, spk) } /// <summary> /// 娴忚鍘嗗彶璁板綍 /// </summary> - public void SkipRecordActivity() + public void SkipRecordActivity(string deviceId) { + this.InitializationAndroidData((s)=> { + + + HDLEzvizSdk.Instance.JumpLockHistoryActivity(Application.Activity, deviceId); + + }); //鏈疄鐜� //this.InitializationAndroidData(); // } /// <summary> /// 涓存椂瀵嗙爜寮�闂� + /// <paramref name="deviceId"/> /// </summary> - public void SkipPSWActivity() + public void SkipPSWActivity(string deviceId) { - //jumpTempPasswordActivity(Application.Activity, deviceId); + + this.InitializationAndroidData((isBools) => + { + if (!isBools) + { + this.MainThread(() => + { + this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�"); + + }); + } + HDLEzvizSdk.Instance.JumpTempPasswordActivity(Application.Activity, deviceId); + + }); } /// <summary> @@ -99,6 +155,8 @@ /// </summary> public void InitializationAndroidData(Action<bool> action) { + + bool isBool = true; this.SunThread(() => { @@ -131,36 +189,8 @@ //info.de //EZSDK.IOS.EZSDK.Play(info); #else - //Android - //1.璁剧疆鎵�闇�娌充笢鐨則oken銆佸煙鍚嶅湴鍧� - //2.璁剧疆钀ょ煶瀛愯处鍙风殑token - //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈� - ((BaseActivity)Shared.Application.Activity).SetCamera(b => - { - if (b) - { - ((BaseActivity)Shared.Application.Activity).SetPermission(result => - { - if (result) - { - Android.Content.Intent intent = new Android.Content.Intent(); - var bundle = new Android.OS.Bundle(); - //浼犻�抧ame鍙傛暟涓簍inyphp - bundle.PutString("EzChildAccessToken", ezChildAccessToken); - bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString); - bundle.PutString("HdlrefreshToken", UserInfo.Current.RefreshToken); - bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost); - bundle.PutString("EzvizAppKey", "1aa98a90489b4838b966b57018b4b04b"); - bundle.PutInt("Platform", 1); - bundle.PutString("HomeId", DB_ResidenceData.Instance.CurrentRegion.id); - intent.PutExtras(bundle); - //intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); - //Shared.Application.Activity.StartActivity(intent); - } - }, "android.permission.RECORD_AUDIO"); + HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id); - } - }); #endif }); @@ -179,6 +209,7 @@ } }); } + /// <summary> /// 鏇存崲浣忓畢 /// </summary> @@ -239,27 +270,31 @@ { get { - if (loading == null) + this.MainThread(() => { - loading = new Loading(); - } - if (MainPage.BasePageView.ChildrenCount < 1) - { - return loading; - } - View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1); - if (view is FrameLayout) - { - ((FrameLayout)view).AddChidren(loading); - } - else if (view is PageLayout) - { - ((PageLayout)view).AddChidren(loading); - } + //if (loading != null && this.pageLayoutIndexValue == MainPage.BasePageView.ChildrenCount - 1) + //{ + // //闃叉浜岄噸娣诲姞瀵硅薄 + // return; + //} + if (loading == null)//|| MainPage.BasePageView.ChildrenCount < 1) + { + loading = new Loading(); + } + //loading.BringToFront(); + Application.MainPage.AddChidren(loading); + //View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1); + //if (view is ViewGroup) + //{ + // pageLayoutIndexValue = MainPage.BasePageView.ChildrenCount - 1; + // ((ViewGroup)view).AddChidren(loading); + //} + }); return loading; } } + /// <summary> /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鍒楄〃 /// </summary> @@ -376,5 +411,34 @@ room,//鎴块棿 push,//鎺ㄩ�� } + + + /// <summary> + /// + /// </summary> + public class AndroidIHdlInterface : Java.Lang.Object, IHdlInterface + { + + Action<bool,string> mAction; + public AndroidIHdlInterface(Action<bool,string> action) + { + mAction = action; + } + /// <summary> + /// + /// </summary> + /// <param name="p0">true鏄叆缃戞垚鍔�(婧愮敓鍥炶皟杩斿洖)</param> + /// <param name="p1">璁惧鐨勫簭鍒楀寲(婧愮敓鍥炶皟杩斿洖)</param> + public void AddCallback(bool p0, string p1) + { + mAction?.Invoke(p0,p1); + } + + + } + + } + + } -- Gitblit v1.8.0