xm
2020-12-14 d6fb0646531172f23648441c224cdcccd721b894
ZigbeeApp/GateWay.Droid/ZXing/ZXingCustomScanView.cs
New file
@@ -0,0 +1,71 @@
using System;
using Android.Content;
using Android.Views;
using Android.Widget;
namespace GateWay.Droid
{
    public class ZXingCustomScanView : RelativeLayout
    {
        public Action OnCancel;
        public Action OnTorch;
        public TextView cancelTextView, flashTextView, titleTextView;
        public ZXingCustomScanView(Context context) : base(context)
        {
            View.Inflate(context, Resource.Layout.zxing_layout, this);
            titleTextView = FindViewById<TextView>(Resource.Id.tv_zxing_scan);
            cancelTextView = FindViewById<TextView>(Resource.Id.tv_zxing_back);
            cancelTextView.Text = cancelText;
            flashTextView = FindViewById<TextView>(Resource.Id.tv_zxing_flash);
            flashTextView.Text = flashText;
            cancelTextView.Click += Cancel_Click;
            flashTextView.Click += Flash_Click;
        }
        String cancelText = "Cancel";
        public String CancelText
        {
            get
            {
                return cancelText;
            }
            set {
                cancelText = value;
                cancelTextView.Text = cancelText;
            }
        }
        String flashText = "Flash";
        public String FlashText
        {
            get
            {
                return flashText;
            }
            set
            {
                flashText = value;
                flashTextView.Text = flashText;
            }
        }
        private void Flash_Click(object sender, EventArgs e)
        {
            OnTorch?.Invoke();
        }
        private void Cancel_Click(object sender, System.EventArgs e)
        {
            OnCancel?.Invoke();
        }
    }
}