Merge branch 'dev' into smb060

This commit is contained in:
Milos Kozak 2018-01-03 21:22:38 +01:00
commit 230ec7177b
27 changed files with 1141 additions and 35 deletions

View file

@ -0,0 +1,7 @@
Follow this link to get the source PSD file for the Steampunk graphics. The file could not be included in the repository as it exceeds Github's 25 mb limit.
Note, the source image size is 1600x1600. The image size should be reduced to 400x400 prior to export of final PNG.
https://drive.google.com/drive/folders/1MrdgnQz3wOniDvRSMhAsqHBYb2WmE5i0
Graphics created by (Github): andrew-warrington

View file

@ -11,6 +11,7 @@ import android.graphics.Paint;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
@ -1342,7 +1343,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
secondGraphData.addNowLine(now); secondGraphData.addNowLine(now);
// do GUI update // do GUI update
getActivity().runOnUiThread(new Runnable() { FragmentActivity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked() || Config.displayDeviationSlope) { if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked() || Config.displayDeviationSlope) {
@ -1350,13 +1353,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else { } else {
iobGraph.setVisibility(View.GONE); iobGraph.setVisibility(View.GONE);
} }
// finaly enforce drawing of graphs // finally enforce drawing of graphs
graphData.performUpdate(); graphData.performUpdate();
secondGraphData.performUpdate(); secondGraphData.performUpdate();
Profiler.log(log, from + " - onDataChanged", updateGUIStart); Profiler.log(log, from + " - onDataChanged", updateGUIStart);
} }
}); });
} }
}
}).start(); }).start();
Profiler.log(log, from, updateGUIStart); Profiler.log(log, from, updateGUIStart);

View file

@ -243,6 +243,7 @@ public class WatchUpdaterService extends WearableListenerService implements
DataMap dataMap = new DataMap(); DataMap dataMap = new DataMap();
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units)); dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
dataMap.putString("glucoseUnits", units);
dataMap.putLong("timestamp", lastBG.date); dataMap.putLong("timestamp", lastBG.date);
if (glucoseStatus == null) { if (glucoseStatus == null) {
dataMap.putString("slopeArrow", ""); dataMap.putString("slopeArrow", "");
@ -253,7 +254,6 @@ public class WatchUpdaterService extends WearableListenerService implements
dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)); dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units));
dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units)); dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
} }
dataMap.putLong("sgvLevel", sgvLevel); dataMap.putLong("sgvLevel", sgvLevel);
dataMap.putDouble("sgvDouble", lastBG.value); dataMap.putDouble("sgvDouble", lastBG.value);
dataMap.putDouble("high", highLine); dataMap.putDouble("high", highLine);

View file

@ -111,6 +111,25 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".watchfaces.Steampunk"
android:allowEmbedded="true"
android:label="AAPS(Steampunk)"
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_steampunk" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service <service
android:name=".watchfaces.LargeHome" android:name=".watchfaces.LargeHome"
android:allowEmbedded="true" android:allowEmbedded="true"

View file

