From 8d6760081e6ddb615d39620108c90afc3cec45a8 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 9 Feb 2017 00:15:14 +0100 Subject: [PATCH] wear circle watchface fix --- .../androidaps/CircleWatchface.java | 19 +++++++++++++------ .../info/nightscout/androidaps/LargeHome.java | 6 ++++++ .../actions/ActionsDefinitions.java | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java b/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java index 26b8f0198e..968e29e7bc 100644 --- a/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java +++ b/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java @@ -17,6 +17,7 @@ import android.os.Bundle; import android.os.PowerManager; import android.preference.PreferenceManager; import android.support.v4.content.LocalBroadcastManager; +import android.support.wearable.watchface.WatchFaceStyle; import android.util.Log; import android.util.TypedValue; import android.view.Display; @@ -346,7 +347,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh } public int getInRangeColor() { - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { return Color.argb(255, 120, 255, 120); } else { return Color.argb(255, 0, 240, 0); @@ -355,7 +356,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh } public int getHighColor() { - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { return Color.argb(255, 255, 255, 120); } else { return Color.argb(255, 255, 200, 0); @@ -364,7 +365,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh } public int getBackgroundColor() { - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { return Color.BLACK; } else { return Color.WHITE; @@ -373,7 +374,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh } public int getTextColor() { - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { return Color.WHITE; } else { return Color.BLACK; @@ -666,7 +667,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh Log.d("CircleWatchface", "addReadingSoft"); double size; int color = Color.LTGRAY; - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { color = Color.DKGRAY; } @@ -684,7 +685,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh double size; int color = Color.LTGRAY; int indicatorColor = Color.DKGRAY; - if (sharedPrefs.getBoolean("dark", false)) { + if (sharedPrefs.getBoolean("dark", true)) { color = Color.DKGRAY; indicatorColor = Color.LTGRAY; } @@ -724,4 +725,10 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh } } + @Override + protected WatchFaceStyle getWatchFaceStyle(){ + return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build(); + } + + } \ No newline at end of file diff --git a/wear/src/main/java/info/nightscout/androidaps/LargeHome.java b/wear/src/main/java/info/nightscout/androidaps/LargeHome.java index 1e5fedc336..b3a342f2d8 100644 --- a/wear/src/main/java/info/nightscout/androidaps/LargeHome.java +++ b/wear/src/main/java/info/nightscout/androidaps/LargeHome.java @@ -3,6 +3,7 @@ package info.nightscout.androidaps; import android.content.Intent; import android.graphics.Color; import android.support.v4.content.ContextCompat; +import android.support.wearable.watchface.WatchFaceStyle; import android.view.LayoutInflater; import com.ustwo.clockwise.common.WatchMode; @@ -40,6 +41,11 @@ public class LargeHome extends BaseWatchFace { } } + @Override + protected WatchFaceStyle getWatchFaceStyle(){ + return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build(); + } + @Override protected void setColorDark(){ mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mLinearLayout)); diff --git a/wear/src/main/java/info/nightscout/androidaps/actions/ActionsDefinitions.java b/wear/src/main/java/info/nightscout/androidaps/actions/ActionsDefinitions.java index 0b6d90c150..2265abdd88 100644 --- a/wear/src/main/java/info/nightscout/androidaps/actions/ActionsDefinitions.java +++ b/wear/src/main/java/info/nightscout/androidaps/actions/ActionsDefinitions.java @@ -20,7 +20,7 @@ final class ActionsDefinitions { "Fillpreset 1", "Fillpreset 2", "Fillpreset 3", - "003"}; + "004"}; public static void doAction(int position, Context ctx) {