dependencies{
implementation 'io.openharmony.tpc.thirdlib:GestureLock:1.0.1'
}
<com.sevenheaven.gesturelock.GestureLock
ohos:margin="20vp"
GestureLock:line_width="2vp"
GestureLock:line_normal_color="#ffffaa"
ohos:id="$+id:gesturelock"
ohos:height="match_parent"
ohos:width="match_parent"/>
gestureLock.setAdapter(new GestureLock.GestureLockAdapter() {
@Override
public int getDepth() {
return 3;
//解锁点属性返回3为3X3,返回4为4X4
}
@Override
public int[] getCorrectGestures() {
return int[]{0,1,2};
//解锁正确手势
}
@Override
public int getUnmatchedBoundary() {
return 3;
//最大错误数
}
@Override
public int getBlockGapSize() {
return 30;
//解锁点间距PX
}
@Override
public GestureLockView getGestureLockViewInstance(Context context, int position) {
return new MyStyleLockView(gestureLock);
//解锁点样式
}
});
gestureLock.setOnGestureEventListener(new GestureLock.OnGestureEventListener() {
@Override
public void onBlockSelected(int position) {
//结果的解锁点
}
@Override
public void onGestureEvent(boolean matched,int errorTime) {
//matched是否正确 ,errorTime错误次数
}
@Override
public void onUnmatchedExceedBoundary() {
//错误次数超过限制
}
@Override
public void onGesturesFinish(int[] gestures) {
//返回的解锁手势
}
});
public void setAdapter(GestureLockAdapter adapter)
public void setUnmatchedBoundary(int unmatchedBoundary)
public int getUnmatchedBoundary()
public void setCorrectGestures(int[] gesturesContainer)
public int[] getCorrectGestures()
public void notifyDataChanged()
public void setEditMode(int mode)
public int getEditMode()
public void setTouchable(boolean touchable)
public void resetUnmatchedCount()
public void setOnGestureEventListener(OnGestureEventListener onGestureEventListener)
public void clear()
public void setLockerState(LockerState state)
public LockerState getLockerState()
public void setArrow(int arrow)
public int getArrow()
name | format | description |
---|---|---|
line_width | dimension | set line width |
line_normal_color | color | set line default color |
line_error_color | color | set line error color |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型