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"?>
<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-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
@ -9,92 +11,116 @@
android:allowBackup="true"
android:icon="@drawable/ic_icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
android:theme="@android:style/Theme.DeviceDefault">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service
android:name="info.nightscout.androidaps.BIGChart"
android:name=".BIGChart"
android:allowEmbedded="true"
android:label="@string/label_xdrip_big_chart"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/watch_face"/>
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_bigchart" />
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_bigchart" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service
android:name="info.nightscout.androidaps.Home"
android:name=".Home"
android:allowEmbedded="true"
android:label="@string/label_xdrip"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/watch_face"/>
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_graph" />
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_graph" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service
android:name="info.nightscout.androidaps.LargeHome"
android:name=".LargeHome"
android:allowEmbedded="true"
android:label="@string/label_xdrip_large"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/watch_face"/>
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_dark" />
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_dark" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service
android:name="info.nightscout.androidaps.CircleWatchface"
android:name=".CircleWatchface"
android:allowEmbedded="true"
android:label="@string/label_xdrip_circle"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/watch_face"/>
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/watchface_circle" />
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_circle" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service android:name="info.nightscout.androidaps.ListenerService">
<service android:name=".ListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
<activity
android:name="info.nightscout.androidaps.NWPreferences"
android:label="@string/label_xdrip_activity" >
android:name=".NWPreferences"
android:label="@string/label_xdrip_activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="info.nightscout.androidaps.actions.ActionsListActivity"
android:label="@string/label_actions_activity" >
android:name=".actions.ActionsListActivity"
android:label="@string/label_actions_activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</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>
</manifest>
</manifest>

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import info.nightscout.androidaps.ListenerService;
import info.nightscout.androidaps.NWPreferences;
import info.nightscout.androidaps.actions.bolus.BolusActivity;
/**
* Created by adrian on 08/02/17.
@ -20,18 +21,22 @@ final class ActionsDefinitions {
"Fillpreset 1",
"Fillpreset 2",
"Fillpreset 3",
"004"};
"005"};
public static void doAction(int position, Context ctx) {
Intent intent;
switch (position) {
case 0:
break;
case 1:
intent = new Intent(ctx, BolusActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
break;
case 2:
Intent intent = new Intent(ctx, NWPreferences.class);
intent = new Intent(ctx, NWPreferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
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_gray">#c1c1c1</color>
<color name="text_color">#434343</color>
<color name="cardObjectiveText">#779ECB</color>
<!-- light colors -->
<color name="light_bigchart_time">@color/black</color>

View file

@ -19,5 +19,8 @@
<item>4</item>
<item>5</item>
</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>