Skip to content

Instantly share code, notes, and snippets.

Working from home

Alexey Korolev Pulimet

Working from home
View GitHub Profile
RubyLichtenstein /
Last active Feb 11, 2021
Painless android fragments with Kotlin

Starting new fragments with Kotlin is easy


val user = User(id = "id", name = "Ruby")
val userFragment: UserFragment = newFragment<User, UserFragment>(user)

How this magic works

View FromRxJavaToKotlinCoroutines-LifeCycle.kt
class LifeCycle {
open class BaseActivity : Activity(), CoroutineScope {
private val job = SupervisorJob()
override val coroutineContext: CoroutineContext
get() = job + Dispatchers.Main
override fun onDestroy() {
package com.saber.customstickyheader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
dors /
Last active Mar 9, 2017
Cool log util for Android apps that prints each log with the thread, class name and method name from which the log was made
import android.util.Log;
import java.text.MessageFormat;
* Copyright 2015 Dor Sakal
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
ssinss /
Last active Feb 22, 2022
Endless RecyclerView OnScrollListener
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
emil2k /
Last active Sep 18, 2022
Android utility class for checking device's network connectivity and speed.
* Copyright (c) 2017 Emil Davtyan
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: