防止重复点击
@OnClick({R.id.btn_next, R.id.iv_close})
public void onViewClicked(View view) {
if (isFastClick()) {
return;
}
switch (view.getId()) {
case R.id.iv_close:
break;
case R.id.btn_next:
break;
}
}
public class ClickUtil {
private static final int MIN_DELAY_TIME = 1000;
private static long lastClickTime;
public static boolean isFastClick() {
boolean flag = true;
long currentClickTime = System.currentTimeMillis();
if ((currentClickTime - lastClickTime) >= MIN_DELAY_TIME) {
flag = false;
}
lastClickTime = currentClickTime;
return flag;
}
}