mac
2023-10-19 baca65d449433d73516660d849c112ed8f5d3dd3
2023年10月19日10:34:19

优化海信电视滑动误触发事件问题,统一在弹起事件做高亮处理
10个文件已修改
316 ■■■■■ 已修改文件
HDL_ON/DAL/Server/HttpUtil.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/AksCommonMethod.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs 171 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        const string APP_KEY = "HDL-HOME-APP-TEST";
        const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
HDL_ON/UI/UI2/FuntionControlView/Aks/AksCommonMethod.cs
@@ -12,18 +12,7 @@
    /// </summary>
    public class AksCommonMethod
    {
        /// <summary>
        /// 选中颜色
        /// </summary>
        public const uint seleBackgroundColor = 0xFFF2F3F7;
        /// <summary>
        /// 不支持按键文本颜色
        /// </summary>
        public const uint unBackgroundColor = 0xFFA3AAB7;
        /// <summary>
        /// 不支持整个颜色
        /// </summary>
        public const uint unParentBackgroundColor = 0xFFF2F3F7;
        private static AksCommonMethod commonMethod = null;
        /// <summary>
HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs
@@ -194,7 +194,7 @@
                {
                    this.remoteControlList = SendMethod.Current.GetRemoteControlLits(this.device.deviceId);
                    this.sequencerList = SendMethod.Current.GetSequencerLits(this.device.deviceId);
                    TestData(this.remoteControlList);
                    //TestData(this.remoteControlList);
                }
                catch { }
                finally
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs
@@ -26,13 +26,26 @@
        /// <param name="isClick">false点击无效</param>
        public bool GetClick()
        {
           return this.mIsClick;
            return this.mIsClick;
        }
        /// <summary>
        /// 延时时间ms
        /// </summary>
        private const int millisecondsTimeout = 100;
        public const int millisecondsTimeout = 100;
        /// <summary>
        /// 选中颜色
        /// </summary>
        public const uint seleBackgroundColor = 0xFFF2F3F7;
        /// <summary>
        /// 不支持按键文本颜色
        /// </summary>
        public const uint unBackgroundColor = 0xFFA3AAB7;
        /// <summary>
        /// 不支持整个颜色
        /// </summary>
        public const uint unParentBackgroundColor = 0xFFF2F3F7;
        /// <summary>
        /// 调整真实高度
@@ -75,24 +88,26 @@
            return bottomHeight;
        }
        /// <summary>
        /// 设置高亮颜色
        /// 设置高亮颜色(grb)
        /// </summary>
        /// <param name="seleColor">选中颜色值</param>
        /// <param name="unColor">未选中颜色值</param>
        /// <param name="view">组件</param>
        public void SetHighlightBackground(View view)
        public void SetHighlightColor(View view, uint seleColor =seleBackgroundColor, uint unColor = 0x00000000)
        {
            if (view == null)
            {
                return;
            }
            //按下去改变背景颜色
            view.BackgroundColor = AksCommonMethod.seleBackgroundColor;
            view.BackgroundColor = seleColor;
            new System.Threading.Thread(() =>
            {
                System.Threading.Thread.Sleep(millisecondsTimeout);
                Application.RunOnMainThread(() =>
                {
                    //弹起来还原背景颜色
                    view.BackgroundColor = 0x00000000;
                    view.BackgroundColor = unColor;
                });
            })
            { IsBackground = true }.Start();
@@ -110,23 +125,46 @@
                return;
            }
            //按下去改变背景颜色
            button.IsSelected =true;
            button.IsSelected = true;
            new System.Threading.Thread(() =>
            {
                System.Threading.Thread.Sleep(millisecondsTimeout);
                Application.RunOnMainThread(() =>
                {
                    //弹起来还原背景颜色
                    button.IsSelected=false;
                    button.IsSelected = false;
                });
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 设置高亮背景图标
        /// </summary>
        /// <param name="sele">选中图片路径</param>
        /// <param name="unColor">未选中图片路径<</param>
        /// <param name="view">组件</param>
        public void SetHighlightImagePath(FrameLayout frame, string seleImagePath, string unImagePath)
        {
            if (frame == null)
            {
                return;
            }
            //按下去改变背景颜色
            frame.BackgroundImagePath = seleImagePath;
            new System.Threading.Thread(() =>
            {
                System.Threading.Thread.Sleep(millisecondsTimeout);
                Application.RunOnMainThread(() =>
                {
                    //弹起来还原背景颜色
                    frame.BackgroundImagePath = unImagePath;
                });
            })
            { IsBackground = true }.Start();
        }
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs
@@ -156,7 +156,7 @@
                    return;
                }
                action?.Invoke(this, btnImage, btnName);
                SetHighlightBackground(this);
                SetHighlightColor(this);
                //按下去改变背景颜色
                //this.BackgroundColor = AksCommonMethod.seleBackgroundColor;
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs
@@ -130,7 +130,7 @@
                if (!keypad.isClicked)
                {
                    buttonFram.GetImageButton().Alpha = 0.5f;
                    buttonFram.GetNameButton().TextColor = AksCommonMethod.unBackgroundColor;
                    buttonFram.GetNameButton().TextColor =unBackgroundColor;
                    buttonFram.SetClick(false);
                }
@@ -219,7 +219,7 @@
                if (!keypad.isClicked)
                {
                    buttonFram.GetImageButton().Alpha = 0.5f;
                    buttonFram.GetNameButton().TextColor = AksCommonMethod.unBackgroundColor;
                    buttonFram.GetNameButton().TextColor = unBackgroundColor;
                    buttonFram.SetClick(false);
                }
                buttonFram.SetClickListener((fl, btnIcon, btnName) =>
@@ -291,7 +291,7 @@
                //不支持按键点击背景颜色
                if (!keypad.isClicked)
                {
                    button.TextColor = AksCommonMethod.unBackgroundColor;
                    button.TextColor =unBackgroundColor;
                }
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs
@@ -18,8 +18,8 @@
        {
            this.mIsClick = isClick;
        }
        private uint UpBackgroundColor = MusicColor.ViewColor;
        private uint DownBackgroundColor = AksCommonMethod.seleBackgroundColor;
        private uint UpBackgroundColor =BaseFramLayout.unParentBackgroundColor;
        private uint DownBackgroundColor =BaseFramLayout.seleBackgroundColor;
        /// <summary>
        /// 多个类型容器
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs
@@ -10,6 +10,8 @@
        /// 是否可以点击
        /// </summary>
        private bool mIsClick = true;
        private uint UpBackgroundColor = BaseFramLayout.unParentBackgroundColor;
        private uint DownBackgroundColor = BaseFramLayout.seleBackgroundColor;
        /// <summary>
        /// 设置控制点击事件
@@ -19,8 +21,7 @@
        {
            this.mIsClick = isClick;
        }
        private uint UpBackgroundColor = MusicColor.ViewColor;
        private uint DownBackgroundColor = AksCommonMethod.seleBackgroundColor;
        /// <summary>
        /// 单个类型容器
        /// </summary>
HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs
@@ -108,8 +108,8 @@
            //开关
            switchBtn.MouseUpEventHandler += (senser, e) =>
            {
                switchBtn.IsSelected = false;
                KeyControl("on_off", "开/关");
                this.SetButtonIsSelected(switchBtn);
            };
            //信息
            xinxiFL.SetClickListener(() =>
@@ -239,15 +239,16 @@
            //左
            btnLeft.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
                KeyControl("key_left", "左");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_left_selected.png", "AksIcon/ykq_ok.png");
            };
            //上
            btnShang.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
                KeyControl("key_up", "上");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_shang_selected.png", "AksIcon/ykq_ok.png");
            };
@@ -255,48 +256,50 @@
            btnRight.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
                KeyControl("key_right", "右");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_right_selected.png", "AksIcon/ykq_ok.png");
            };
            //下
            btnXia.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
                KeyControl("key_down", "下");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_xia_selected.png", "AksIcon/ykq_ok.png");
            };
            //OK
            btnOk.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
                KeyControl("key_ok", "确定");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_ok_selected.png", "AksIcon/ykq_ok.png");
            };
            //音量+
            btnYingliangjia.MouseUpEventHandler += (sen, e) =>
            {
                btnYingliangjia.IsSelected = false;
                KeyControl("volume_up", "音量+");
                this.SetButtonIsSelected(btnYingliangjia);
            };
            //音量-
            btnYingliangjian.MouseUpEventHandler += (sen, e) =>
            {
                btnYingliangjian.IsSelected = false;
                KeyControl("volume_down", "音量-");
                this.SetButtonIsSelected(btnYingliangjian);
            };
            //频道+
            btnPindaojia.MouseUpEventHandler += (sen, e) =>
            {
                btnPindaojia.IsSelected = false;
                KeyControl("ch_up", "频道+");
                this.SetButtonIsSelected(btnPindaojia);
            };
            //频道-
            btnPindaojian.MouseUpEventHandler += (sen, e) =>
            {
                btnPindaojian.IsSelected = false;
                KeyControl("ch_down", "频道-");
                this.SetButtonIsSelected(btnPindaojian);
            };
            //菜单
