首页 > 代码库 > 控件连击效果

控件连击效果

private final int DOUBLE_HINT_NUM = 3;//连击次数
titleRightView.setOnClickListener(new View.OnClickListener() {
long[] mHints = new long[DOUBLE_HINT_NUM];

@Override
public void onClick(View v) {
System.arraycopy(mHints, 1, mHints, 0, mHints.length - 1);
mHints[mHints.length - 1] = SystemClock.uptimeMillis();
if (SystemClock.uptimeMillis() - mHints[0] <= 500) {
            // 500ms内三连击则跳转到指定页面
TestHomeActivity.launch(TestActivity.this);
} else {
// ToastUtils.showToastShort("三连击有彩蛋~~~~");
}
}
});

控件连击效果