Skip to content

Instantly share code, notes, and snippets.

Avatar

Konstantin Mikheev konmik

View GitHub Profile
@konmik
konmik / gist:6ac725fa7134402539c4
Last active Sep 8, 2020
Dagger 2 injection with inheritance
View gist:6ac725fa7134402539c4
/**
* This class allows to inject into objects through a base class,
* so we don't have to repeat injection code everywhere.
*
* The performance drawback is about 0.013 ms per injection on a very slow device,
* which is negligible in most cases.
*
* Example:
* <pre>{@code
@konmik
konmik / gist:54c862feb512fc4fe01d
Created Dec 25, 2014
StringDiskLruCache based on Jake Warthon's DiskLruCache
View gist:54c862feb512fc4fe01d
public class StringDiskLruCache {
private static final int EXPIRATION = 1000 * 60 * 60 * 24;
private static final int DATA_INDEX = 0;
private static final int EXPIRATION_INDEX = 1;
private static final int INDEXES_COUNT = 2;
private Context context;
private DiskLruCache cache;
You can’t perform that action at this time.