Skip to content

Instantly share code, notes, and snippets.

View josh-burton's full-sized avatar
👋

Josh Burton josh-burton

👋
View GitHub Profile
@josh-burton
josh-burton / Building the Graph
Created April 25, 2017 07:24
Context with @BindsInstance
DaggerApplicationComponent.builder().context(applicationContext).build().inject(this);
@josh-burton
josh-burton / MapStyleManager.java
Created September 22, 2016 04:56
MapStyleManager - Google Map Styles per zoom level
public final class MapStyleManager implements GoogleMap.OnCameraMoveListener {
private final Context context;
private final GoogleMap map;
private final GoogleMap.OnCameraMoveListener onCameraMoveListener;
private final TreeMap<Float, Integer> styleMap = new TreeMap<>();
@RawRes
private int currentMapStyleRes = 0;
@josh-burton
josh-burton / MergeRecyclerAdapter
Created August 26, 2014 20:38
A Merge Adapter for the RecyclerView. Based on CommonsWare cwac-merge and the MergedAdapter in the android sdk.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
public class WatchFaceAluminum
extends WatchFace
{
protected WatchFaceStyle buildStyle()
{
WatchFaceStyle.Builder localBuilder = WatchFaceStyle.Builder.forActivity(this).setCardPeekMode(1).setPeekOpacityMode(1).setCardProgressMode(0).setBackgroundVisibility(0).setViewProtection(0).setShowSystemUiTime(false);
if (isRound()) {
localBuilder.setHotwordIndicatorGravity(81).setStatusBarGravity(49);
}
for (;;)
@josh-burton
josh-burton / gist:e6c71859d28027fe1a83
Created July 12, 2014 06:10
Android Wear Watchface Tick Receiver
IntentFilter timeTickIntentFilter = new IntentFilter("com.google.android.wearable.home.action.WEARABLE_TIME_TICK");
listener.registerReceiver(mTimeTickReceiver, timeTickIntentFilter);
public final BroadcastReceiver mTimeTickReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
//ontick
}
};
@josh-burton
josh-burton / gist:88021de7ec712e1a3371
Created July 12, 2014 06:09
Android Wear Watchface Background listener
private final BroadcastReceiver mBackgroundReceiver = new BroadcastReceiver() {
public void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent) {
if (paramAnonymousIntent.hasExtra("card_location")) {
mListener.onCardLocation(
Rect.unflattenFromString(paramAnonymousIntent.getStringExtra("card_location")));
}
if (paramAnonymousIntent.hasExtra("card_progress_enabled")) {
mListener.onCardProgressEnabled(paramAnonymousIntent.getBooleanExtra("card_progress_enabled", false));
}
if (paramAnonymousIntent.hasExtra("card_progress")) {