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 / 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
@demixdn
demixdn / SimpleAdapter.java
Created April 24, 2017 15:50
Simple Recycler Adapter with generics
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/**
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.UnsupportedEncodingException;
import java.util.Properties;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;