Skip to content

Instantly share code, notes, and snippets.

@Eklett
Created September 8, 2017 09:55
Show Gist options
  • Save Eklett/93e41e3a54e4ac1f6808909070f07b55 to your computer and use it in GitHub Desktop.
Save Eklett/93e41e3a54e4ac1f6808909070f07b55 to your computer and use it in GitHub Desktop.
快速双击view的判断
public class BaseActivity extends AppCompatActivity {
private int VIEW_TAG_CLICK = 2<<24;
protected boolean isFastDoubleClick(View view) {
Long lastClickTime = (Long) view.getTag(VIEW_TAG_CLICK);
if (null == lastClickTime) {
lastClickTime = 0L;
}
long time = System.currentTimeMillis();
view.setTag(VIEW_TAG_CLICK, time);
long timeD = time - lastClickTime;
if (0 < timeD && timeD < 800) {
return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment