From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

---
 ZigbeeApp/GateWay.Droid/FengLinVideo/widget/TipDiaglog.cs |  142 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/GateWay.Droid/FengLinVideo/widget/TipDiaglog.cs b/ZigbeeApp/GateWay.Droid/FengLinVideo/widget/TipDiaglog.cs
new file mode 100755
index 0000000..6073b6d
--- /dev/null
+++ b/ZigbeeApp/GateWay.Droid/FengLinVideo/widget/TipDiaglog.cs
@@ -0,0 +1,142 @@
+锘縰sing System;
+using Android.App;
+using Android.Content;
+using Android.Graphics;
+using Android.Views;
+using Android.Widget;
+
+namespace GateWay.Droid.FengLinVideo.widget
+{
+    public class TipDiaglog : Dialog, View.IOnClickListener, View.IOnTouchListener
+    {
+        private Context mContext = null;
+
+        private string titleText = "鎻愮ず";
+        private string contentText = "";
+        private string confirmText = "纭";
+        private bool isClose = false;
+
+        private TextView contentView = null;
+        private TextView titleView = null;
+        private TextView okView = null;
+        public object Tag = null;
+        private OnConfirmClickListener onConfirmClickListener;
+
+        public TipDiaglog(Context context) : base(context, Resource.Style.DialogTheme)
+        {
+            this.mContext = context;
+        }
+
+        public void SetAutoClose(bool bol)
+        {
+            this.isClose = bol;
+        }
+
+        public void SetTitleText(string _titleText)
+        {
+            titleText = _titleText;
+            if (titleView != null)
+            {
+                titleView.SetText(titleText, null);                
+            }
+        }
+
+        public void SetContentText(string _contentText)
+        {
+            contentText = _contentText;
+            if (contentView != null)
+            {
+                contentView.SetText(contentText, null);
+            }
+        }
+
+        public void SetConfirmText(string text)
+        {
+            confirmText = text;
+            if (okView != null)
+            {
+                okView.SetText(confirmText, null);
+            }
+        }
+
+        public override void Create()
+        {
+            base.Create();
+
+            try
+            {
+                SetContentView(Resource.Layout.dialog_tip);
+
+                contentView = (TextView)FindViewById(Resource.Id.tv_content);
+                titleView = (TextView)FindViewById(Resource.Id.tv_title);
+                okView = (TextView)FindViewById(Resource.Id.tv_ok);
+
+                contentView.SetText(contentText, null);
+                titleView.SetText(titleText, null);
+                okView.SetText(confirmText, null);
+
+                okView.SetOnTouchListener(this);
+                okView.SetOnClickListener(this);
+            }
+            catch (Exception e)
+            {
+                string error = e.Message;
+            }
+        }
+
+        public override void OnWindowFocusChanged(bool hasFocus)
+        {
+            base.OnWindowFocusChanged(hasFocus);
+
+            try
+            {
+                Display display = ((Activity)mContext).WindowManager.DefaultDisplay;
+                
+                WindowManagerLayoutParams p = Window.Attributes;
+                Point point = new Point();
+                display.GetSize(point);
+                p.Width = (int)(point.X * 0.7);                
+                Window.SetGravity(GravityFlags.Center);
+            }
+            catch (Exception e)
+            {
+                string ss = e.Message;
+            }
+        }
+
+        public void SetConfirmClickListener(OnConfirmClickListener l)
+        {
+            onConfirmClickListener = l;
+        }
+
+        public void OnClick(View v)
+        {
+            if (v.Equals(okView))
+            {
+                if (onConfirmClickListener != null)
+                    onConfirmClickListener.onSureClick(this, v, isClose);
+            }
+        }
+
+        public bool OnTouch(View v, MotionEvent e)
+        {
+            if (e.Action == MotionEventActions.Down)
+            {
+                v.SetBackgroundResource(Resource.Drawable.sure_background_sel);
+            }
+            else if (e.Action == MotionEventActions.Up)
+            {
+                v.SetBackgroundResource(Resource.Drawable.sure_background_def);
+            }
+
+            return false;
+
+        }
+
+        public interface OnConfirmClickListener
+        {
+            void onSureClick(TipDiaglog dialoog, View v,bool bol);
+        }
+
+    }
+}

--
Gitblit v1.8.0