Skip to content

Instantly share code, notes, and snippets.

View vudunguit's full-sized avatar

Vu Dung vudunguit

  • Project Kanzen
  • Ho Chi Minh city, Viet Nam
View GitHub Profile
@vudunguit
vudunguit / AddCookiesInterceptor.java
Created September 13, 2016 02:11 — forked from tsuharesu/AddCookiesInterceptor.java
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@vudunguit
vudunguit / RxEventBus.java
Created September 9, 2016 07:29 — forked from nicolasjafelle/RxEventBus.java
Event Bus implementation with RxJava. It also post all event in the UI Thread.
import android.os.Handler;
import android.os.Looper;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import rx.Subscription;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.internal.util.SubscriptionList;
@vudunguit
vudunguit / ViewPagerFragmentAdapter
Created September 7, 2016 02:48
Utils class for viewpager adapter with fragment content
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.text.TextUtils;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@vudunguit
vudunguit / BadgedFourThreeImageView
Last active August 18, 2016 10:26
ImageView support set badge drawable(gift...). I just extracted the widgets from Plaid app developed by Nick Butcher(https://github.com/nickbutcher).
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;