@@ -776,15 +779,7 @@
                SelectedImagePath = "AksIcon/ykq_yingliangjia_selected.png",
            };
            baseFl.AddChidren(btnYingliangjia);
            btnYingliangjia.MouseDownEventHandler += (sen, e) =>
            {
                btnYingliangjia.IsSelected = true;
            };
            btnYingliangjia.MouseUpOutsideEventHandler += (sen, e) =>
            {
                btnYingliangjia.IsSelected = false;
            };
            btnYingliangjian = new Button
@@ -797,17 +792,7 @@
                SelectedImagePath = "AksIcon/ykq_yingliangjian_selected.png",
            };
            baseFl.AddChidren(btnYingliangjian);
            btnYingliangjian.MouseDownEventHandler += (sen, e) =>
            {
                btnYingliangjian.IsSelected = true;
            };
            btnYingliangjian.MouseUpOutsideEventHandler += (sen, e) =>
            {
                btnYingliangjian.IsSelected = false;
            };
            btnPindaojia = new Button
@@ -820,16 +805,7 @@
                SelectedImagePath = "AksIcon/ykq_pindaojia_selected.png",
            };
            baseFl.AddChidren(btnPindaojia);
            btnPindaojia.MouseDownEventHandler += (sen, e) =>
            {
                btnPindaojia.IsSelected = true;
            };
            btnPindaojia.MouseUpOutsideEventHandler += (sen, e) =>
            {
                btnPindaojia.IsSelected = false;
            };
            btnPindaojian = new Button
