Merge remote-tracking branch 'swissalpineremote/patch-4' into watchsmb2

This commit is contained in:
AdrianLxM 2018-03-04 20:18:43 +01:00
commit 0818f3b419
7 changed files with 307 additions and 46 deletions

View file

@ -117,7 +117,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
sharedPrefs.registerOnSharedPreferenceChangeListener(this); sharedPrefs.registerOnSharedPreferenceChangeListener(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
DisplayMetrics metrics = getResources().getDisplayMetrics(); DisplayMetrics metrics = getResources().getDisplayMetrics();
if(metrics.widthPixels < SCREENSIZE_SMALL || metrics.widthPixels < SCREENSIZE_SMALL){ if(metrics.widthPixels < SCREENSIZE_SMALL || metrics.heightPixels < SCREENSIZE_SMALL){
layoutView = inflater.inflate(R.layout.activity_bigchart_small, null); layoutView = inflater.inflate(R.layout.activity_bigchart_small, null);
} else { } else {
layoutView = inflater.inflate(R.layout.activity_bigchart, null); layoutView = inflater.inflate(R.layout.activity_bigchart, null);

View file

@ -13,6 +13,7 @@ import android.graphics.Paint;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Shader; import android.graphics.Shader;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
@ -22,6 +23,7 @@ import android.support.v4.content.LocalBroadcastManager;
import android.support.wearable.view.WatchViewStub; import android.support.wearable.view.WatchViewStub;
import android.support.wearable.watchface.WatchFaceStyle; import android.support.wearable.watchface.WatchFaceStyle;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -30,6 +32,7 @@ import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMap;
import com.ustwo.clockwise.common.WatchFaceTime; import com.ustwo.clockwise.common.WatchFaceTime;
@ -40,6 +43,7 @@ import com.ustwo.clockwise.wearable.WatchFace;
import java.util.ArrayList; import java.util.ArrayList;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.data.BasalWatchData; import info.nightscout.androidaps.data.BasalWatchData;
import info.nightscout.androidaps.data.BgWatchData; import info.nightscout.androidaps.data.BgWatchData;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
@ -52,6 +56,7 @@ import lecho.lib.hellocharts.view.LineChartView;
*/ */
public class NOChart extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener { public class NOChart extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
public final static IntentFilter INTENT_FILTER; public final static IntentFilter INTENT_FILTER;
public static final int SCREENSIZE_SMALL = 280;
public TextView mTime, mSgv, mTimestamp, mDelta, mAvgDelta; public TextView mTime, mSgv, mTimestamp, mDelta, mAvgDelta;
public RelativeLayout mRelativeLayout; public RelativeLayout mRelativeLayout;
public long sgvLevel = 0; public long sgvLevel = 0;
@ -96,6 +101,12 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
sharedPrefs.registerOnSharedPreferenceChangeListener(this); sharedPrefs.registerOnSharedPreferenceChangeListener(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_nochart, null); layoutView = inflater.inflate(R.layout.activity_nochart, null);
DisplayMetrics metrics = getResources().getDisplayMetrics();
if(metrics.widthPixels < SCREENSIZE_SMALL || metrics.heightPixels < SCREENSIZE_SMALL){
layoutView = inflater.inflate(R.layout.activity_nochart_small, null);
} else {
layoutView = inflater.inflate(R.layout.activity_nochart, null);
}
performViewSetup(); performViewSetup();
} }

View file

@ -0,0 +1,12 @@
<?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_nochart_small"
app:roundLayout="@layout/round_activity_nochart_small"
tools:context=".watchfaces.Home"
tools:deviceIds="wear"/>

View file

@ -61,6 +61,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="-5sp"
android:text="E xU/h IOB: x (x+x)" android:text="E xU/h IOB: x (x+x)"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
@ -75,11 +76,12 @@
android:gravity="center_horizontal" /> android:gravity="center_horizontal" />
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center" android:layout_marginTop="-5sp"
android:gravity="center_horizontal"> android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView <TextView
android:id="@+id/watch_time" android:id="@+id/watch_time"
@ -87,6 +89,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:paddingTop="-5sp"
android:text="12:00" android:text="12:00"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"

View file

@ -0,0 +1,116 @@
<?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=".watchfaces.Home" tools:deviceIds="wear_square"
android:background="@color/black"
android:id="@+id/main_layout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:textAlignment="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginRight="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text="---"
android:textColor="#FFFFFF"
android:textSize="24sp" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="#FFFFFF"
android:textSize="45sp" />
<TextView
android:id="@+id/avgdelta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text=" ---"
android:textColor="#FFFFFF"
android:textSize="26sp" />
</LinearLayout>
<View
android:id="@+id/dummy1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/aps_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="No Loop Status"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="21sp" />
<View
android:id="@+id/dummy2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:layout_weight="0"
android:gravity="center_horizontal" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginRight="6dp"
android:text="23:24"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="45sp" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="--'"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -13,49 +13,60 @@
android:gravity="center_horizontal"> android:gravity="center_horizontal">
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center"
android:paddingTop="5dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp" android:layout_marginTop="-5dp"
android:gravity="center_horizontal"> android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView <TextView
android:id="@+id/delta" android:id="@+id/delta"
android:textSize="30sp"
android:text="---"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#FFFFFF" android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_gravity="bottom" android:layout_marginRight="5dp"
android:gravity="center_horizontal|bottom" android:gravity="center_horizontal|bottom"
android:layout_marginRight="5dp" /> android:text="---"
android:textColor="#FFFFFF"
android:textSize="24sp" />
<TextView <TextView
android:id="@+id/sgv" android:id="@+id/sgv"
android:textSize="41sp"
android:text="---"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" /> android:gravity="center_horizontal"
android:text="---"
android:textColor="#FFFFFF"
android:textSize="34sp" />
<TextView <TextView
android:id="@+id/avgdelta" android:id="@+id/avgdelta"
android:textSize="30sp"
android:text="---"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#FFFFFF" android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_gravity="bottom" android:layout_marginLeft="5dp"
android:gravity="center_horizontal|bottom" android:gravity="center_horizontal|bottom"
android:layout_marginLeft="5dp" /> android:text="---"
android:textColor="#FFFFFF"
android:textSize="24sp" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/aps_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5sp"
android:text="E xU/h IOB: x (x+x)"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<lecho.lib.hellocharts.view.LineChartView <lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart" android:id="@+id/chart"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -64,43 +75,35 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal" /> android:gravity="center_horizontal" />
<TextView
android:id="@+id/aps_status"
android:textSize="18sp"
android:text="E xU/h IOB: x (x+x)"
android:layout_width="wrap_content"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"/>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center" android:layout_marginTop="-5sp"
android:gravity="center_horizontal"> android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView <TextView
android:id="@+id/watch_time" android:id="@+id/watch_time"
android:textSize="35sp"
android:text="12:00"
android:textColor="#FFFFFF"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center" android:layout_gravity="center_horizontal"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:layout_gravity="center_horizontal" /> android:paddingTop="-5sp"
android:text="12:00"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="34sp" />
<TextView <TextView
android:id="@+id/timestamp" android:id="@+id/timestamp"
android:textSize="26sp"
android:text="-- '"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="--'"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:layout_gravity="center_horizontal" android:textSize="24sp" />
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,116 @@
<?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=".watchfaces.Home" tools:deviceIds="wear_square"
android:background="@color/black"
android:id="@+id/main_layout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:textAlignment="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginRight="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text="---"
android:textColor="#FFFFFF"
android:textSize="24sp" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="#FFFFFF"
android:textSize="45sp" />
<TextView
android:id="@+id/avgdelta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text=" ---"
android:textColor="#FFFFFF"
android:textSize="26sp" />
</LinearLayout>
<View
android:id="@+id/dummy1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/aps_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="No Loop Status"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="21sp" />
<View
android:id="@+id/dummy2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:layout_weight="0"
android:gravity="center_horizontal" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/watch_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginRight="6dp"
android:text="23:24"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="45sp" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="--'"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>