Android Open Source - RxWatchFace Watchface Activity






From Project

Back to project page RxWatchFace.

License

The source code is released under:

Apache License

If you think the Android project RxWatchFace listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.colintheshots.rxwatchface.activity;
/* w  ww  .  ja  v a  2s  .co  m*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.widget.TextView;

import com.colintheshots.rxwatchface.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.DataApi;
import com.google.android.gms.wearable.DataEvent;
import com.google.android.gms.wearable.DataEventBuffer;
import com.google.android.gms.wearable.Wearable;
import com.twotoasters.watchface.gears.activity.GearsWatchfaceActivity;
import com.twotoasters.watchface.gears.widget.IWatchface;

import butterknife.ButterKnife;
import butterknife.InjectView;
import timber.log.Timber;

public class WatchfaceActivity extends GearsWatchfaceActivity
{

    private static final String TAG = "WatchfaceActivity";

    @InjectView(R.id.gistTextView)
    TextView gistTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ButterKnife.inject(this);

        // Register the local broadcast receiver for messages from the ListenerService
        IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND);
        MessageReceiver messageReceiver = new MessageReceiver();
        LocalBroadcastManager.getInstance(this).registerReceiver(messageReceiver, messageFilter);
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.github_watchface;
    }

    @Override
    protected IWatchface getWatchface() {
        return (IWatchface) findViewById(R.id.watchface);
    }

    public class MessageReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            String message = intent.getStringExtra("message");
            Timber.d(TAG, "Message received: "+message);
            gistTextView.setText(message);
        }
    }
}




Java Source Code List

com.colintheshots.rxwatchface.GithubClient.java
com.colintheshots.rxwatchface.ListenerService.java
com.colintheshots.rxwatchface.MainActivity.java
com.colintheshots.rxwatchface.WatchfaceApp.java
com.colintheshots.rxwatchface.activity.WatchfaceActivity.java
com.colintheshots.rxwatchface.models.GistDetail.java
com.colintheshots.rxwatchface.models.GistFile.java
com.colintheshots.rxwatchface.models.Gist.java
com.colintheshots.rxwatchface.widget.Watchface.java