diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java index f8c21745c0..ac20a6d79b 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java @@ -117,7 +117,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre sharedPrefs.registerOnSharedPreferenceChangeListener(this); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 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); } else { layoutView = inflater.inflate(R.layout.activity_bigchart, null); @@ -689,4 +689,4 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre ListenerService.requestData(this); } } -} \ No newline at end of file +} diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java index 328f101497..68b5e7f15a 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java @@ -13,6 +13,7 @@ import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Shader; +import android.os.Build; import android.os.Bundle; import android.os.PowerManager; import android.os.SystemClock; @@ -22,6 +23,7 @@ import android.support.v4.content.LocalBroadcastManager; import android.support.wearable.view.WatchViewStub; import android.support.wearable.watchface.WatchFaceStyle; import android.text.format.DateFormat; +import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.LayoutInflater; @@ -30,6 +32,7 @@ import android.view.WindowInsets; import android.view.WindowManager; import android.widget.RelativeLayout; import android.widget.TextView; +import android.widget.Toast; import com.google.android.gms.wearable.DataMap; import com.ustwo.clockwise.common.WatchFaceTime; @@ -40,6 +43,7 @@ import com.ustwo.clockwise.wearable.WatchFace; import java.util.ArrayList; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.data.BasalWatchData; import info.nightscout.androidaps.data.BgWatchData; 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 final static IntentFilter INTENT_FILTER; + public static final int SCREENSIZE_SMALL = 280; public TextView mTime, mSgv, mTimestamp, mDelta, mAvgDelta; public RelativeLayout mRelativeLayout; public long sgvLevel = 0; @@ -96,6 +101,12 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref sharedPrefs.registerOnSharedPreferenceChangeListener(this); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 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(); } @@ -514,4 +525,4 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref ListenerService.requestData(this); // attempt endTime recover missing data } } -} \ No newline at end of file +} diff --git a/wear/src/main/res/layout/activity_nochart_small.xml b/wear/src/main/res/layout/activity_nochart_small.xml new file mode 100644 index 0000000000..955a214580 --- /dev/null +++ b/wear/src/main/res/layout/activity_nochart_small.xml @@ -0,0 +1,12 @@ + + diff --git a/wear/src/main/res/layout/rect_activity_bigchart_small.xml b/wear/src/main/res/layout/rect_activity_bigchart_small.xml index 2726a17ae7..d080472443 100644 --- a/wear/src/main/res/layout/rect_activity_bigchart_small.xml +++ b/wear/src/main/res/layout/rect_activity_bigchart_small.xml @@ -61,6 +61,7 @@ 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" @@ -75,11 +76,12 @@ android:gravity="center_horizontal" /> + android:layout_marginTop="-5sp" + android:gravity="center_horizontal" + android:orientation="horizontal" + android:textAlignment="center"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wear/src/main/res/layout/round_activity_bigchart_small.xml b/wear/src/main/res/layout/round_activity_bigchart_small.xml index 8db4a3dd15..d080472443 100644 --- a/wear/src/main/res/layout/round_activity_bigchart_small.xml +++ b/wear/src/main/res/layout/round_activity_bigchart_small.xml @@ -13,49 +13,60 @@ android:gravity="center_horizontal"> + android:gravity="center_horizontal" + android:orientation="horizontal" + android:paddingTop="5dp" + android:textAlignment="center"> + android:text="---" + android:textColor="#FFFFFF" + android:textSize="24sp" /> + android:gravity="center_horizontal" + android:text="---" + android:textColor="#FFFFFF" + android:textSize="34sp" /> + android:text="---" + android:textColor="#FFFFFF" + android:textSize="24sp" /> + + - - + android:layout_marginTop="-5sp" + android:gravity="center_horizontal" + android:orientation="horizontal" + android:textAlignment="center"> + android:paddingTop="-5sp" + android:text="12:00" + android:textAlignment="center" + android:textColor="#FFFFFF" + android:textSize="34sp" /> + android:textSize="24sp" /> diff --git a/wear/src/main/res/layout/round_activity_nochart_small.xml b/wear/src/main/res/layout/round_activity_nochart_small.xml new file mode 100644 index 0000000000..5391cea92a --- /dev/null +++ b/wear/src/main/res/layout/round_activity_nochart_small.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file