using System;
|
|
//using static Com.Hdl.Widget.Gesturelock.GestureLockView;
|
|
namespace Shared
|
{
|
|
|
|
/// <summary>
|
/// GestureLockView
|
/// </summary>
|
public class GestureLockView : View
|
{
|
/// <summary>
|
/// 当前视图
|
/// </summary>
|
/// <value>The GestureLockView.</value>
|
Com.Hdl.Widget.Gesturelock.GestureLockView mHDLGestureLockView
|
{
|
get
|
{
|
return AndroidView as Com.Hdl.Widget.Gesturelock.GestureLockView;
|
}
|
set
|
{
|
AndroidView = value;
|
}
|
}
|
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
public GestureLockView()
|
{
|
mHDLGestureLockView = new Com.Hdl.Widget.Gesturelock.GestureLockView(Application.Activity);
|
//mHDLGestureLockView.ResetGesture();
|
mOnLockVerifyListener = new OnLockVerifyListener(this);
|
|
mHDLGestureLockView.SetOnLockVerifyListener(mOnLockVerifyListener);
|
|
//mHDLGestureLockView.Measure
|
//mHDLGestureLockView.
|
}
|
|
public void setinvalidate()
|
{
|
mHDLGestureLockView.Invalidate();
|
}
|
|
/// <summary>
|
/// 设置正确和普通时的颜色
|
/// </summary>
|
/// <value>线颜色</value>
|
public uint LockViewCorrectColor
|
{
|
set
|
{
|
|
byte r, g, b, a;
|
r = (byte)(value / 256 / 256 % 256);
|
g = (byte)(value / 256 % 256);
|
b = (byte)(value % 256);
|
a = (byte)(value / 256 / 256 / 256 % 256);
|
|
mHDLGestureLockView.SetMatchedPathColor(Android.Graphics.Color.Argb(a, r, g, b));
|
mHDLGestureLockView.SetTouchedPathColor(Android.Graphics.Color.Argb(a, r, g, b));
|
|
}
|
}
|
|
|
|
/// <summary>
|
/// 设置错误时的颜色
|
/// </summary>
|
/// <value>线颜色</value>
|
public uint LockViewErrorColor
|
{
|
set
|
{
|
|
byte r, g, b, a;
|
r = (byte)(value / 256 / 256 % 256);
|
g = (byte)(value / 256 % 256);
|
b = (byte)(value % 256);
|
a = (byte)(value / 256 / 256 / 256 % 256);
|
|
mHDLGestureLockView.SetUnmatchedPathColor(Android.Graphics.Color.Argb(a, r, g, b));
|
|
|
|
}
|
}
|
|
|
/// <summary>
|
/// 显示手势解锁view 是否显示正确
|
/// </summary>
|
public void showCorrectStatus(bool isTrue)
|
{
|
if (isTrue)
|
{
|
mHDLGestureLockView.SetLockViewMatchedState(Java.Lang.Boolean.True);
|
}
|
else
|
{
|
mHDLGestureLockView.SetLockViewMatchedState(Java.Lang.Boolean.False);
|
}
|
}
|
|
|
|
|
|
/// <summary>
|
/// Action
|
/// </summary>
|
public Action<string, int> OnLockVerifyEvent;
|
|
/// <summary>
|
/// OnProgressChangeListener 继承响应事件
|
/// </summary>
|
OnLockVerifyListener mOnLockVerifyListener;
|
|
public class OnLockVerifyListener : Java.Lang.Object, Com.Hdl.Widget.Gesturelock.GestureLockView.IOnLockVerifyListener
|
{
|
|
GestureLockView _GestureLockView;
|
|
public OnLockVerifyListener(GestureLockView view)
|
{
|
_GestureLockView = view;
|
}
|
|
public void OnGestureFinished(string selectNumStr, int selectCount)
|
{
|
_GestureLockView.OnLockVerifyEvent?.Invoke(selectNumStr, selectCount);
|
}
|
|
public void OnGestureSelected(int p0)
|
{
|
|
}
|
|
|
}
|
|
|
|
}
|
}
|