using System; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class AppUnlockSettingsPage : FrameLayout { #region 控件列表 FrameLayout bodyView; /// /// 上部分显示区域 /// FrameLayout topContentView; /// /// 解锁页面选择列表view /// HorizontalScrolViewLayout optionView; /// /// 无保护选项提示 /// Button btnUnprotectedSelectionTip; /// /// 无保护选项选中图标 /// Button btnUnprotectedSelectionIcon; /// /// 无保护选项背景 /// Button btnUnprotectedBg; /// /// 启动时选项提示 /// Button btnStartupSelectionTip; /// /// 启动时选项选中图标 /// Button btnStartupSelectionIcon; /// /// 启动时选项背景 /// Button btnStartupBg; /// /// 设置安防选项提示 /// Button btnSecuritySelectionTip; /// /// 设置安防选项选中图标 /// Button btnSecuritySelectionIcon; /// /// 设置安防选项背景 /// Button btnSecurityBg; /// /// 设置门锁选项提示 /// Button btnDoorlockSelectionTip; /// /// 设置门锁选项选中图标 /// Button btnDoorlockSelectionIcon; /// /// 设置门锁选项背景 /// Button btnDoorlockBg; /// /// 密码使用选择的详细内容提示 /// Button btnTipMsg; /// /// 解锁方式区域view /// VerticalScrolViewLayout unlockOptionView; /// /// 密码设置文本 /// 事件跳转按钮 /// Button btnPasswordUnlockTitle; /// /// 修改密码文本 /// 事件跳转按钮 /// Button btnResetPasswordTitle; /// /// 手势设置文本 /// 事件跳转按钮 /// Button btnGestureUnlockTitle; /// /// 修改手势密码 /// 事件跳转按钮 /// Button btnResetGestureTitle; /// /// 指纹设置文本 /// 事件跳转按钮 /// Button btnFingerprintUnlockSwtichIcon; /// /// 面容ID设置文本 /// 事件跳转按钮 /// Button btnFaceIdUnlockSwtichIcon; /// /// 指纹解锁方式Row /// FrameLayout fingerprintUnlockDiv; /// /// 面容解锁方式Row /// FrameLayout faceIdUnlockDiv; #endregion /// /// 是否支持指纹解锁 /// bool sTouchID = false; /// /// 是否支持面容解锁 /// bool sFaceID = false; public AppUnlockSettingsPage() { bodyView = this; } public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; //如果用户配置了需要解锁的界面但是没有设置密码,则在返回时清空需要解锁的界面 Action action = () => { if(OnAppConfig.Instance.appUnlockPage.Count > 0&& OnAppConfig.Instance.appUnlockPasswrod == "") { OnAppConfig.Instance.appUnlockPage = new System.Collections.Generic.List(); OnAppConfig.Instance.SaveUserConfig(); } }; new TopViewDiv(bodyView, Language.StringByID(StringId.InterpretationSettings)).LoadTopView(action); topContentView = new FrameLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealWidth(332), BackgroundColor = CSS_Color.MainBackgroundColor }; bodyView.AddChidren(topContentView); Button btnTip1 = new Button() { Y = Application.GetRealHeight(8), Height = Application.GetRealHeight(30), TextAlignment = TextAlignment.Center, IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.PleaseSelectThePageToBeUnlocked, BackgroundColor = CSS_Color.MainBackgroundColor, }; topContentView.AddChidren(btnTip1); Button btnTip2 = new Button() { Y = btnTip1.Bottom, Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, BackgroundColor = CSS_Color.MainBackgroundColor, TextID = StringId.MultipleChoicesOfPagesYouNeedToProtect, }; topContentView.AddChidren(btnTip2); optionView = new HorizontalScrolViewLayout() { Y = Application.GetRealWidth(143 - 64), Height = Application.GetRealWidth(209), BackgroundColor = CSS_Color.MainBackgroundColor, }; topContentView.AddChidren(optionView); LoadView_OptionView(); btnTipMsg = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealWidth(288), Width = Application.GetRealWidth(311), Height = Application.GetRealWidth(28), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.FirstLevelTitleColor, BorderColor = CSS_Color.MainColor, BorderWidth = 1, Radius = 1, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, TextID = StringId.UnprotectedTipMsg, }; topContentView.AddChidren(btnTipMsg); LoadEventList(); LoadView_UnlockView(); } /// /// 加载选项卡 /// void LoadView_OptionView() { #region Unprotected optionView.AddChidren(new Button() { Width = Application.GetRealWidth(24) }); FrameLayout unprotectedDiv = new FrameLayout() { Width = Application.GetRealWidth(94), }; optionView.AddChidren(unprotectedDiv); btnUnprotectedBg = new Button() { Height = Application.GetRealWidth(174), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/1.png", SelectedImagePath = "PersonalCenter/AppUnlockSetting/1On.png" }; unprotectedDiv.AddChidren(btnUnprotectedBg); btnUnprotectedSelectionIcon = new Button() { X = Application.GetRealWidth(5), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", }; unprotectedDiv.AddChidren(btnUnprotectedSelectionIcon); btnUnprotectedSelectionTip = new Button() { X = Application.GetRealWidth(30), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(74), Height = Application.GetRealWidth(30), TextID = StringId.Unprotected, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, SelectedTextColor = CSS_Color.MainColor, }; unprotectedDiv.AddChidren(btnUnprotectedSelectionTip); #endregion #region Startup optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); FrameLayout startupDiv = new FrameLayout() { Width = Application.GetRealWidth(94), }; optionView.AddChidren(startupDiv); btnStartupBg = new Button() { Height = Application.GetRealWidth(174), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/2.png", SelectedImagePath = "PersonalCenter/AppUnlockSetting/2On.png" }; startupDiv.AddChidren(btnStartupBg); btnStartupSelectionIcon = new Button() { X = Application.GetRealWidth(5), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", }; startupDiv.AddChidren(btnStartupSelectionIcon); btnStartupSelectionTip = new Button() { X = Application.GetRealWidth(30), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(74), Height = Application.GetRealWidth(30), TextID = StringId.AtStartup, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel }; startupDiv.AddChidren(btnStartupSelectionTip); #endregion #region Security optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); FrameLayout securityDiv = new FrameLayout() { Width = Application.GetRealWidth(94), }; optionView.AddChidren(securityDiv); btnSecurityBg = new Button() { Height = Application.GetRealWidth(174), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/3.png", SelectedImagePath = "PersonalCenter/AppUnlockSetting/3On.png" }; securityDiv.AddChidren(btnSecurityBg); btnSecuritySelectionIcon = new Button() { X = Application.GetRealWidth(5), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", }; securityDiv.AddChidren(btnSecuritySelectionIcon); btnSecuritySelectionTip = new Button() { X = Application.GetRealWidth(30), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(74), Height = Application.GetRealWidth(30), TextID = StringId.DefenseAndUndefense, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel }; securityDiv.AddChidren(btnSecuritySelectionTip); #endregion #region Doorlock optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); FrameLayout doorlockDiv = new FrameLayout() { Width = Application.GetRealWidth(94), }; optionView.AddChidren(doorlockDiv); btnDoorlockBg = new Button() { Height = Application.GetRealWidth(174), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/4.png", SelectedImagePath = "PersonalCenter/AppUnlockSetting/4On.png" }; doorlockDiv.AddChidren(btnDoorlockBg); btnDoorlockSelectionIcon = new Button() { X = Application.GetRealWidth(5), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", }; doorlockDiv.AddChidren(btnDoorlockSelectionIcon); btnDoorlockSelectionTip = new Button() { X = Application.GetRealWidth(30), Y = Application.GetRealWidth(174), Width = Application.GetRealWidth(74), Height = Application.GetRealWidth(30), TextID = StringId.RemoteUnlocking, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel }; doorlockDiv.AddChidren(btnDoorlockSelectionTip); #endregion optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); } /// /// 加载解锁方式区域 /// void LoadView_UnlockView() { if(unlockOptionView!= null) { unlockOptionView.RemoveAll(); } unlockOptionView = new VerticalScrolViewLayout() { Y = topContentView.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(260), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, Visible = OnAppConfig.Instance.appUnlockPage.Count > 0 }; bodyView.AddChidren(unlockOptionView); #region 标题栏 var unlockTitleDiv = new FrameLayout() { Height = Application.GetRealHeight(59), }; unlockOptionView.AddChidren(unlockTitleDiv); var btnUnlockTitle = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(6), Width = Application.GetRealWidth(263), Height = Application.GetRealWidth(26), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, IsBold = true, TextSize = CSS_FontSize.SubheadingFontSize, TextID = StringId.SetUnlockingMethod, }; unlockTitleDiv.AddChidren(btnUnlockTitle); var btnUnlockTitleTip = new Button() { X = Application.GetRealWidth(16), Y = btnUnlockTitle.Bottom, Width = Application.GetRealWidth(263), Height = Application.GetRealWidth(21), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.ValidForNativeOnly, }; unlockTitleDiv.AddChidren(btnUnlockTitleTip); unlockOptionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(359), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, }); #endregion #region 密码解锁 var passwordUnlockDiv = new FrameLayout() { Height = Application.GetRealHeight(50), }; if ( !OnAppConfig.Instance.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(passwordUnlockDiv); } var btnPasswordUnlockIcon = new Button() { X = Application.GetRealWidth(16), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/PasswordIcon.png", }; passwordUnlockDiv.AddChidren(btnPasswordUnlockIcon); //var btnPasswordUnlockRightIcon = new Button() //{ // X = Application.GetRealWidth(339), // Gravity = Gravity.CenterVertical, // Width = Application.GetMinRealAverage(16), // Height = Application.GetMinRealAverage(16), // UnSelectedImagePath = "Public/Right.png", //}; //passwordUnlockDiv.AddChidren(btnPasswordUnlockRightIcon); var btnPasswordUnlockkSwtichIcon = new Button() { X = Application.GetRealWidth(322), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(38), Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("1") }; passwordUnlockDiv.AddChidren(btnPasswordUnlockkSwtichIcon); btnPasswordUnlockTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.PasswordUnlock, }; passwordUnlockDiv.AddChidren(btnPasswordUnlockTitle); unlockOptionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, }); #endregion #region 修改密码 var resetPasswordDiv = new FrameLayout() { Height = Application.GetRealHeight(50), }; if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(resetPasswordDiv); } var btnPasswordUnlockRightIcon = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; resetPasswordDiv.AddChidren(btnPasswordUnlockRightIcon); btnResetPasswordTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.ResetDigitalPassword, }; resetPasswordDiv.AddChidren(btnResetPasswordTitle); if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, }); } #endregion #region 手势解锁 var gestureUnlockDiv = new FrameLayout() { Height = Application.GetRealHeight(50), }; if (!OnAppConfig.Instance.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(gestureUnlockDiv); } var btnGestureUnlockIcon = new Button() { X = Application.GetRealWidth(16), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/GestureIcon.png", }; gestureUnlockDiv.AddChidren(btnGestureUnlockIcon); //var btnGestureUnlockRightIcon = new Button() //{ // X = Application.GetRealWidth(339), // Gravity = Gravity.CenterVertical, // Width = Application.GetMinRealAverage(16), // Height = Application.GetMinRealAverage(16), // UnSelectedImagePath = "Public/Right.png", //}; //gestureUnlockDiv.AddChidren(btnGestureUnlockRightIcon); var btnGestureUnlockkSwtichIcon = new Button() { X = Application.GetRealWidth(322), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(38), Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("2") }; gestureUnlockDiv.AddChidren(btnGestureUnlockkSwtichIcon); btnGestureUnlockTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.GestureUnlock, }; gestureUnlockDiv.AddChidren(btnGestureUnlockTitle); if (!OnAppConfig.Instance.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, }); } #endregion #region 修改手势 var resetGestureDiv = new FrameLayout() { Height = Application.GetRealHeight(50), }; if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(resetGestureDiv); } var btnGestureRightIcon = new Button() { X = Application.GetRealWidth(339), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; resetGestureDiv.AddChidren(btnGestureRightIcon); btnResetGestureTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.ResetGesturePassword, }; resetGestureDiv.AddChidren(btnResetGestureTitle); if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, }); } #endregion #region 查询设备是否支持面容ID,指纹ID TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); if (type == TouchIDUtils.TouchIDSupperType.TouchID) { sTouchID = true; MainPage.Log("KK:支持TouchID"); } else if (type == TouchIDUtils.TouchIDSupperType.FaceID) { sFaceID = true; MainPage.Log("KK:支持FaceID"); } #endregion #region 指纹解锁 fingerprintUnlockDiv = new FrameLayout() { Height = Application.GetRealHeight(51), }; if (sTouchID && OnAppConfig.Instance.appUnlockPasswrod != ""&&!OnAppConfig.Instance.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(fingerprintUnlockDiv); } var btnFingerprintUnlockIcon = new Button() { X = Application.GetRealWidth(16), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FingerprintIcon.png", }; fingerprintUnlockDiv.AddChidren(btnFingerprintUnlockIcon); var btnFingerprintUnlockTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.FingerprintUnlock, }; fingerprintUnlockDiv.AddChidren(btnFingerprintUnlockTitle); btnFingerprintUnlockSwtichIcon = new Button() { X = Application.GetRealWidth(322), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(38), Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("3") }; fingerprintUnlockDiv.AddChidren(btnFingerprintUnlockSwtichIcon); fingerprintUnlockDiv.AddChidren(new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(50), Width = Application.GetRealWidth(343), Height = 1, BackgroundColor = CSS_Color.BackgroundColor, //Visible = sFaceID }); #endregion #region 面容ID解锁 faceIdUnlockDiv = new FrameLayout() { Height = Application.GetRealHeight(50), }; if (sFaceID && OnAppConfig.Instance.appUnlockPasswrod != "" && !OnAppConfig.Instance.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(faceIdUnlockDiv); } var btnFaceIdUnlockIcon = new Button() { X = Application.GetRealWidth(16), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/FaceIdIcon.png", }; faceIdUnlockDiv.AddChidren(btnFaceIdUnlockIcon); var btnFaceIdUnlockTitle = new Button() { X = Application.GetRealWidth(66), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, TextID = StringId.FaceIdUnlock, }; faceIdUnlockDiv.AddChidren(btnFaceIdUnlockTitle); btnFaceIdUnlockSwtichIcon = new Button() { X = Application.GetRealWidth(322), Gravity= Gravity.CenterVertical, Width = Application.GetMinRealAverage(38), Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("4") }; faceIdUnlockDiv.AddChidren(btnFaceIdUnlockSwtichIcon); #endregion LoadEvet_SkipEventList(); } } }