Created
September 8, 2017 09:55
-
-
Save Eklett/93e41e3a54e4ac1f6808909070f07b55 to your computer and use it in GitHub Desktop.
快速双击view的判断
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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