@@ -842,17 +818,7 @@
                SelectedImagePath = "AksIcon/ykq_pindaojian_selected.png",
            };
            baseFl.AddChidren(btnPindaojian);
            btnPindaojian.MouseDownEventHandler += (sen, e) =>
            {
                btnPindaojian.IsSelected = true;
            };
            btnPindaojian.MouseUpOutsideEventHandler += (sen, e) =>
            {
                btnPindaojian.IsSelected = false;
            };
@@ -914,67 +880,6 @@
                Gravity = Gravity.Center,
            };
            okFl.AddChidren(btnOk);
            btnLeft.MouseUpOutsideEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnLeft.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_left_selected.png";
            };
            btnShang.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_shang_selected.png";
            };
            btnShang.MouseUpOutsideEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnRight.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_right_selected.png";
            };
            btnRight.MouseUpOutsideEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnXia.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_xia_selected.png";
            };
            btnXia.MouseUpOutsideEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnOk.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok_selected.png";
            };
            btnOk.MouseUpOutsideEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            #endregion
@@ -1225,7 +1130,7 @@
    /// <summary>
    /// 自己弄一个FrameLayout
    /// </summary>
    class CustomFrameLayout : FrameLayout
    class CustomFrameLayout : BaseFramLayout
    {
        public const int widthFrameLayout = 36;
        public const int heightFrameLayout = 49 - 6;
@@ -1330,35 +1235,31 @@
        /// <param name="action">回调(父类对象)</param>
        public void SetClickListener(Action action)
        {
            clickFl.MouseDownEventHandler += (sender, e) =>
            clickFl.MouseUpEventHandler += (sender, e) =>
            {
                //this.BackgroundColor = 0xff798394;
                action?.Invoke();
                //按下去改变背景颜色
                btnImage.IsSelected = true;
                btnText.IsSelected = true;
                btnNumber.IsSelected = true;
                btn.IsSelected = true;
                new System.Threading.Thread(() =>
                {
                    System.Threading.Thread.Sleep(millisecondsTimeout);
                    Application.RunOnMainThread(() =>
                    {
                        //弹起来还原背景颜色
                        btnImage.IsSelected = false;
                        btnText.IsSelected = false;
                        btnNumber.IsSelected = false;
                        btn.IsSelected = false;
                    });
                })
                { IsBackground = true }.Start();
            };
            clickFl.MouseUpEventHandler += (sender, e) =>
            {
                //this.BackgroundColor = 0x00000000;
                btnImage.IsSelected = false;
                btnText.IsSelected = false;
                btnNumber.IsSelected = false;
                btn.IsSelected = false;
                action?.Invoke();
            };
            clickFl.MouseUpOutsideEventHandler += (sender, e) =>
            {
                //this.BackgroundColor = 0x00000000;
                btnImage.IsSelected = false;
                btnText.IsSelected = false;
                btnNumber.IsSelected = false;
                btn.IsSelected = false;
            };
        }
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
@@ -178,17 +178,17 @@
            });
            //音量+
            btn_jia.MouseDownEventHandler += (sender, e) =>
            btn_jia.MouseUpEventHandler += (sender, e) =>
            {
                btn_jia.IsSelected = true;
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_add, "");
                this.SetButtonIsSelected(btn_jia);
            };
            //音量-
            btn_jian.MouseDownEventHandler += (sender, e) =>
            btn_jian.MouseUpEventHandler += (sender, e) =>
            {
                btn_jian.IsSelected = true;
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, "");
                this.SetButtonIsSelected(btn_jian);
            };
            //菜单
            caidanBtn.SetClickListener((btn) =>
@@ -302,7 +302,7 @@
                    return;
                }
                if (!this.device.online&& key!= HisenseTVFunctionalAttributeConstant.wol)
                if (!this.device.online && key != HisenseTVFunctionalAttributeConstant.wol)
                {
                    //设备不在线控制失败
                    Application.RunOnMainThread(() =>
@@ -499,16 +499,6 @@
            };
            yinliangFL.AddChidren(btn_jian);
            btn_jia.MouseUpEventHandler += (sender, e) =>
            {
                btn_jia.IsSelected = false;
            };
            btn_jian.MouseUpEventHandler += (sender, e) =>
            {
                btn_jian.IsSelected = false;
            };
            caidanBtn = new CustomButton();
            caidanBtn.TextID = StringId.caidan;
@@ -656,7 +646,7 @@
    /// <summary>
    /// 自定义(首页,关机,菜单)容器
    /// </summary>
    class CustomFrameLayout : FrameLayout
    class CustomFrameLayout : BaseFramLayout
    {
        public const int widthFrameLayout = 68;
        public const int heightFrameLayout = 68 + 8 + 20;
@@ -714,21 +704,11 @@
        /// <param name="button2">注意:在SetClickListener()前面调用AddImageView()才有效</param>
        public void SetClickListener(Action<FrameLayout, Button, Button> action)
        {
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                btnImage.IsSelected = true;
                //btnText.IsSelected = true;
                action?.Invoke(this, btnImage, btnText);
            };
            this.MouseDownEventHandler += DownClick;
            btnImage.MouseDownEventHandler += DownClick;
            btnText.MouseDownEventHandler += DownClick;
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
             {
                 btnImage.IsSelected = false;
                 //btnText.IsSelected = false;
                 action?.Invoke(this, btnImage, btnText);
                 SetButtonIsSelected(btnImage);
             };
            this.MouseUpEventHandler += UpClick;
            btnImage.MouseUpEventHandler += UpClick;
@@ -766,19 +746,12 @@
        /// <param name="action">回调(第一个是父类对象</param>
        public void SetClickListener(Action<Button> action)
        {
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                //this.BackgroundColor = 0xFFF2F3F7;
                this.IsSelected = true;
                action?.Invoke(this);
            };
            this.MouseDownEventHandler += DownClick;
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
            {
                //this.BackgroundColor = 0xffECEDEE;
                this.IsSelected = false;
                action?.Invoke(this);
                new BaseFramLayout().SetButtonIsSelected(this);
            };
            this.MouseUpEventHandler += UpClick;