Skip to content

Instantly share code, notes, and snippets.


Paul Blundell blundell

View GitHub Profile
blundell / Navigator Pattern
Last active Dec 26, 2015
Navigator Pattern - not really copy and paste-able. Packages intents for re-use nicely. Helps testing? Redundant now we can use espresso?
View Navigator Pattern
public class Navigator {
private final ImplicitNavigator implicitNavigator;
private final ExplicitNavigator explicitNavigator;
private final AccountNavigator accountNavigator;
public Navigator(Activity activity, TescoLoginFacade tescoLoginFacade) {
implicitNavigator = new ImplicitNavigator(activity);
explicitNavigator = new ExplicitNavigator(activity);
accountNavigator = new AccountNavigator(activity, tescoLoginFacade);
blundell / Otto event bus for Android Notification
Created Oct 23, 2013
Otto event bus for Notifications. Really easy to show a notification from an unrelated piece of code. Nice and easy to test. Good use of the bus!
View Otto event bus for Android Notification
public class ParseNotificationWatcher {
private final ParseNotificationManager notificationManager;
private final NotificationBuilder notificationBuilder;
public ParseNotificationWatcher(ParseNotificationManager notificationManager, NotificationBuilder notificationBuilder) {
this.notificationManager = notificationManager;
this.notificationBuilder = notificationBuilder;
blundell / Crazy Array Init
Last active Dec 31, 2015
1 line annon inner class array initialisation because I want to be able to add & remove but I'm too lazy to extend BaseAdapter.
View Crazy Array Init
public class NavDrawerArrayAdapter extends ArrayAdapter<String> {
public NavDrawerArrayAdapter(final Context context) {
super(context, android.R.layout.simple_list_item_activated_1,,
new ArrayList<String>() {{
blundell / Gradle handle repos
Created Jan 20, 2014
Handle the declaration of all source code repositories in your base build file, and you don't have to worry about declaring them in any child modules. The code below would go at the top of your build.gradle, in your 'base' or 'top' build.gradle file. You don't have to add anything to child modules. You will get full repository source retrieval.
View Gradle handle repos
subprojects {
buildscript {
repositories {
maven {
url ""
maven {
url ""
blundell / VideoView Buffering Spinner
Created Jan 21, 2014
Adding a progress spinner to a video view for before it starts or whilst it is buffering.
View VideoView Buffering Spinner
<FrameLayout xmlns:android=""
android:layout_gravity="center" />
blundell / anti-hungarian-checkstyle
Created Jan 25, 2014
Anti-Hungarian CheckStyle check
View anti-hungarian-checkstyle
public class AntiHungarianCheck extends Check {
private static final String CATCH_MSG = "Hungarian notation belongs in the 90's. " +
"Don't prefix member variables with 'm'. " +
"Use your IDE's shiny colors. Culprit was: ";
private final HungarianNotationMemberDetector detector = new HungarianNotationMemberDetector();
blundell / Code Readability
Last active Aug 29, 2015
This is an example of possible code when you have a maximum line length of 150 to attain max readability
View Code Readability
// Code readability - 4 possibilities
// A
context.getContentResolver().update(getDownloadUri(context, intent), values, null, null);
// vs
// B
getDownloadUri(context, intent), values, null, null);
// vs
blundell / 0_reuse_code.js
Created Jun 6, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
blundell /
Last active Aug 29, 2015
Unofficial Base WatchFace Listener
public class ExampleActivity extends Activity implements WatchFaceLifecycle.Listener {
protected void onCreate(Bundle savedInstanceState) {
WatchFaceLifecycle.attach(this, savedInstanceState, this);