@ -21,6 +21,7 @@ import android.view.Display;
import android.view.View; import android.view.View;
import android.view.WindowInsets; import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -44,15 +45,17 @@ import lecho.lib.hellocharts.view.LineChartView;
/** /**
* Created by emmablack on 12/29/14. * Created by emmablack on 12/29/14.
* Updated by andrew-warrington on 11/15/17. * Updated by andrew-warrington on 02-Jan-2018.
*/ */
public abstract class BaseWatchFace extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener { public abstract class BaseWatchFace extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
public final static IntentFilter INTENT_FILTER; public final static IntentFilter INTENT_FILTER;
public static final long[] vibratePattern = {0,400,300,400,300,400}; 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, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight;
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
public long datetime; public long datetime;
public RelativeLayout mRelativeLayout; public RelativeLayout mRelativeLayout;
public LinearLayout mLinearLayout, mLinearLayout2, mDate; public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap;
public long sgvLevel = 0; public long sgvLevel = 0;
public int ageLevel = 1; public int ageLevel = 1;
public int loopLevel = 1; public int loopLevel = 1;
@ -85,6 +88,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public boolean detailedIOB = false; public boolean detailedIOB = false;
public boolean showBGI = false; public boolean showBGI = false;
public boolean forceSquareCanvas = false; //set to true by the Steampunk watch face.
public long openApsStatus; public long openApsStatus;
public String externalStatusString = "no status"; public String externalStatusString = "no status";
public String sSgv = "---"; public String sSgv = "---";
@ -99,21 +103,24 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public String sCOB1 = "Carb"; public String sCOB1 = "Carb";
public String sCOB2 = "--g"; public String sCOB2 = "--g";
public String sBgi = "--"; public String sBgi = "--";
public String sMinute = "0";
public String sHour = "0";
public String sUnits = "-";
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)) Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
.getDefaultDisplay();
display.getSize(displaySize); display.getSize(displaySize);
wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Clock"); wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Clock");
specW = View.MeasureSpec.makeMeasureSpec(displaySize.x, specW = View.MeasureSpec.makeMeasureSpec(displaySize.x, View.MeasureSpec.EXACTLY);
View.MeasureSpec.EXACTLY); if (forceSquareCanvas) {
specH = View.MeasureSpec.makeMeasureSpec(displaySize.y, specH = specW;
View.MeasureSpec.EXACTLY); } else {
sharedPrefs = PreferenceManager specH = View.MeasureSpec.makeMeasureSpec(displaySize.y, View.MeasureSpec.EXACTLY);
.getDefaultSharedPreferences(this); }
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
sharedPrefs.registerOnSharedPreferenceChangeListener(this); sharedPrefs.registerOnSharedPreferenceChangeListener(this);
} }
@ -160,10 +167,17 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout); mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout);
mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout); mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout);
mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout); mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout);
mGlucoseDial = (ImageView) stub.findViewById(R.id.glucose_dial);
mDeltaGauge = (ImageView) stub.findViewById(R.id.delta_pointer);
mHourHand = (ImageView) stub.findViewById(R.id.hour_hand);
mMinuteHand = (ImageView) stub.findViewById(R.id.minute_hand);
mChartTap = (LinearLayout) stub.findViewById(R.id.chart_zoom_tap);
mMainMenuTap = (LinearLayout) stub.findViewById(R.id.main_menu_tap);
chart = (LineChartView) stub.findViewById(R.id.chart); chart = (LineChartView) stub.findViewById(R.id.chart);
layoutSet = true; layoutSet = true;
setDataFields(); setDataFields();
setColor();
} }
} }
); );
@ -214,7 +228,14 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
if (layoutSet) { if (layoutSet) {
setupCharts(); setupCharts();
this.mRelativeLayout.draw(canvas);
mRelativeLayout.measure(specW, specH);
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
mRelativeLayout.draw(canvas);
Log.d("onDraw", "draw"); Log.d("onDraw", "draw");
} }
} }
@ -225,11 +246,16 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
wakeLock.acquire(50); wakeLock.acquire(50);
setDataFields(); setDataFields();
setColor();
missedReadingAlert(); missedReadingAlert();
mRelativeLayout.measure(specW, specH); mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(), if (forceSquareCanvas) {
mRelativeLayout.getMeasuredHeight()); mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
invalidate();
} }
} }
@ -247,6 +273,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
sDirection = dataMap.getString("slopeArrow"); sDirection = dataMap.getString("slopeArrow");
sDelta = dataMap.getString("delta"); sDelta = dataMap.getString("delta");
sAvgDelta = dataMap.getString("avgDelta"); sAvgDelta = dataMap.getString("avgDelta");
sUnits = dataMap.getString("glucoseUnits");
if (chart != null) { if (chart != null) {
addToWatchSet(dataMap); addToWatchSet(dataMap);
setupCharts(); setupCharts();
@ -273,6 +300,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
} }
setDataFields(); setDataFields();
setColor();
bundle = intent.getBundleExtra("basals"); bundle = intent.getBundleExtra("basals");
if (layoutSet && bundle != null) { if (layoutSet && bundle != null) {
@ -282,10 +310,12 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
} }
mRelativeLayout.measure(specW, specH); mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(), if (forceSquareCanvas) {
mRelativeLayout.getMeasuredHeight()); mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
invalidate(); invalidate();
setColor();
} }
} }
@ -476,15 +506,22 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public void setDateAndTime() { public void setDateAndTime() {
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this); final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
if (mTime != null) {
mTime.setText(timeFormat.format(System.currentTimeMillis())); mTime.setText(timeFormat.format(System.currentTimeMillis()));
}
Date now = new Date();
SimpleDateFormat sdfHour = new SimpleDateFormat("HH");
SimpleDateFormat sdfMinute = new SimpleDateFormat("mm");
sHour = sdfHour.format(now);
sMinute = sdfMinute.format(now);
if (mDate != null && mDay != null && mMonth != null) { if (mDate != null && mDay != null && mMonth != null) {
if (sharedPrefs.getBoolean("show_date", false)) { if (sharedPrefs.getBoolean("show_date", false)) {
Date today = new Date();
SimpleDateFormat sdfDay = new SimpleDateFormat("dd"); SimpleDateFormat sdfDay = new SimpleDateFormat("dd");
SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM"); SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM");
mDay.setText(sdfDay.format(today)); mDay.setText(sdfDay.format(now));
mMonth.setText(sdfMonth.format(today)); mMonth.setText(sdfMonth.format(now));
mDate.setVisibility(View.VISIBLE); mDate.setVisibility(View.VISIBLE);
} else { } else {
mDate.setVisibility(View.GONE); mDate.setVisibility(View.GONE);
@ -534,6 +571,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
if(layoutSet){ if(layoutSet){
setDataFields(); setDataFields();
setColor();
} }
invalidate(); invalidate();
} }

View file

@ -146,7 +146,7 @@ public class BgGraphBuilder {
for (TempWatchData twd: tempWatchDataList) { for (TempWatchData twd: tempWatchDataList) {
if(twd.endTime > start_time) { if(twd.endTime > start_time) {
lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?3:2)); lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?(pointSize+1):pointSize));
if(highlight){ if(highlight){
lines.add(tempValuesLine(twd, (float) minChart, factor, true, 1)); lines.add(tempValuesLine(twd, (float) minChart, factor, true, 1));
} }

View file

@ -0,0 +1,243 @@
package info.nightscout.androidaps.watchfaces;
import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.support.wearable.watchface.WatchFaceStyle;
import android.view.LayoutInflater;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
/**
* Created by andrew-warrington on 01/12/2017.
*/
public class Steampunk extends BaseWatchFace {
private long chartTapTime = 0;
private long mainMenuTapTime = 0;
private float lastEndDegrees = 0f;
private float deltaRotationAngle = 0f;
@Override
public void onCreate() {
forceSquareCanvas = true;
super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_steampunk, null);
performViewSetup();
}
@Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
if (tapType == TAP_TYPE_TAP&&
x >= mChartTap.getLeft() &&
x <= mChartTap.getRight()&&
y >= mChartTap.getTop() &&
y <= mChartTap.getBottom()){
if (eventTime - chartTapTime < 800){
changeChartTimeframe();
}
chartTapTime = eventTime;
} else if (tapType == TAP_TYPE_TAP&&
x >= mMainMenuTap.getLeft() &&
x <= mMainMenuTap.getRight()&&
y >= mMainMenuTap.getTop() &&
y <= mMainMenuTap.getBottom()){
if (eventTime - mainMenuTapTime < 800){
Intent intent = new Intent(this, MainMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
mainMenuTapTime = eventTime;
}
}
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
}
protected void setColorDark() {
if (mLinearLayout2 != null) {
if (ageLevel() <= 0) {
mLinearLayout2.setBackgroundResource(R.drawable.redline);
mTimestamp.setTextColor(getResources().getColor(R.color.red_600));
} else {
mLinearLayout2.setBackgroundResource(0);
mTimestamp.setTextColor(getResources().getColor(R.color.black_86p));
}
}
if (mLoop != null) {
if (loopLevel == 0) {
mLoop.setTextColor(getResources().getColor(R.color.red_600));
} else {
mLoop.setTextColor(getResources().getColor(R.color.black_86p));
}
}
if (!sSgv.equals("---")) {
float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
if (!sUnits.equals("-")) {
//ensure the glucose dial is the correct units
if (sUnits.equals("mmol")) {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mmol);
} else {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mgdl);
}
//convert the Sgv to degrees of rotation
if (sUnits.equals("mmol")) {
rotationAngle = Float.valueOf(sSgv) * 18f; //convert to mg/dL, which is equivalent to degrees
} else {
rotationAngle = Float.valueOf(sSgv); //if glucose a value is received, use it to determine the amount of rotation of the dial.
}
}
if (rotationAngle > 330) rotationAngle = 330; //if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
if (rotationAngle != 0 && rotationAngle < 30) rotationAngle = 30; //if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
//rotate glucose dial
RotateAnimation rotate = new RotateAnimation(
lastEndDegrees, rotationAngle - lastEndDegrees,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setFillAfter(true);
rotate.setInterpolator(new LinearInterpolator());
rotate.setDuration(1);
mGlucoseDial.startAnimation(rotate);
lastEndDegrees = rotationAngle; //store the final angle as a starting point for the next rotation.
}
//set the delta gauge and rotate the delta pointer
float deltaIsNegative = 1f; //by default go clockwise
if (!sAvgDelta.equals("--")) { //if a legitimate delta value is received, then...
if (sAvgDelta.substring(0,1).equals("-")) deltaIsNegative = -1f; //if the delta is negative, go counter-clockwise
//ensure the delta gauge is the right units and granularity
if (!sUnits.equals("-")) {
if (sUnits.equals("mmol")) {
if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 30f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 60f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 100f); //get rid of the sign so it can be converted to float.
}
} else {
if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 1.5f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 3f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 6f); //get rid of the sign so it can be converted to float.
}
}
}
if (deltaRotationAngle > 40) deltaRotationAngle = 40f;
mDeltaGauge.setRotation(deltaRotationAngle * deltaIsNegative);
}
//rotate the minute hand.
mMinuteHand.setRotation(Float.valueOf(sMinute) * 6f);
//rotate the hour hand.
mHourHand.setRotation((Float.valueOf(sHour) * 30f) + (Float.valueOf(sMinute) * 0.5f));
setTextSizes();
if (mLoop != null) {
mLoop.setBackgroundResource(0);
}
if (chart != null) {
highColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
pointSize = 1;
setupCharts();
}
invalidate();
}
protected void setColorLowRes() {
setColorDark();
}
protected void setColorBright() {
setColorDark();
}
protected void setTextSizes() {
float fontSmall = 10f;
float fontMedium = 11f;
float fontLarge = 12f;
if (bIsRound) {
fontSmall = 11f;
fontMedium = 12f;
fontLarge = 13f;
}
//top row. large font unless text too big (i.e. detailedIOB)
mCOB2.setTextSize(fontLarge);
mBasalRate.setTextSize(fontLarge);
if (sIOB2.length() < 7) {
mIOB2.setTextSize(fontLarge);
} else {
mIOB2.setTextSize(fontSmall);
}
//bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
if (mTimestamp.getText().length() < 3 || mLoop.getText().length() < 3) { //always resize these fields together, for symmetry.
mTimestamp.setTextSize(fontMedium);
mLoop.setTextSize(fontMedium);
} else {
mTimestamp.setTextSize(fontSmall);
mLoop.setTextSize(fontSmall);
}
//if both batteries are shown, make them smaller.
if (sharedPrefs.getBoolean("show_uploader_battery", true) && sharedPrefs.getBoolean("show_rig_battery", false)) {
mUploaderBattery.setTextSize(fontSmall);
mRigBattery.setTextSize(fontSmall);
} else {
mUploaderBattery.setTextSize(fontMedium);
mRigBattery.setTextSize(fontMedium);
}
}
private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

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_steampunk"
app:roundLayout="@layout/round_steampunk"
tools:context=".watchfaces.Cockpit"
tools:deviceIds="wear"/>

