wenwenwen888 / SearchDialog

仿bilibili搜索框效果(三句代码实现)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fastclick problem

wo5553435 opened this issue · comments

it will toggle multiply the IOnSearchClickListener.OnSearchClick(String str) if you try click many times fastly cancelbutton or each itemview keywords of searchHistoryAdapter as possible as you can, it is a suggestion can get over it :

private long lastClickTime;

/**
 * judge  there is  mulitclick's action between last click time and  now's time
 */
public boolean isFastDoubleClick() {
    long time = System.currentTimeMillis();
    long timeD = time - lastClickTime;
    if (0 < timeD && timeD < 500) { // this number isn't must be valued 500,just insteal your animation's duration    
        return true;
    }
    lastClickTime = time;
    return false;
}

And use it in functions of OnItemClick() and hideAnim()

Maybe you already found this issues, this is my gratitude for your SearchFragment ! ↖(^ω^)↗

@wo5553435 Thank you for your suggestion.