wear first gui draft bolus

This commit is contained in:
AdrianLxM 2017-02-09 04:50:36 +01:00
parent bf7a96b3e7
commit cb2319d1f2
11 changed files with 188 additions and 34 deletions

View file

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="info.nightscout.androidaps" > <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.nightscout.androidaps">
<uses-feature android:name="android.hardware.type.watch" /> <uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" /> <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
@ -9,92 +11,116 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_icon" android:icon="@drawable/ic_icon"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" > android:theme="@android:style/Theme.DeviceDefault">
<meta-data <meta-data
android:name="com.google.android.gms.version" android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" /> android:value="@integer/google_play_services_version" />
<service <service
android:name="info.nightscout.androidaps.BIGChart" android:name=".BIGChart"
android:allowEmbedded="true" android:allowEmbedded="true"
android:label="@string/label_xdrip_big_chart" android:label="@string/label_xdrip_big_chart"
android:permission="android.permission.BIND_WALLPAPER"> android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper" <meta-data
android:resource="@xml/watch_face"/> android:name="android.service.wallpaper"
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_bigchart" /> android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_bigchart" />
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter> </intent-filter>
</service> </service>
<service <service
android:name="info.nightscout.androidaps.Home" android:name=".Home"
android:allowEmbedded="true" android:allowEmbedded="true"
android:label="@string/label_xdrip" android:label="@string/label_xdrip"
android:permission="android.permission.BIND_WALLPAPER"> android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper" <meta-data
android:resource="@xml/watch_face"/> android:name="android.service.wallpaper"
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_graph" /> android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_graph" />
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter> </intent-filter>
</service> </service>
<service <service
android:name="info.nightscout.androidaps.LargeHome" android:name=".LargeHome"
android:allowEmbedded="true" android:allowEmbedded="true"
android:label="@string/label_xdrip_large" android:label="@string/label_xdrip_large"
android:permission="android.permission.BIND_WALLPAPER"> android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper" <meta-data
android:resource="@xml/watch_face"/> android:name="android.service.wallpaper"
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_dark" /> android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_dark" />
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter> </intent-filter>
</service> </service>
<service <service
android:name="info.nightscout.androidaps.CircleWatchface" android:name=".CircleWatchface"
android:allowEmbedded="true" android:allowEmbedded="true"
android:label="@string/label_xdrip_circle" android:label="@string/label_xdrip_circle"
android:permission="android.permission.BIND_WALLPAPER"> android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper" <meta-data
android:resource="@xml/watch_face"/> android:name="android.service.wallpaper"
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_circle" /> android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_circle" />
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter> </intent-filter>
</service> </service>
<service android:name=".ListenerService">
<service android:name="info.nightscout.androidaps.ListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter> </intent-filter>
</service> </service>
<activity <activity
android:name="info.nightscout.androidaps.NWPreferences" android:name=".NWPreferences"
android:label="@string/label_xdrip_activity" > android:label="@string/label_xdrip_activity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="info.nightscout.androidaps.actions.ActionsListActivity" android:name=".actions.ActionsListActivity"
android:label="@string/label_actions_activity" > android:label="@string/label_actions_activity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".actions.bolus.BolusActivity"
android:label="@string/title_activity_bolus">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </application>
</manifest> </manifest>

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import info.nightscout.androidaps.ListenerService; import info.nightscout.androidaps.ListenerService;
import info.nightscout.androidaps.NWPreferences; import info.nightscout.androidaps.NWPreferences;
import info.nightscout.androidaps.actions.bolus.BolusActivity;
/** /**
* Created by adrian on 08/02/17. * Created by adrian on 08/02/17.
@ -20,18 +21,22 @@ final class ActionsDefinitions {
"Fillpreset 1", "Fillpreset 1",
"Fillpreset 2", "Fillpreset 2",
"Fillpreset 3", "Fillpreset 3",
"004"}; "005"};
public static void doAction(int position, Context ctx) { public static void doAction(int position, Context ctx) {
Intent intent;
switch (position) { switch (position) {
case 0: case 0:
break; break;
case 1: case 1:
intent = new Intent(ctx, BolusActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
break; break;
case 2: case 2:
Intent intent = new Intent(ctx, NWPreferences.class); intent = new Intent(ctx, NWPreferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent); ctx.startActivity(intent);
break; break;

View file

@ -0,0 +1,26 @@
package info.nightscout.androidaps.actions.bolus;
import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.widget.TextView;
import info.nightscout.androidaps.R;
public class BolusActivity extends Activity {
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bolus);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
//bmTextView = (TextView) stub.findViewById(R.id.text);
}
});
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:shape="oval">
<solid android:color="@android:color/transparent"/>
<stroke
android:width="2dip"
android:color="@color/cardObjectiveText"
/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.WatchViewStub 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/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect_activity_bolus"
app:roundLayout="@layout/round_activity_bolus"
tools:context="info.nightscout.androidaps.actions.bolus.BolusActivity"
tools:deviceIds="wear"></android.support.wearable.view.WatchViewStub>

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<ImageView
android:id="@+id/treatments_newtreatment_insulinamount_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_newtreatment_insulinamount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="50dp"
android:padding="10dp"
android:text="112"
android:cursorVisible="false"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="label"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_horizontal" />
<ImageView
android:id="@+id/treatments_newtreatment_insulinamount_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.actions.bolus.BolusActivity"
tools:deviceIds="wear_round">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_round" />
</RelativeLayout>

View file

@ -4,6 +4,8 @@
<color name="wl_blue">#2878ff</color> <color name="wl_blue">#2878ff</color>
<color name="wl_gray">#c1c1c1</color> <color name="wl_gray">#c1c1c1</color>
<color name="text_color">#434343</color> <color name="text_color">#434343</color>
<color name="cardObjectiveText">#779ECB</color>
<!-- light colors --> <!-- light colors -->
<color name="light_bigchart_time">@color/black</color> <color name="light_bigchart_time">@color/black</color>

View file

@ -19,5 +19,8 @@
<item>4</item> <item>4</item>
<item>5</item> <item>5</item>
</string-array> </string-array>
<string name="title_activity_bolus">BolusActivity</string>
<string name="hello_round">Hello Round World!</string>
<string name="hello_square">Hello Square World!</string>
</resources> </resources>