Skip to content

Instantly share code, notes, and snippets.

Anton Kozyriatskyi antonKozyriatskyi

Block or report user

Report or block antonKozyriatskyi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
antonKozyriatskyi / LoadMoreListener.kt
Last active Jul 11, 2019
Load more listener for RecyclerView
View LoadMoreListener.kt
class LoadMoreListener(
private val threshold: Int,
private val listener: OnLoadMoreRequestedListener) : RecyclerView.OnScrollListener() {
private var triggered = false
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
val isScrollingToBottom = dy > 0
if (isScrollingToBottom) {
View ViewKtx.kt
* Requests [android.view.WindowInsets] and adds padding to
* [this] view according to specified [gravities]
* If [gravities] are empty - applies all insets,
* otherwise - only specified ones.
* Caution: insets are leaved unconsumed.
* */
fun View.applyWindowInsets(vararg gravities: Int, handler: ((WindowInsets?) -> Unit)? = null) {
antonKozyriatskyi / StickyHeaders.kt
Created Feb 16, 2019
Sticky headers for RecyclerView. Supports only one sticky header view type.
View StickyHeaders.kt
package kozyriatskyi.anton.sked.week.stickyheaders
import android.util.SparseIntArray
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
You can’t perform that action at this time.