Skip to content

Instantly share code, notes, and snippets.

View nicolasjafelle's full-sized avatar

Nicolas Jafelle nicolasjafelle

View GitHub Profile
@nicolasjafelle
nicolasjafelle / DialogFragmentHelper
Last active December 20, 2015 07:18
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
/**
* 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 February 16, 2017 12:36
SafeAsyncTask taken from Roboguice 2.0. and adapted to work without roboguice. Simple copy and paste this class and follow the javadoc.
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 / MainActivity
Created October 24, 2014 14:09
ActionBarActivity integrated with Roboguice
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 / RxEventBus.java
Last active May 28, 2018 23:16
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;