diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index 4d197c5bd8..511266dbf1 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ - + - @@ -52,7 +51,6 @@ - @@ -71,7 +69,6 @@ - @@ -90,7 +87,6 @@ - @@ -109,7 +105,6 @@ - @@ -128,7 +123,6 @@ - @@ -147,7 +141,6 @@ - @@ -165,7 +158,27 @@ + + + + + + + + + + @@ -178,57 +191,57 @@ + android:pathPrefix="/nightscout_watch_data" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_data_resend" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_cancel_bolus" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_confirmactionstring" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_initiateactionstring" + android:scheme="wear" /> + android:pathPrefix="/openwearsettings" + android:scheme="wear" /> + android:pathPrefix="/sendstatustowear" + android:scheme="wear" /> + android:pathPrefix="/sendpreferencestowear" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_basal" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_bolusprogress" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_actionconfirmationrequest" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_changeconfirmationrequest" + android:scheme="wear" /> + android:pathPrefix="/nightscout_watch_cancelnotificationrequest" + android:scheme="wear" /> @@ -237,16 +250,16 @@ android:icon="@drawable/ic_aaps_full" android:label="Full Status" android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> - - - + + + - - + + + android:value="LARGE_IMAGE" /> + android:value="0" /> + android:value="LARGE_IMAGE" /> + android:value="0" /> + android:value="LARGE_IMAGE" /> + android:value="0" /> - + - + android:label="@string/menu_settings" /> - + android:label="@string/menu_wizard" /> - + android:label="@string/menu_prime_fill" /> - + android:label="@string/menu_status" /> - + android:label="@string/action_bolus" /> - + android:label="@string/status_cpp" /> - + android:label="@string/action_confirm" + android:launchMode="singleInstance" /> - + android:label="@string/menu_prime_fill" /> - + android:label="@string/action_carbs" /> + android:label="@string/menu_tempt" /> + + + + + + + diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/RICTxWF01ConfigurationActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/RICTxWF01ConfigurationActivity.java new file mode 100644 index 0000000000..d3def6dab0 --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/configurationActivities/RICTxWF01ConfigurationActivity.java @@ -0,0 +1,42 @@ +package info.nightscout.androidaps.interaction.configurationActivities; + +import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; + +import info.nightscout.androidaps.R; +import preference.WearPreferenceActivity; + +/** + * Created by rICTx-T1D on 28/Sep/20 (see https://github.com/rICTx-T1D) + */ + +public class RICTxWF01ConfigurationActivity extends WearPreferenceActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.rictxwf01configuration); + ViewGroup view = (ViewGroup) getWindow().getDecorView(); + removeBackgroundRecursively(view); + view.setBackground(getResources().getDrawable(R.drawable.settings_background)); + } + + @Override + protected void onPause() { + super.onPause(); + finish(); + } + + void removeBackgroundRecursively(View parent) { + if (parent instanceof ViewGroup) { + ViewGroup group = (ViewGroup) parent; + for (int i = 0; i < group.getChildCount(); i++) { + removeBackgroundRecursively(group.getChildAt(i)); + } + } + parent.setBackground(null); + } + + +} diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java index 51faedeb4b..5fc144c452 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java @@ -50,7 +50,7 @@ import lecho.lib.hellocharts.view.LineChartView; public abstract class BaseWatchFace extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener { public final static IntentFilter INTENT_FILTER; public static final long[] vibratePattern = {0,400,300,400,300,400}; - public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight; + public TextView mTime, mHour, mMinute,mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight; public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand; public RelativeLayout mRelativeLayout; public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap; @@ -126,7 +126,10 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen @Override public void onLayoutInflated(WatchViewStub stub) { mTime = (TextView) stub.findViewById(R.id.watch_time); + mHour = (TextView) stub.findViewById(R.id.hour); + mMinute = (TextView) stub.findViewById(R.id.minute); mDay = (TextView) stub.findViewById(R.id.day); + mDayName= (TextView) stub.findViewById(R.id.dayname); mMonth = (TextView) stub.findViewById(R.id.month); mDate = (LinearLayout) stub.findViewById(R.id.date_time); mLoop = (TextView) stub.findViewById(R.id.loop); @@ -468,8 +471,18 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen sHour = sdfHour.format(now); sMinute = sdfMinute.format(now); + if (mHour != null && mMinute != null ) { + mHour.setText(sHour); + mMinute.setText(sMinute); + } + if (mDate != null && mDay != null && mMonth != null) { if (sharedPrefs.getBoolean("show_date", false)) { + if (mDayName != null ) { + SimpleDateFormat sdfDayName = new SimpleDateFormat("E"); + mDayName.setText(sdfDayName.format(now)); + } + SimpleDateFormat sdfDay = new SimpleDateFormat("dd"); SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM"); mDay.setText(sdfDay.format(now)); diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/RICTxWF01.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/RICTxWF01.java new file mode 100644 index 0000000000..3cb37358b7 --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/RICTxWF01.java @@ -0,0 +1,140 @@ +package info.nightscout.androidaps.watchfaces; + +import android.content.Intent; +import android.support.wearable.watchface.WatchFaceStyle; +import android.util.Log; +import android.view.LayoutInflater; +import android.widget.LinearLayout; + +import androidx.core.content.ContextCompat; + +import com.ustwo.clockwise.common.WatchMode; + +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.interaction.menus.MainMenuActivity; + +/** + * Created by rICTx-T1D on 16/Sep/20 (see https://github.com/rICTx-T1D) + */ + +public class RICTxWF01 extends BaseWatchFace { + private long chartTapTime = 0; + private long sgvTapTime = 0; + + @Override + public void onCreate() { + super.onCreate(); + LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); + layoutView = inflater.inflate(R.layout.activity_rictxwf01, null); + performViewSetup(); + } + + + @Override + protected void onTapCommand(int tapType, int x, int y, long eventTime) { + //tapType = TAP_TYPE_TAP; + Log.d("onTapCommand: DeviceWidth x DeviceHeight /// x , y, TapType >> ", Integer.toString(getWidth()) + " x " + Integer.toString(getHeight()) + " /// " + Integer.toString(x) + " , " + Integer.toString(y) + " , " + Integer.toString(tapType)); + + if (tapType == TAP_TYPE_TAP) { + if (eventTime - sgvTapTime < 800) { + Intent intent = new Intent(this, MainMenuActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + sgvTapTime = eventTime; + } + } + + + @Override + protected WatchFaceStyle getWatchFaceStyle() { + return new WatchFaceStyle.Builder(this) + .setAcceptsTapEvents(true) + .setHideNotificationIndicator(false) + .setShowUnreadCountIndicator(true) + .build(); + } + + protected void setColorDark() { + if (rawData.sgvLevel == 1) { + mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor)); + mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor)); + } else if (rawData.sgvLevel == 0) { + mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor)); + mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor)); + } else if (rawData.sgvLevel == -1) { + mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor)); + mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor)); + } + + if (ageLevel == 1) { + mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor)); + } else { + mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_TimestampOld)); + } + + if (rawData.batteryLevel == 1) { + mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor)); + } else { + mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty)); + } + + /* not be implement + if (loopLevel == 1) { + mLoop.setBackgroundResource(R.drawable.loop_green_25); + } else { + mLoop.setBackgroundResource(R.drawable.loop_red_25); + } + */ + + if (chart != null) { + highColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor); + lowColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor); + midColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor); + gridColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_gridColor); + basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); + basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light); + pointSize = 1; + setupCharts(); + } + + /* frame styles*/ + LinearLayout mShapesElements = layoutView.findViewById(R.id.shapes_elements); + if (mShapesElements != null) { + String displayFormatType = (mShapesElements.getContentDescription().toString().startsWith("round") ? "round" : "rect"); + String styleDrawableName = "rictxwf01_bg_" + sharedPrefs.getString("rictxwf01_frameStyle", "red") + "_" + displayFormatType; + Log.d("rictxwf01_frameStyle", styleDrawableName); + try { + mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName()))); + } catch (Exception e) { + Log.e("rictxwf01_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName); + } + } + + + /* ToDo Implement a configurable background image + * layoutView.setBackground(); + */ + + + /* ToDo Implement hourly vibartion + Boolean hourlyVibratePref = sharedPrefs.getBoolean("rictxwf01_vibrateHourly", false); + Log.i("hourlyVibratePref",Boolean.toString(hourlyVibratePref)); + */ + + + } + + protected void setColorLowRes() { + setColorDark(); + } + + protected void setColorBright() { + if (getCurrentWatchMode() == WatchMode.INTERACTIVE) { + setColorDark(); + } else { + setColorDark(); + } + } + +} diff --git a/wear/src/main/res/drawable/rictxwf01_bg_bluegray_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_bluegray_rect.png new file mode 100644 index 0000000000..af7d41a13d Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_bluegray_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_bluegray_round.png b/wear/src/main/res/drawable/rictxwf01_bg_bluegray_round.png new file mode 100644 index 0000000000..cc3c966874 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_bluegray_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_rect.png new file mode 100644 index 0000000000..f4d14196b1 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_round.png b/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_round.png new file mode 100644 index 0000000000..637029b708 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_deeppurple_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_indigo_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_indigo_rect.png new file mode 100644 index 0000000000..fe0629e2cd Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_indigo_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_indigo_round.png b/wear/src/main/res/drawable/rictxwf01_bg_indigo_round.png new file mode 100644 index 0000000000..d0ee9496ba Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_indigo_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_lightblue_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_lightblue_rect.png new file mode 100644 index 0000000000..997af6abc4 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_lightblue_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_lightblue_round.png b/wear/src/main/res/drawable/rictxwf01_bg_lightblue_round.png new file mode 100644 index 0000000000..3e9ef5eb15 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_lightblue_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_lime_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_lime_rect.png new file mode 100644 index 0000000000..6066ac3a0a Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_lime_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_lime_round.png b/wear/src/main/res/drawable/rictxwf01_bg_lime_round.png new file mode 100644 index 0000000000..b38e666084 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_lime_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_nostyle_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_nostyle_rect.png new file mode 100644 index 0000000000..209a438645 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_nostyle_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_nostyle_round.png b/wear/src/main/res/drawable/rictxwf01_bg_nostyle_round.png new file mode 100644 index 0000000000..209a438645 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_nostyle_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_orange_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_orange_rect.png new file mode 100644 index 0000000000..1e55275f79 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_orange_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_orange_round.png b/wear/src/main/res/drawable/rictxwf01_bg_orange_round.png new file mode 100644 index 0000000000..6b6f0446b9 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_orange_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_rainbow_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_rainbow_rect.png new file mode 100644 index 0000000000..e917a354b8 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_rainbow_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_rainbow_round.png b/wear/src/main/res/drawable/rictxwf01_bg_rainbow_round.png new file mode 100644 index 0000000000..98fbbb1701 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_rainbow_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_red_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_red_rect.png new file mode 100644 index 0000000000..f6e4761210 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_red_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_red_round.png b/wear/src/main/res/drawable/rictxwf01_bg_red_round.png new file mode 100644 index 0000000000..d1a03300e1 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_red_round.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_rect.png b/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_rect.png new file mode 100644 index 0000000000..261f6ab723 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_rect.png differ diff --git a/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_round.png b/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_round.png new file mode 100644 index 0000000000..261f6ab723 Binary files /dev/null and b/wear/src/main/res/drawable/rictxwf01_bg_simplestyle_round.png differ diff --git a/wear/src/main/res/drawable/watchface_rictxwf01.png b/wear/src/main/res/drawable/watchface_rictxwf01.png new file mode 100644 index 0000000000..e5fc1b4438 Binary files /dev/null and b/wear/src/main/res/drawable/watchface_rictxwf01.png differ diff --git a/wear/src/main/res/font/roboto_condensed_bold.ttf b/wear/src/main/res/font/roboto_condensed_bold.ttf new file mode 100644 index 0000000000..8c7a08be0b Binary files /dev/null and b/wear/src/main/res/font/roboto_condensed_bold.ttf differ diff --git a/wear/src/main/res/font/roboto_condensed_light.ttf b/wear/src/main/res/font/roboto_condensed_light.ttf new file mode 100644 index 0000000000..67e84089e8 Binary files /dev/null and b/wear/src/main/res/font/roboto_condensed_light.ttf differ diff --git a/wear/src/main/res/font/roboto_condensed_regular.ttf b/wear/src/main/res/font/roboto_condensed_regular.ttf new file mode 100644 index 0000000000..533e3999cd Binary files /dev/null and b/wear/src/main/res/font/roboto_condensed_regular.ttf differ diff --git a/wear/src/main/res/font/roboto_slab_light.ttf b/wear/src/main/res/font/roboto_slab_light.ttf new file mode 100644 index 0000000000..ccb99cd02b Binary files /dev/null and b/wear/src/main/res/font/roboto_slab_light.ttf differ diff --git a/wear/src/main/res/layout/activity_rictxwf01.xml b/wear/src/main/res/layout/activity_rictxwf01.xml new file mode 100644 index 0000000000..e70a5adad4 --- /dev/null +++ b/wear/src/main/res/layout/activity_rictxwf01.xml @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/wear/src/main/res/layout/rect_activity_rictxwf01.xml b/wear/src/main/res/layout/rect_activity_rictxwf01.xml new file mode 100644 index 0000000000..a55214dc2c --- /dev/null +++ b/wear/src/main/res/layout/rect_activity_rictxwf01.xml @@ -0,0 +1,537 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wear/src/main/res/layout/round_activity_rictxwf01.xml b/wear/src/main/res/layout/round_activity_rictxwf01.xml new file mode 100644 index 0000000000..83f522ca3e --- /dev/null +++ b/wear/src/main/res/layout/round_activity_rictxwf01.xml @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wear/src/main/res/values/rictxwf01_arrays.xml b/wear/src/main/res/values/rictxwf01_arrays.xml new file mode 100644 index 0000000000..28ca513801 --- /dev/null +++ b/wear/src/main/res/values/rictxwf01_arrays.xml @@ -0,0 +1,27 @@ + + + + Red + Purple + Indigo + Blue + Lime + Orange + BlueGray + Rainbow-Style + SIMPLE-Style + NO-Style + + + red + deeppurple + indigo + lightblue + lime + orange + bluegray + rainbow + simplestyle + nostyle + + \ No newline at end of file diff --git a/wear/src/main/res/xml/rictxwf01configuration.xml b/wear/src/main/res/xml/rictxwf01configuration.xml new file mode 100644 index 0000000000..47951661be --- /dev/null +++ b/wear/src/main/res/xml/rictxwf01configuration.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + +