From 80faceb86399017851f9f72feaaef868a37ff23f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 26 三月 2021 10:50:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/lss' into temp-wxr

---
 HDL-ON_Android/FengLinVideo/widget/TipDiaglog.cs |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/HDL-ON_Android/FengLinVideo/widget/TipDiaglog.cs b/HDL-ON_Android/FengLinVideo/widget/TipDiaglog.cs
new file mode 100644
index 0000000..157762f
--- /dev/null
+++ b/HDL-ON_Android/FengLinVideo/widget/TipDiaglog.cs
@@ -0,0 +1,143 @@
+锘縰sing System;
+using Android.App;
+using Android.Content;
+using Android.Graphics;
+using Android.Views;
+using Android.Widget;
+using HDL_ON_Android;
+
+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