Skip to content

Instantly share code, notes, and snippets.

View dobrowins's full-sized avatar

Artem Dobrovinskiy dobrowins

View GitHub Profile
@gildor
gildor / RetrofitCoroutines.kt
Last active June 22, 2021 19:09
Example of usage kotlin-coroutines-retrofit with awaitResponse()
import kotlinx.coroutines.experimental.runBlocking
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Path
import ru.gildor.coroutines.retrofit.awaitResponse
/**
dependencies {
@Popalay
Popalay / PresenterModule.java
Created February 8, 2017 06:56 — forked from dened/PresenterModule.java
Dagger + Moxy
@Module
public class PresenterModule {
@Provides
LoginPresenter providePresenter(Router router, LoginInteractor interactor, PreferenceUtils preferenceUtils) {
return new LoginPresenter(router, interactor, preferenceUtils);
}
}
@Singleton
@Component(modules = {
@nesquena
nesquena / ItemClickSupport.java
Last active September 17, 2024 18:57
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});
@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active January 25, 2025 17:43
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@elandau
elandau / StateMachine
Created October 30, 2014 23:22
Rx based state machine
package com.netflix.experiments.rx;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.Observable.OnSubscribe;