package com.maize.spotlight;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;

import com.maize.watchface.spotlight.WatchfaceView;

/**
 * @author Will Hou (will@ezi.am)
 * @date Sept 9, 2014
 */
public class WatchfaceActivity extends Activity {

    private static final IntentFilter INTENT_FILTER_TIME;

    static {
        INTENT_FILTER_TIME = new IntentFilter();
        INTENT_FILTER_TIME.addAction(Intent.ACTION_TIME_TICK);
        INTENT_FILTER_TIME.addAction(Intent.ACTION_TIMEZONE_CHANGED);
        INTENT_FILTER_TIME.addAction(Intent.ACTION_TIME_CHANGED);
    }

    private WatchfaceView mWatchfaceView;

    public BroadcastReceiver mTimeInfoReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent intent) {
            if (mWatchfaceView != null) {
                mWatchfaceView.invalidate();
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_watchface);
        mWatchfaceView = (WatchfaceView) findViewById(R.id.face);

        mTimeInfoReceiver.onReceive(this, registerReceiver(null, INTENT_FILTER_TIME));
        registerReceiver(mTimeInfoReceiver, INTENT_FILTER_TIME);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unregisterReceiver(mTimeInfoReceiver);
    }
}

@@ -219,16 +219,68 @@
 .Bundle;
+%0Aimport android.support.wearable.view.WatchViewStub;
 %0A%0Aimport
@@ -1248,24 +1248,293 @@
 watchface);%0A
+%0A        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);%0A        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() %7B%0A            @Override%0A            public void onLayoutInflated(WatchViewStub stub) %7B%0A        
         mWat
@@ -1562,16 +1562,21 @@
 ceView) 
+stub.
 findView
@@ -1587,24 +1587,50 @@
 (R.id.face);
+%0A            %7D%0A        %7D);
 %0A%0A        mT

Fix watchface not updating issue