</intent-filter>
</activity>
<activity
- android:name=".ListActivity"
+ android:name=".recordlist.ListActivity"
android:label="@string/result_list">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
import android.widget.RelativeLayout;
import android.widget.TextView;
+import net.osdn.gokigen.joggingtimer.recordlist.ListActivity;
+
import java.util.List;
/**
--- /dev/null
+package net.osdn.gokigen.joggingtimer.recordlist;
+
+/**
+ *
+ *
+ */
+public class DataRecord
+{
+ private int iconId = 0;
+ private String title = "";
+ private String detail = "";
+
+ /**
+ *
+ */
+ public DataRecord(int iconId, String title, String detail)
+ {
+ this.iconId = iconId;
+ this.title = title;
+ this.detail = detail;
+ }
+
+ public void setIconId(int iconId)
+ {
+ this.iconId = iconId;
+ }
+
+ public int getIconId()
+ {
+ return (iconId);
+ }
+
+ public String getTitle()
+ {
+ return (title);
+ }
+
+ public String getDetail()
+ {
+ return (detail);
+ }
+}
-package net.osdn.gokigen.joggingtimer;
+package net.osdn.gokigen.joggingtimer.recordlist;
import android.os.Bundle;
+import android.support.wear.widget.WearableLinearLayoutManager;
import android.support.wearable.activity.WearableActivity;
import android.support.wear.widget.WearableRecyclerView;
import android.util.Log;
+import net.osdn.gokigen.joggingtimer.R;
+
public class ListActivity extends WearableActivity
{
private final String TAG = toString();
// Enables Always-on
setAmbientEnabled();
+
+ try
+ {
+ WearableRecyclerView view = findViewById(R.id.recycler_list_view);
+ RecordSummaryAdapter adapter = new RecordSummaryAdapter();
+ WearableLinearLayoutManager layoutManager = new WearableLinearLayoutManager(this);
+
+ view.setLayoutManager(layoutManager);
+ view.setAdapter(adapter);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
/**
--- /dev/null
+package net.osdn.gokigen.joggingtimer.recordlist;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import net.osdn.gokigen.joggingtimer.R;
+
+class RecordHolder extends RecyclerView.ViewHolder
+{
+ private ImageView iconView = null;
+ private TextView mainText = null;
+ private TextView subText = null;
+
+ RecordHolder(View itemView)
+ {
+ super(itemView);
+ iconView = itemView.findViewById(R.id.gokigen_icon);
+ mainText = itemView.findViewById(R.id.main_text);
+ subText = itemView.findViewById(R.id.sub_text);
+ }
+
+ void setIconId(int iconId)
+ {
+ if (iconId != 0)
+ {
+ iconView.setImageResource(iconId);
+ }
+ }
+
+ void setMainText(String message)
+ {
+ mainText.setText(message);
+ }
+
+ void setSubText(String message)
+ {
+ subText.setText(message);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.joggingtimer.recordlist;
+
+import android.provider.ContactsContract;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import net.osdn.gokigen.joggingtimer.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ *
+ */
+public class RecordSummaryAdapter extends RecyclerView.Adapter<RecordHolder>
+{
+ private List<DataRecord> list = null;
+
+ /**
+ *
+ *
+ */
+ public RecordSummaryAdapter()
+ {
+ list = new ArrayList<>();
+ list.clear();
+
+ addRecord(new DataRecord(0, "XXXXX", "00000000"));
+ addRecord(new DataRecord(R.drawable.ic_sentiment_very_dissatisfied_black_24dp, "XXXXX", "11111111"));
+ addRecord(new DataRecord(R.drawable.ic_mood_bad_black_24dp, "XXXXX", "2222222"));
+ addRecord(new DataRecord(R.drawable.ic_sentiment_dissatisfied_black_24dp, "XXXXX", "3333333"));
+ addRecord(new DataRecord(R.drawable.ic_sentiment_neutral_black_24dp, "XXXXX", "44444444"));
+ addRecord(new DataRecord(R.drawable.ic_sentiment_satisfied_black_24dp, "XXXXX", "55555555"));
+ addRecord(new DataRecord(R.drawable.ic_mood_black_24dp, "XXXXX", "66666666"));
+ addRecord(new DataRecord(R.drawable.ic_sentiment_very_satisfied_black_24dp, "XXXXX", "77777777"));
+ }
+
+ /**
+ *
+ *
+ */
+ public void addRecord(DataRecord record)
+ {
+ try
+ {
+ list.add(record);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ *
+ *
+ */
+ public void clearRecord()
+ {
+ try
+ {
+ list.clear();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ @Override
+ public RecordHolder onCreateViewHolder(ViewGroup parent, int viewType)
+ {
+ View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.column_list, parent,false);
+ return (new RecordHolder(inflate));
+ }
+
+ /**
+ *
+ *
+ */
+ @Override
+ public void onBindViewHolder(RecordHolder holder, int position)
+ {
+ try
+ {
+ holder.setIconId(list.get(position).getIconId());
+ holder.setMainText(list.get(position).getTitle());
+ holder.setSubText(list.get(position).getDetail());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ @Override
+ public int getItemCount()
+ {
+ return (list.size());
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/gokigen_icon"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:scaleType="fitCenter"
+ android:src="@drawable/ic_info_outline_black_24dp"
+ android:layout_gravity="center_vertical"
+ android:maxHeight="18dp"
+ android:minWidth="18dp"
+ android:layout_margin="4dp"
+ android:contentDescription="@string/blank"
+ android:tint="@color/white"
+ android:tag="icon"
+ />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:id="@+id/data_list"
+ >
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textStyle="normal"
+ android:textSize="10pt"
+ android:clickable="false"
+ android:focusable="false"
+ android:tag="main"
+ android:id="@+id/main_text"
+ />
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="8pt"
+ android:clickable="false"
+ android:focusable="false"
+ android:tag="sub"
+ android:id="@+id/sub_text"
+ />
+ </LinearLayout>
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/gokigen_icon"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:scaleType="fitCenter"
+ android:src="@drawable/ic_info_outline_black_24dp"
+ android:layout_gravity="center_vertical"
+ android:maxHeight="18dp"
+ android:minWidth="18dp"
+ android:contentDescription="@string/blank"
+ android:tag="icon"
+ />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:id="@+id/data_list"
+ >
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textStyle="normal"
+ android:textSize="10pt"
+ android:clickable="false"
+ android:focusable="false"
+ android:tag="main"
+ android:id="@+id/main_text"
+ />
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="8pt"
+ android:clickable="false"
+ android:focusable="false"
+ android:tag="sub"
+ android:id="@+id/sub_text"
+ />
+ </LinearLayout>
+</LinearLayout>