手势绘制过程中通过接口OnPatternListener中的4个监听函数来监听手势开始、结束、清除、添加等操作。接口的定义如下:
public static interface OnPatternListener { /** * A new pattern has begun. */ void onPatternStart(); /** * The pattern was cleared. */ void onPatternCleared(); /** * The user extended the pattern currently being drawn by one cell. * * @param pattern The pattern with newly added cell. */ void onPatternCellAdded(List<Cell> pattern); /** * A pattern was detected from the user. * * @param pattern The pattern. */ void onPatternDetected(List<Cell> pattern); }