Skip to content

Instantly share code, notes, and snippets.

dec hex per
0 0 0
1 1 0
2 2 1
3 3 1
4 4 2
5 5 2
6 6 2
7 7 3
8 8 3
public class AdArbitraryCell implements ArbitraryCellSelector.Cell {
@Override
public boolean is(Object item) {
return item instanceof AdVo;
}
@Override
public int type() {
return R.layout.cell_ad;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
/**
* @author Aleks Sander
@demixdn
demixdn / ApiModule.java
Last active November 8, 2019 16:23
Retrofit with self signed https certificate
package <you_package>.data.api;
import android.content.Context;
import android.support.annotation.NonNull;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@demixdn
demixdn / StringConverterFactory.java
Last active February 23, 2017 16:05
StringConverterFactory for Retrofit
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import android.content.Context;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
@SuppressWarnings("unused")
public final class Connectivity {
private Connectivity() {
@demixdn
demixdn / MainThreadSchedule.java
Last active March 21, 2017 08:19
RxJava2 helper classes
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
/**
* @author Aleks Sander
*/
public final class MainThreadSchedule<Stream> implements ObservableTransformer<Stream, Stream> {
@demixdn
demixdn / livetemplate.txt
Created April 5, 2017 15:18
live template in Android Studio
const
fbc
foreach
gone
IntentView
key
newInstance
noInstance
rgS
rouiT
["Москва", "Абрамцево", "Алабино", "Апрелевка", "Архангельское", "Ашитково", "Байконур", "Бакшеево", "Балашиха", "Барыбино", "Белоомут", "Белые Столбы", "Бородино", "Бронницы", "Быково", "Валуево", "Вербилки", "Верея", "Видное", "Внуково", "Вождь Пролетариата", "Волоколамск", "Вороново", "Воскресенск", "Восточный", "Востряково", "Высоковск", "Голицино", "Деденево", "Дедовск", "Джержинский", "Дмитров", "Долгопрудный", "Домодедово", "Дорохово", "Дрезна", "Дубки", "Дубна", "Егорьевск", "Железнодорожный", "Жилево", "Жуковский", "Загорск", "Загорянский", "Запрудная", "Зарайск", "Звенигород", "Зеленоград", "Ивантеевка", "Икша", "Ильинский", "Истра", "Калининград", "Кашира", "Керва", "Климовск", "Клин", "Клязьма", "Кожино", "Кокошкино", "Коломна", "Колюбакино", "Королев", "Косино", "Котельники", "Красково", "Красноармейск", "Красногорск", "Краснозаводск", "Краснознаменск", "Красный Ткач", "Крюково", "Кубинка", "Купавна", "Куровское", "Лесной Городок", "Ликино-Дулево", "Лобня", "Лопатинский", "Лосино-Петровский", "Ло