OSDN Git Service

記録表示用のactivityを用意してみた。
authorMRSa <mrsa@myad.jp>
Tue, 6 Mar 2018 15:43:15 +0000 (00:43 +0900)
committerMRSa <mrsa@myad.jp>
Tue, 6 Mar 2018 15:43:15 +0000 (00:43 +0900)
wear/src/main/AndroidManifest.xml
wear/src/main/java/net/osdn/gokigen/joggingtimer/ListActivity.java [new file with mode: 0644]
wear/src/main/java/net/osdn/gokigen/joggingtimer/MainActivity.java
wear/src/main/res/layout-notround/activity_list.xml [new file with mode: 0644]
wear/src/main/res/layout-notround/activity_main.xml
wear/src/main/res/layout-round/activity_list.xml [new file with mode: 0644]
wear/src/main/res/layout-round/activity_main.xml
wear/src/main/res/values-ja/strings.xml
wear/src/main/res/values/strings.xml

index 0727ae4..5c3094e 100644 (file)
                 <category android:name="android.intent.category.DEFAULT" />
                 <data android:mimeType="vnd.google.fitness.activity/other"/>
             </intent-filter>
+        </activity>
+        <activity
+            android:name=".ListActivity"
+            android:label="@string/result_list">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
diff --git a/wear/src/main/java/net/osdn/gokigen/joggingtimer/ListActivity.java b/wear/src/main/java/net/osdn/gokigen/joggingtimer/ListActivity.java
new file mode 100644 (file)
index 0000000..4aec55d
--- /dev/null
@@ -0,0 +1,120 @@
+package net.osdn.gokigen.joggingtimer;
+
+import android.os.Bundle;
+import android.support.wearable.activity.WearableActivity;
+import android.support.wear.widget.WearableRecyclerView;
+import android.util.Log;
+
+public class ListActivity extends WearableActivity
+{
+    private final String TAG = toString();
+
+    /**
+     *
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        Log.v(TAG, "onCreate()");
+
+        setContentView(R.layout.activity_list);
+
+        // Enables Always-on
+        setAmbientEnabled();
+    }
+
+    /**
+     *
+     */
+    @Override
+    protected void onSaveInstanceState(Bundle outState)
+    {
+        super.onSaveInstanceState(outState);
+    }
+
+    /**
+     *
+     */
+    @Override
+    protected void onRestoreInstanceState(Bundle savedInstanceState)
+    {
+        super.onRestoreInstanceState(savedInstanceState);
+    }
+
+    /**
+     *
+     */
+    @Override
+    protected void onResume()
+    {
+        super.onResume();
+        Log.v(TAG, "onResume()");
+    }
+
+    /**
+     *
+     */
+    @Override
+    protected void onPause()
+    {
+        super.onPause();
+        Log.v(TAG, "onPause()");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onStart()
+    {
+        super.onStart();
+        Log.v(TAG, "onStart()");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onStop()
+    {
+        super.onStop();
+        Log.v(TAG, "onStop()");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onEnterAmbient(Bundle ambientDetails)
+    {
+        super.onEnterAmbient(ambientDetails);
+        Log.v(TAG, "onEnterAmbient()");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onExitAmbient()
+    {
+        super.onExitAmbient();
+        Log.v(TAG, "onExitAmbient()");
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void onUpdateAmbient()
+    {
+        super.onUpdateAmbient();
+        Log.v(TAG, "onUpdateAmbient()");
+    }
+
+}
index 8f80de6..a81361a 100644 (file)
@@ -317,6 +317,15 @@ public class MainActivity extends WearableActivity implements IClickCallback, My
     @Override
     public void clickedBtn2()
     {
+        ITimerCounter timerCounter = counter;
+        if (timerCounter != null)
+        {
+            if (!timerCounter.isStarted())
+            {
+                // 停止中は、記録一覧を呼び出す
+                launchListActivity();
+            }
+        }
         updateTimerLabel();
     }
 
@@ -496,6 +505,24 @@ public class MainActivity extends WearableActivity implements IClickCallback, My
         }
     }
 
+    /**
+     *  Launch ListActivity
+     *
+     */
+    private void launchListActivity()
+    {
+        Log.v(TAG, "launchListActivity()");
+        try
+        {
+            Intent intent = new Intent(this, ListActivity.class);
+            startActivity(intent);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
     /*
      *
      *
diff --git a/wear/src/main/res/layout-notround/activity_list.xml b/wear/src/main/res/layout-notround/activity_list.xml
new file mode 100644 (file)
index 0000000..0493b60
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:id="@+id/time_list"
+    android:orientation="vertical"
+    android:scrollbarAlwaysDrawVerticalTrack="true">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/list_title_area"
+        android:text="@string/result_list"
+        android:textAlignment="center"
+        android:clickable="true"
+        android:focusable="true"
+        />
+    <android.support.wear.widget.WearableRecyclerView
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/recycler_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="vertical"
+        >
+
+    </android.support.wear.widget.WearableRecyclerView>
+
+
+</LinearLayout>
index 2dd4ace..31ba29d 100644 (file)
@@ -41,9 +41,9 @@
             android:clickable="true"
             android:focusable="true"
             android:scaleType="fitCenter"
-            android:visibility="invisible"
+            android:visibility="visible"
             android:contentDescription="@string/blank"
-            android:src="@drawable/ic_location_off_black_24dp"
+            android:src="@drawable/ic_format_list_bulleted_black_24dp"
             />
 
         <ImageButton
diff --git a/wear/src/main/res/layout-round/activity_list.xml b/wear/src/main/res/layout-round/activity_list.xml
new file mode 100644 (file)
index 0000000..111cb2a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:id="@+id/time_list"
+    android:orientation="vertical"
+    android:scrollbarAlwaysDrawVerticalTrack="true">
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/list_title_area"
+        android:text="@string/result_list"
+        android:textAlignment="center"
+        android:clickable="true"
+        android:focusable="true"
+        />
+    <android.support.wear.widget.WearableRecyclerView
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/recycler_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="vertical"
+        >
+
+    </android.support.wear.widget.WearableRecyclerView>
+
+
+</LinearLayout>
index 0293822..c3c5518 100644 (file)
@@ -40,9 +40,9 @@
             android:clickable="true"
             android:focusable="true"
             android:scaleType="fitEnd"
-            android:visibility="invisible"
+            android:visibility="visible"
             android:contentDescription="@string/blank"
-            android:src="@drawable/ic_location_off_black_24dp"
+            android:src="@drawable/ic_format_list_bulleted_black_24dp"
             />
 
         <ImageButton
index 580cb24..d178104 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="app_name">JoggingTimer</string>
+    <string name="result_list">記録</string>
     <string name="app_title">ジョギングタイマ</string>
     <string name="blank"> </string>
     <string name="counter">0:00\'00\"0</string>
index 9da4621..a0976df 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="app_name">JoggingTimer</string>
+    <string name="result_list">Records</string>
     <string name="app_title">Jogging Timer</string>
     <string name="blank"> </string>
     <string name="counter">0:00\'00\"0</string>