Skip to content

Instantly share code, notes, and snippets.

@gatlingxyz
gatlingxyz / gist:52fb21eb92181716b0ce
Created July 11, 2014 23:49
Unofficial Base WatchFace Activity
import android.app.Activity;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.view.Display;
/**
* A base activity for watch faces that have callbacks for the various screen states (dim, awake, and off)
* as well as a callback for when the watch face is removed.
* <p/>
// this...
@Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.v(TAG, "Message received on wear: " + messageEvent.getPath());
if(messageEvent.getPath().endsWith("connected")){
findViewById(R.id.progress).setVisibility(View.GONE); // Line #143
findViewById(R.id.on_off_layout).setVisibility(View.VISIBLE);
@gatlingxyz
gatlingxyz / gist:c034245484ee7c487df6
Created June 28, 2014 18:56
AsyncTask to add views to FakeListView
private class AddViewsToFakeListTask extends AsyncTask<Void, View, Void>{
private ListAdapter adapter;
private LinearLayout view;
public AddViewsToFakeListTask(LinearLayout view, ListAdapter adapter){
this.view = view;
this.adapter = adapter;
}
@gatlingxyz
gatlingxyz / gist:21960b1c9a0ce45e5a79
Created June 28, 2014 18:53
How to use QuickReturnScrollView
<?xml version="1.0" encoding="utf-8"?>
<org.example.text.QuickReturnScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:gravity="center"
android:id="@+id/root_scroll"
android:layout_height="match_parent">