import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
+import android.support.wear.widget.BoxInsetLayout;
import android.support.wearable.activity.WearableActivity;
import android.util.Log;
import android.view.View;
Intent intent = getIntent();
String action = intent.getAction();
Log.v(TAG, "onResume() : " + action);
- if ((action != null)&&(action.equals("com.google.android.wearable.action.STOPWATCH")))
+ boolean isStartTimer = false;
+ if (action != null)
+ {
+ if (action.equals("com.google.android.wearable.action.STOPWATCH"))
+ {
+ isStartTimer = true;
+ }
+ else if (action.equals("vnd.google.fitness.TRACK"))
+ {
+ String activity = intent.getStringExtra("actionStatus");
+ if ((activity != null)&&(activity.equals("ActiveActionStatus")))
+ {
+ isStartTimer = true;
+ }
+ }
+ }
+ if (isStartTimer)
{
// start a timer!
startTimer();
if (timerCounter != null)
{
int bgColor;
+ BoxInsetLayout insetLayout = findViewById(R.id.box_inset_layout);
RelativeLayout layout = findViewById(R.id.relative_main_layout);
TextView main = findViewById(R.id.main_counter);
ImageButton btn1 = findViewById(R.id.btn1);
if (timerCounter.isStarted())
{
bgColor = Color.CYAN;
+ insetLayout.setBackgroundColor(bgColor);
+ insetLayout.invalidate();
+
layout.setBackgroundColor(bgColor);
layout.invalidate();
else if (timerCounter.isReset())
{
bgColor = Color.WHITE;
+ insetLayout.setBackgroundColor(bgColor);
+ insetLayout.invalidate();
+
layout.setBackgroundColor(bgColor);
layout.invalidate();
else
{
bgColor = Color.rgb(250, 80, 80);
+ insetLayout.setBackgroundColor(bgColor);
+ insetLayout.invalidate();
+
layout.setBackgroundColor(bgColor);
layout.invalidate();
<android.support.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/box_inset_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
<android.support.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/box_inset_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"