SteampunkWatchface -> kt, eliminate WatchViewStub

This commit is contained in:
Milos Kozak 2022-04-23 15:29:02 +02:00
parent 0dd72922d2
commit 68c7b130fb
55 changed files with 568 additions and 735 deletions

View file

@ -84,14 +84,15 @@ class ActionsFragment : DaggerFragment() {
// This property is only valid between onCreateView and onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
//check screen width
dm = DisplayMetrics()
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
@Suppress("DEPRECATION")
activity?.display?.getRealMetrics(dm)
} else {
@Suppress("DEPRECATION") activity?.windowManager?.defaultDisplay?.getMetrics(dm)
@Suppress("DEPRECATION")
activity?.windowManager?.defaultDisplay?.getMetrics(dm)
}
_binding = ActionsFragmentBinding.inflate(inflater, container, false)
return binding.root

View file

@ -146,7 +146,7 @@
</service>
<service
android:name=".watchfaces.Steampunk"
android:name=".watchfaces.SteampunkWatchface"
android:allowEmbedded="true"
android:label="@string/label_xdrip_steampunk"
android:permission="android.permission.BIND_WALLPAPER"

View file

@ -31,7 +31,7 @@ abstract class WearServicesModule {
@ContributesAndroidInjector abstract fun contributesHome(): Home
@ContributesAndroidInjector abstract fun contributesHome2(): Home2
@ContributesAndroidInjector abstract fun contributesLargeHome(): LargeHome
@ContributesAndroidInjector abstract fun contributesSteampunk(): Steampunk
@ContributesAndroidInjector abstract fun contributesSteampunk(): SteampunkWatchface
@ContributesAndroidInjector abstract fun contributesDigitalStyle(): DigitalStyle
@ContributesAndroidInjector abstract fun contributesCockpit(): Cockpit

View file

@ -81,7 +81,7 @@ class AcceptActivity : ViewSelectorActivity() {
}
scrollView.requestFocus()
} else {
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
val returnCommand = deserialize(actionKey)

View file

@ -44,7 +44,7 @@ class BolusActivity : ViewSelectorActivity() {
container.addView(view)
view.requestFocus()
} else {
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
rxBus.send(EventWearToMobile(ActionBolusPreCheck(SafeParse.stringToDouble(editInsulin?.editText?.text.toString()), 0)))

View file

@ -47,7 +47,7 @@ class CarbActivity : ViewSelectorActivity() {
container.addView(view)
view.requestFocus()
} else {
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
// With start time 0 and duration 0

View file

@ -70,7 +70,7 @@ class ECarbActivity : ViewSelectorActivity() {
container.addView(view)
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {

View file

@ -46,7 +46,7 @@ class FillActivity : ViewSelectorActivity() {
view.requestFocus()
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
//check if it can happen that the fragment is never created that hold data?

View file

@ -66,7 +66,7 @@ class ProfileSwitchActivity : ViewSelectorActivity() {
container.addView(view)
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
//check if it can happen that the fragment is never created that hold data?

View file

@ -88,7 +88,7 @@ class TempTargetActivity : ViewSelectorActivity() {
container.addView(view)
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
//check if it can happen that the fragment is never created that hold data?

View file

@ -56,7 +56,7 @@ class TreatmentActivity : ViewSelectorActivity() {
container.addView(view)
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
//check if it can happen that the fragment is never created that hold data?

View file

@ -63,7 +63,7 @@ class WizardActivity : ViewSelectorActivity() {
container.addView(view)
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_send_item, container, false)
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
val action = ActionWizardPreCheck(

View file

@ -180,23 +180,18 @@ public class BIGChart extends WatchFace {
}
public void performViewSetup() {
final WatchViewStub stub = layoutView.findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(stub1 -> {
mTime = stub1.findViewById(R.id.watch_time);
mSgv = stub1.findViewById(R.id.sgv);
mTimestamp = stub1.findViewById(R.id.timestamp);
mDelta = stub1.findViewById(R.id.delta);
mAvgDelta = stub1.findViewById(R.id.avgdelta);
mRelativeLayout = stub1.findViewById(R.id.main_layout);
chart = stub1.findViewById(R.id.chart);
statusView = stub1.findViewById(R.id.aps_status);
layoutSet = true;
showAgeAndStatus();
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
mRelativeLayout.getMeasuredHeight());
});
mTime = layoutView.findViewById(R.id.watch_time);
mSgv = layoutView.findViewById(R.id.sgv);
mTimestamp = layoutView.findViewById(R.id.timestamp);
mDelta = layoutView.findViewById(R.id.delta);
mAvgDelta = layoutView.findViewById(R.id.avgdelta);
mRelativeLayout = layoutView.findViewById(R.id.main_layout);
chart = layoutView.findViewById(R.id.chart);
statusView = layoutView.findViewById(R.id.aps_status);
layoutSet = true;
showAgeAndStatus();
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(), mRelativeLayout.getMeasuredHeight());
rxBus.send(new EventWearToMobile(new EventData.ActionResendData("BIGChart:performViewSetup")));
wakeLock.acquire(50);
}
@ -251,6 +246,7 @@ public class BIGChart extends WatchFace {
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -71,15 +71,9 @@ public abstract class BaseWatchFace extends WatchFace {
CompositeDisposable disposable = new CompositeDisposable();
protected EventData.SingleBg singleBg = new EventData.SingleBg(0, "---", "-", "--", "--", "--"
, 0, 0.0, 0.0, 0.0, 0);
protected EventData.SingleBg singleBg = new EventData.SingleBg(0, "---", "-", "--", "--", "--", 0, 0.0, 0.0, 0.0, 0);
protected EventData.Status status = new EventData.Status("no status", "IOB", "-.--", false, "--g", "-.--U/h", "--", "--", -1, "--", false, 1);
protected EventData.TreatmentData treatmentData = new EventData.TreatmentData(
new ArrayList<>(),
new ArrayList<>(),
new ArrayList<>(),
new ArrayList<>()
);
protected EventData.TreatmentData treatmentData = new EventData.TreatmentData(new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
protected EventData.GraphData graphData = new EventData.GraphData(new ArrayList<>());
static IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
@ -174,15 +168,11 @@ public abstract class BaseWatchFace extends WatchFace {
.subscribe(event -> {
status = event;
// this event is received as last batch of data
if (isSimpleUi()) {
if (needUpdate()) {
invalidate();
}
} else {
if (!isSimpleUi() || !needUpdate()) {
setupCharts();
setDataFields();
invalidate();
}
invalidate();
})
);
@ -260,50 +250,47 @@ public abstract class BaseWatchFace extends WatchFace {
}
public void performViewSetup() {
final WatchViewStub layoutStub = layoutView.findViewById(R.id.watch_view_stub);
layoutStub.setOnLayoutInflatedListener((WatchViewStub stub) -> {
mTime = stub.findViewById(R.id.watch_time);
mHour = stub.findViewById(R.id.hour);
mMinute = stub.findViewById(R.id.minute);
mTimePeriod = stub.findViewById(R.id.timePeriod);
mDay = stub.findViewById(R.id.day);
mDayName = stub.findViewById(R.id.dayname);
mMonth = stub.findViewById(R.id.month);
mDate = stub.findViewById(R.id.date_time);
mLoop = stub.findViewById(R.id.loop);
mSgv = stub.findViewById(R.id.sgv);
mDirection = stub.findViewById(R.id.direction);
mTimestamp = stub.findViewById(R.id.timestamp);
mIOB1 = stub.findViewById(R.id.iob_text);
mIOB2 = stub.findViewById(R.id.iobView);
mCOB1 = stub.findViewById(R.id.cob_text);
mCOB2 = stub.findViewById(R.id.cobView);
mBgi = stub.findViewById(R.id.bgiView);
mStatus = stub.findViewById(R.id.externaltstatus);
mBasalRate = stub.findViewById(R.id.tmpBasal);
mUploaderBattery = stub.findViewById(R.id.uploader_battery);
mRigBattery = stub.findViewById(R.id.rig_battery);
mDelta = stub.findViewById(R.id.delta);
mAvgDelta = stub.findViewById(R.id.avgdelta);
isAAPSv2 = stub.findViewById(R.id.AAPSv2);
mHighLight = stub.findViewById(R.id.highLight);
mLowLight = stub.findViewById(R.id.lowLight);
mRelativeLayout = stub.findViewById(R.id.main_layout);
mLinearLayout = stub.findViewById(R.id.secondary_layout);
mLinearLayout2 = stub.findViewById(R.id.tertiary_layout);
mGlucoseDial = stub.findViewById(R.id.glucose_dial);
mDeltaGauge = stub.findViewById(R.id.delta_pointer);
mHourHand = stub.findViewById(R.id.hour_hand);
mMinuteHand = stub.findViewById(R.id.minute_hand);
mChartTap = stub.findViewById(R.id.chart_zoom_tap);
mMainMenuTap = stub.findViewById(R.id.main_menu_tap);
chart = stub.findViewById(R.id.chart);
mTime = layoutView.findViewById(R.id.watch_time);
mHour = layoutView.findViewById(R.id.hour);
mMinute = layoutView.findViewById(R.id.minute);
mTimePeriod = layoutView.findViewById(R.id.timePeriod);
mDay = layoutView.findViewById(R.id.day);
mDayName = layoutView.findViewById(R.id.dayname);
mMonth = layoutView.findViewById(R.id.month);
mDate = layoutView.findViewById(R.id.date_time);
mLoop = layoutView.findViewById(R.id.loop);
mSgv = layoutView.findViewById(R.id.sgv);
mDirection = layoutView.findViewById(R.id.direction);
mTimestamp = layoutView.findViewById(R.id.timestamp);
mIOB1 = layoutView.findViewById(R.id.iob_text);
mIOB2 = layoutView.findViewById(R.id.iobView);
mCOB1 = layoutView.findViewById(R.id.cob_text);
mCOB2 = layoutView.findViewById(R.id.cobView);
mBgi = layoutView.findViewById(R.id.bgiView);
mStatus = layoutView.findViewById(R.id.externaltstatus);
mBasalRate = layoutView.findViewById(R.id.tmpBasal);
mUploaderBattery = layoutView.findViewById(R.id.uploader_battery);
mRigBattery = layoutView.findViewById(R.id.rig_battery);
mDelta = layoutView.findViewById(R.id.delta);
mAvgDelta = layoutView.findViewById(R.id.avgdelta);
isAAPSv2 = layoutView.findViewById(R.id.AAPSv2);
mHighLight = layoutView.findViewById(R.id.highLight);
mLowLight = layoutView.findViewById(R.id.lowLight);
mRelativeLayout = layoutView.findViewById(R.id.main_layout);
mLinearLayout = layoutView.findViewById(R.id.secondary_layout);
mLinearLayout2 = layoutView.findViewById(R.id.tertiary_layout);
mGlucoseDial = layoutView.findViewById(R.id.glucose_dial);
mDeltaGauge = layoutView.findViewById(R.id.delta_pointer);
mHourHand = layoutView.findViewById(R.id.hour_hand);
mMinuteHand = layoutView.findViewById(R.id.minute_hand);
mChartTap = layoutView.findViewById(R.id.chart_zoom_tap);
mMainMenuTap = layoutView.findViewById(R.id.main_menu_tap);
chart = layoutView.findViewById(R.id.chart);
layoutSet = true;
setupCharts();
setDataFields();
missedReadingAlert();
});
wakeLock.acquire(50);
}

View file

@ -100,7 +100,7 @@ public class CircleWatchface extends WatchFace {
//register Message Receiver
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myLayout = inflater.inflate(R.layout.modern_layout, null);
myLayout = inflater.inflate(R.layout.activity_circle, null);
prepareLayout();
prepareDrawTime();
@ -507,6 +507,7 @@ public class CircleWatchface extends WatchFace {
addArch(canvas, (offset + .8f) * offsetMultiplier + 11, getBackgroundColor(), 360);
}
@SuppressWarnings("deprecation")
@Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
if (mSgv == null) return;

View file

@ -38,6 +38,7 @@ public class Cockpit extends BaseWatchFace {
}
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -47,6 +47,7 @@ public class DigitalStyle extends BaseWatchFace {
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this)

View file

@ -59,6 +59,7 @@ public class Home extends BaseWatchFace {
sp.putString("chart_timeframe", "" + timeframe);
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle(){
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -63,6 +63,7 @@ public class Home2 extends BaseWatchFace {
sp.putString("chart_timeframe", "" + timeframe);
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -43,6 +43,7 @@ public class LargeHome extends BaseWatchFace {
}
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle(){
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -148,24 +148,18 @@ public class NOChart extends WatchFace {
}
public void performViewSetup() {
final WatchViewStub stub = layoutView.findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(stub1 -> {
mTime = stub1.findViewById(R.id.watch_time);
mSgv = stub1.findViewById(R.id.sgv);
mTimestamp = stub1.findViewById(R.id.timestamp);
mDelta = stub1.findViewById(R.id.delta);
mAvgDelta = stub1.findViewById(R.id.avgdelta);
mRelativeLayout = stub1.findViewById(R.id.main_layout);
statusView = stub1.findViewById(R.id.aps_status);
layoutSet = true;
showAgeAndStatus();
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
mRelativeLayout.getMeasuredHeight());
});
rxBus.send(new EventWearToMobile(new EventData.ActionResendData("NOChart" +
":performViewSetup")));
mTime = layoutView.findViewById(R.id.watch_time);
mSgv = layoutView.findViewById(R.id.sgv);
mTimestamp = layoutView.findViewById(R.id.timestamp);
mDelta = layoutView.findViewById(R.id.delta);
mAvgDelta = layoutView.findViewById(R.id.avgdelta);
mRelativeLayout = layoutView.findViewById(R.id.main_layout);
statusView = layoutView.findViewById(R.id.aps_status);
layoutSet = true;
showAgeAndStatus();
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(), mRelativeLayout.getMeasuredHeight());
rxBus.send(new EventWearToMobile(new EventData.ActionResendData("NOChart:performViewSetup")));
wakeLock.acquire(50);
}
@ -204,6 +198,7 @@ public class NOChart extends WatchFace {
}
@SuppressWarnings("deprecation")
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();

View file

@ -1,279 +0,0 @@
package info.nightscout.androidaps.watchfaces;
import android.annotation.SuppressLint;
import android.content.Intent;
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 androidx.core.content.ContextCompat;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
import info.nightscout.shared.SafeParse;
/**
* 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;
@SuppressLint("InflateParams") @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 && singleBg.getTimeStamp() != 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 (!singleBg.getSgvString().equals("---")) {
float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
if (!singleBg.getGlucoseUnits().equals("-")) {
//ensure the glucose dial is the correct units
if (singleBg.getGlucoseUnits().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 (singleBg.getGlucoseUnits().equals("mmol")) {
rotationAngle = SafeParse.stringToFloat(singleBg.getSgvString()) * 18f; //convert to
// mg/dL, which is equivalent to degrees
} else {
rotationAngle = SafeParse.stringToFloat(singleBg.getSgvString()); //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)
if (lastEndDegrees == 0) lastEndDegrees = rotationAngle;
//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 (!singleBg.getAvgDelta().equals("--")) { //if a legitimate delta value is
// received,
// then...
if (singleBg.getAvgDelta().charAt(0) == '-')
deltaIsNegative = -1f; //if the delta is negative, go counter-clockwise
Float AbssAvgDelta = SafeParse.stringToFloat(singleBg.getAvgDelta().substring(1)); //get rid of the sign so it can be converted to float.
String autogranularity = "0"; //autogranularity off
//ensure the delta gauge is the right units and granularity
if (!singleBg.getGlucoseUnits().equals("-")) {
if (singleBg.getGlucoseUnits().equals("mmol")) {
if (sp.getString("delta_granularity", "2").equals("4")) { //Auto granularity
autogranularity = "1"; // low (init)
if (AbssAvgDelta < 0.3) {
autogranularity = "3"; // high if below 0.3 mmol/l
} else if (AbssAvgDelta < 0.5) {
autogranularity = "2"; // medium if below 0.5 mmol/l
}
}
if (sp.getString("delta_granularity", "2").equals("1") || autogranularity.equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10);
deltaRotationAngle = (AbssAvgDelta * 30f);
}
if (sp.getString("delta_granularity", "2").equals("2") || autogranularity.equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05);
deltaRotationAngle = (AbssAvgDelta * 60f);
}
if (sp.getString("delta_granularity", "2").equals("3") || autogranularity.equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03);
deltaRotationAngle = (AbssAvgDelta * 100f);
}
} else {
if (sp.getString("delta_granularity", "2").equals("4")) { //Auto granularity
autogranularity = "1"; // low (init)
if (AbssAvgDelta < 5) {
autogranularity = "3"; // high if below 5 mg/dl
} else if (AbssAvgDelta < 10) {
autogranularity = "2"; // medium if below 10 mg/dl
}
}
if (sp.getString("delta_granularity", "2").equals("1") || autogranularity.equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20);
deltaRotationAngle = (AbssAvgDelta * 1.5f);
}
if (sp.getString("delta_granularity", "2").equals("2") || autogranularity.equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10);
deltaRotationAngle = (AbssAvgDelta * 3f);
}
if (sp.getString("delta_granularity", "2").equals("3") || autogranularity.equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5);
deltaRotationAngle = (AbssAvgDelta * 6f);
}
}
}
if (deltaRotationAngle > 40) deltaRotationAngle = 40f;
mDeltaGauge.setRotation(deltaRotationAngle * deltaIsNegative);
}
//rotate the minute hand.
mMinuteHand.setRotation(Float.parseFloat(sMinute) * 6f);
//rotate the hour hand.
mHourHand.setRotation((Float.parseFloat(sHour) * 30f) + (Float.parseFloat(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);
if (sp.getInt("chart_timeframe", 3) < 3) {
pointSize = 2;
} else {
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 (status.getIobDetail().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 (sp.getBoolean("show_uploader_battery", true) && sp.getBoolean(
"show_rig_battery", false)) {
mUploaderBattery.setTextSize(fontSmall);
mRigBattery.setTextSize(fontSmall);
} else {
mUploaderBattery.setTextSize(fontMedium);
mRigBattery.setTextSize(fontMedium);
}
}
private void changeChartTimeframe() {
int timeframe = sp.getInt("chart_timeframe", 3);
timeframe = (timeframe % 5) + 1;
if (timeframe < 3) {
pointSize = 2;
} else {
pointSize = 1;
}
setupCharts();
sp.putString("chart_timeframe", "" + timeframe);
}
}

View file

@ -0,0 +1,248 @@
@file:Suppress("DEPRECATION")
package info.nightscout.androidaps.watchfaces
import android.annotation.SuppressLint
import android.content.Intent
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 androidx.core.content.ContextCompat
import info.nightscout.androidaps.R
import info.nightscout.androidaps.interaction.menus.MainMenuActivity
import info.nightscout.shared.SafeParse.stringToFloat
/**
* Created by andrew-warrington on 01/12/2017.
* Refactored by MilosKozak on 23/04/2022
*/
class SteampunkWatchface : BaseWatchFace() {
private var chartTapTime: Long = 0
private var mainMenuTapTime: Long = 0
private var lastEndDegrees = 0f
private var deltaRotationAngle = 0f
@SuppressLint("InflateParams")
override fun onCreate() {
forceSquareCanvas = true
super.onCreate()
val inflater = getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
layoutView = inflater.inflate(R.layout.activity_steampunk, null)
performViewSetup()
}
override fun onTapCommand(tapType: Int, x: Int, y: Int, eventTime: Long) {
if (tapType == TAP_TYPE_TAP && x >= mChartTap.left && x <= mChartTap.right && y >= mChartTap.top && y <= mChartTap.bottom) {
if (eventTime - chartTapTime < 800) {
changeChartTimeframe()
}
chartTapTime = eventTime
} else if (tapType == TAP_TYPE_TAP && x >= mMainMenuTap.left && x <= mMainMenuTap.right && y >= mMainMenuTap.top && y <= mMainMenuTap.bottom) {
if (eventTime - mainMenuTapTime < 800) {
startActivity(Intent(this, MainMenuActivity::class.java).also { it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) })
}
mainMenuTapTime = eventTime
}
}
override fun getWatchFaceStyle(): WatchFaceStyle {
return WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build()
}
override fun setColorDark() {
if (mLinearLayout2 != null) {
if (ageLevel() <= 0 && singleBg.timeStamp != 0L) {
mLinearLayout2.setBackgroundResource(R.drawable.redline)
mTimestamp.setTextColor(ContextCompat.getColor(this, R.color.red_600))
} else {
mLinearLayout2.setBackgroundResource(0)
mTimestamp.setTextColor(ContextCompat.getColor(this, R.color.black_86p))
}
}
if (loopLevel == 0) {
mLoop?.setTextColor(ContextCompat.getColor(this, R.color.red_600))
} else {
mLoop?.setTextColor(ContextCompat.getColor(this, R.color.black_86p))
}
if (singleBg.sgvString != "---") {
var rotationAngle = 0f //by default, show ? on the dial (? is at 0 degrees on the dial)
if (singleBg.glucoseUnits != "-") {
//ensure the glucose dial is the correct units
if (singleBg.glucoseUnits == "mmol") {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mmol)
} else {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mgdl)
}
//convert the Sgv to degrees of rotation
rotationAngle = if (singleBg.glucoseUnits == "mmol") {
stringToFloat(singleBg.sgvString) * 18f //convert to
// mg/dL, which is equivalent to degrees
} else {
stringToFloat(singleBg.sgvString) //if glucose a value is received, use it to determine the amount of rotation of the dial.
}
}
if (rotationAngle > 330) rotationAngle = 330f //if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
if (rotationAngle != 0f && rotationAngle < 30) rotationAngle = 30f //if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
if (lastEndDegrees == 0f) lastEndDegrees = rotationAngle
//rotate glucose dial
val rotate = RotateAnimation(
lastEndDegrees, rotationAngle - lastEndDegrees,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
)
rotate.fillAfter = true
rotate.interpolator = LinearInterpolator()
rotate.duration = 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
var deltaIsNegative = 1f //by default go clockwise
if (singleBg.avgDelta != "--") { //if a legitimate delta value is
// received,
// then...
if (singleBg.avgDelta[0] == '-') deltaIsNegative = -1f //if the delta is negative, go counter-clockwise
val absAvgDelta = stringToFloat(singleBg.avgDelta.substring(1)) //get rid of the sign so it can be converted to float.
var autoGranularity = "0" //auto-granularity off
//ensure the delta gauge is the right units and granularity
if (singleBg.glucoseUnits != "-") {
if (singleBg.glucoseUnits == "mmol") {
if (sp.getString("delta_granularity", "2") == "4") { //Auto granularity
autoGranularity = "1" // low (init)
if (absAvgDelta < 0.3) {
autoGranularity = "3" // high if below 0.3 mmol/l
} else if (absAvgDelta < 0.5) {
autoGranularity = "2" // medium if below 0.5 mmol/l
}
}
if (sp.getString("delta_granularity", "2") == "1" || autoGranularity == "1") { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10)
deltaRotationAngle = absAvgDelta * 30f
}
if (sp.getString("delta_granularity", "2") == "2" || autoGranularity == "2") { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05)
deltaRotationAngle = absAvgDelta * 60f
}
if (sp.getString("delta_granularity", "2") == "3" || autoGranularity == "3") { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03)
deltaRotationAngle = absAvgDelta * 100f
}
} else {
if (sp.getString("delta_granularity", "2") == "4") { //Auto granularity
autoGranularity = "1" // low (init)
if (absAvgDelta < 5) {
autoGranularity = "3" // high if below 5 mg/dl
} else if (absAvgDelta < 10) {
autoGranularity = "2" // medium if below 10 mg/dl
}
}
if (sp.getString("delta_granularity", "2") == "1" || autoGranularity == "1") { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20)
deltaRotationAngle = absAvgDelta * 1.5f
}
if (sp.getString("delta_granularity", "2") == "2" || autoGranularity == "2") { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10)
deltaRotationAngle = absAvgDelta * 3f
}
if (sp.getString("delta_granularity", "2") == "3" || autoGranularity == "3") { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5)
deltaRotationAngle = absAvgDelta * 6f
}
}
}
if (deltaRotationAngle > 40) deltaRotationAngle = 40f
mDeltaGauge.rotation = deltaRotationAngle * deltaIsNegative
}
//rotate the minute hand.
mMinuteHand.rotation = sMinute.toFloat() * 6f
//rotate the hour hand.
mHourHand.rotation = sHour.toFloat() * 30f + sMinute.toFloat() * 0.5f
setTextSizes()
mLoop?.setBackgroundResource(0)
if (chart != null) {
highColor = ContextCompat.getColor(this, R.color.black)
lowColor = ContextCompat.getColor(this, R.color.black)
midColor = ContextCompat.getColor(this, R.color.black)
gridColor = ContextCompat.getColor(this, R.color.grey_steampunk)
basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
pointSize = if (sp.getInt("chart_timeframe", 3) < 3) {
2
} else {
1
}
setupCharts()
}
invalidate()
}
override fun setColorLowRes() {
setColorDark()
}
override fun setColorBright() {
setColorDark()
}
private fun setTextSizes() {
var fontSmall = 10f
var fontMedium = 11f
var fontLarge = 12f
if (bIsRound) {
fontSmall = 11f
fontMedium = 12f
fontLarge = 13f
}
//top row. large font unless text too big (i.e. detailedIOB)
mCOB2.textSize = fontLarge
mBasalRate.textSize = fontLarge
if (status.iobDetail.length < 7) {
mIOB2.textSize = fontLarge
} else {
mIOB2.textSize = fontSmall
}
//bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
if (mTimestamp.text.length < 3 || mLoop.text.length < 3) { //always resize these fields together, for symmetry.
mTimestamp.textSize = fontMedium
mLoop.textSize = fontMedium
} else {
mTimestamp.textSize = fontSmall
mLoop.textSize = fontSmall
}
//if both batteries are shown, make them smaller.
if (sp.getBoolean("show_uploader_battery", true) && sp.getBoolean(
"show_rig_battery", false
)
) {
mUploaderBattery.textSize = fontSmall
mRigBattery.textSize = fontSmall
} else {
mUploaderBattery.textSize = fontMedium
mRigBattery.textSize = fontMedium
}
}
private fun changeChartTimeframe() {
var timeframe = sp.getInt("chart_timeframe", 3)
timeframe = timeframe % 5 + 1
pointSize = if (timeframe < 3) {
2
} else {
1
}
setupCharts()
sp.putString("chart_timeframe", "" + timeframe)
}
}

View file

@ -1,116 +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_marginEnd="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_marginStart="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_marginEnd="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>
<?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_marginEnd="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_marginStart="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_marginEnd="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

@ -4,7 +4,7 @@
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:context=".watchfaces.SteampunkWatchface"
tools:deviceIds="wear_square">
<LinearLayout

View file

@ -1,116 +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_marginEnd="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_marginStart="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_marginEnd="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>
<?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_marginEnd="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_marginStart="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_marginEnd="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

@ -4,7 +4,7 @@
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:context=".watchfaces.SteampunkWatchface"
tools:deviceIds="wear_round">
<LinearLayout

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +0,0 @@
<?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

@ -1,12 +0,0 @@
<?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"/>