Coverage Summary for Class: ExtensionsKt (vit.khudenko.android.safe_click)

Class Class, % Method, % Line, %
ExtensionsKt 100% (1/1) 100% (2/2) 100% (3/3)


1 package vit.khudenko.android.safe_click 2  3 import android.view.View 4  5 /** 6  * Sets a specially crafted click listener, which skips click events that are followed by 7  * the newer click events within the 1 second timeout. 8  * 9  * @param action action to be invoked on a click event 10  */ 11 fun View.setSafeClickListener(action: (view: View) -> Unit) = this.setOnClickListener(SafeClickListener(action)) 12  13 /** 14  * Sets a specially crafted click listener, which skips click events that are followed by 15  * the newer click events within the given timeout [debounceTimeoutMillis]. 16  * 17  * @param debounceTimeoutMillis debounce timeout in milliseconds 18  * @param action action to be invoked on a click event 19  * 20  * @throws IllegalArgumentException if [debounceTimeoutMillis] parameter is negative 21  */ 22 fun View.setSafeClickListener(debounceTimeoutMillis: Long, action: (view: View) -> Unit) = this.setOnClickListener( 23  SafeClickListener(action, debounceTimeoutMillis) 24 )