View file

@ -0,0 +1,381 @@
<?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:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:deviceIds="wear_square">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/glucose_dial"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/steampunk_dial_mgdl" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/delta_pointer"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.69"
android:gravity="center"
android:src="@drawable/steampunk_pointer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.7"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.05"
android:gravity="center"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.26"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.16"
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="7dp"
android:rotation="-28"
android:text="--g"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.24"
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="12dp"
android:rotation="-1"
android:text="-.--U/h"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="6dp"
android:rotation="28"
android:text="0.00U"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.27"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03"
android:orientation="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.15"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.21"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingEnd="8dp"
android:paddingTop="8dp"
android:rotation="-24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.12"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/rig_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingTop="8dp"
android:rotation="24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.64"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/cover_plate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steampunk_cover_plate"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/hour_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:rotation="0"
android:src="@drawable/steampunk_hour_hand" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/minute_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:src="@drawable/steampunk_minute_hand" />
</LinearLayout>
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -0,0 +1,381 @@
<?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:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:deviceIds="wear_round">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/glucose_dial"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/steampunk_dial_mgdl" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/delta_pointer"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.69"
android:gravity="center"
android:src="@drawable/steampunk_pointer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.7"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.05"
android:gravity="center"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.26"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="7dp"
android:rotation="-28"
android:text="--g"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.27"
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="14dp"
android:rotation="0"
android:text="-.--U/h"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="6dp"
android:rotation="28"
android:text="0.00U"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.27"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03"
android:orientation="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.15"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.21"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingEnd="8dp"
android:paddingTop="8dp"
android:rotation="-24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.12"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/rig_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingTop="8dp"
android:rotation="24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.64"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/cover_plate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steampunk_cover_plate"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/hour_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:rotation="0"
android:src="@drawable/steampunk_hour_hand" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/minute_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:src="@drawable/steampunk_minute_hand" />
</LinearLayout>
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -61,6 +61,7 @@
<color name="grey_50">#FAFAFA</color> <color name="grey_50">#FAFAFA</color>
<color name="grey_300">#E0E0E0</color> <color name="grey_300">#E0E0E0</color>
<color name="grey_500">#9E9E9E</color> <color name="grey_500">#9E9E9E</color>
<color name="grey_steampunk">#333333</color>
<!-- Grey --> <!-- Grey -->
<!-- Blue Grey --> <!-- Blue Grey -->

View file

@ -20,6 +20,18 @@
<item>5</item> <item>5</item>
</string-array> </string-array>
<string-array name="delta_granularity">
<item>Low</item>
<item>Medium</item>
<item>High</item>
</string-array>
<string-array name="delta_granularity_values">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="input_design"> <string-array name="input_design">
<item>Default</item> <item>Default</item>
<item>Quick righty</item> <item>Quick righty</item>

View file

@ -141,6 +141,14 @@
android:summary="Input Design" android:summary="Input Design"
android:title="Input Design" /> android:title="Input Design" />
<ListPreference
android:defaultValue="2"
android:entries="@array/delta_granularity"
android:entryValues="@array/delta_granularity_values"
android:key="delta_granularity"
android:summary="Delta Granularity (Steampunk)"
android:title="Delta Granularity (Steampunk)" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="showBigNumbers" android:key="showBigNumbers"