@Override public void activate(Context context, int watchType) { if (appData != null) { Intent intent = new Intent("org.metawatch.manager.APPLICATION_ACTIVATE"); Bundle b = new Bundle(); b.putString("id", appData.id); intent.putExtras(b); context.sendBroadcast(intent); for (int button = 1; button < 6; ++button) { if (button == 3) continue; // don't override the LED button for (int type = 0; type < 4; ++type) { int code = 200 + ((button - 1) * 4) + type; int actualButton = button; // Gen2 watches have LED on top left rather than bottom left // button if (MetaWatchService.watchGen == MetaWatchService.WatchGen.GEN2) { if (actualButton > 3) actualButton++; } else { if (actualButton > 4) actualButton++; } Protocol.getInstance(context) .enableButton(actualButton, type, code, MetaWatchService.WatchBuffers.APPLICATION); } } } }
@Override public void deactivate(Context context, int watchType) { if (appData != null) { Intent intent = new Intent("org.metawatch.manager.APPLICATION_DEACTIVATE"); Bundle b = new Bundle(); b.putString("id", appData.id); intent.putExtras(b); context.sendBroadcast(intent); for (int button = 1; button < 6; ++button) { if (button == 3) continue; // don't override the LED button for (int mode = 0; mode < 4; ++mode) { int actualButton = button; if (actualButton > 3) actualButton++; Protocol.getInstance(context) .disableButton(actualButton, mode, MetaWatchService.WatchBuffers.APPLICATION); } } } }
private void initBuffer(Context context) { if (buffer == null) { buffer = Protocol.getInstance(context).createTextBitmap(context, "Starting application mode ..."); } }