Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicolas Jafelle nicolasjafelle

View GitHub Profile
@nicolasjafelle
nicolasjafelle / MainActivity
Created Oct 24, 2014
ActionBarActivity integrated with Roboguice
View MainActivity
package com.android.test.activity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import com.android.test.R;
import com.android.test.fragment.MainFragment;
import roboguice.RoboGuice;
import roboguice.inject.InjectView;
@nicolasjafelle
nicolasjafelle / DialogFragmentHelper
Last active Dec 20, 2015
Helper class that helps you show RoboDialogFragments. You can use it with Roboguice and injected RoboDialogFragments. It is based on the DialogFragmentHelper class of the Github Android app. https://github.com/github/android/blob/master/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java
View DialogFragmentHelper
/**
* Dialog fragment helper
*/
public abstract class DialogFragmentHelper extends RoboDialogFragment {
private static final String TAG = "dialog_fragment_helper";
/**
* Show dialog
*/
@nicolasjafelle
nicolasjafelle / SafeAsyncTask.java
Last active Feb 16, 2017
SafeAsyncTask taken from Roboguice 2.0. and adapted to work without roboguice. Simple copy and paste this class and follow the javadoc.
View SafeAsyncTask.java
package com.asynctask.util;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import java.io.InterruptedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.Callable;
@nicolasjafelle
nicolasjafelle / RxEventBus.java
Last active May 28, 2018
Event Bus implementation with RxJava. It also post all event in the UI Thread.
View RxEventBus.java
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;