Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget for Galaxy Gear S2/3 watchface using Wearable Widgets #47

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

dwallersv
Copy link

Implemented a second widget for use with the Wearable Widgets application to display BG information and trend graph with prominent time/date displayed.

Cleaned up a few typos encountered while coding.

Redesigned WidgetUpdateService to reliably handle system clock ticks (minute boundaries) so that Gear Widget time stays minute-accurate.

Added new home screen widget designed to be used with Wearable Widgets as a watch face for the Samsung Galaxy Gear 2/3 smartwatch.
Cleaned up logic of WidgetUpdateService to always run and capture clock ticks. This is necessary to keep the time accurate on the widget.
further improved startup logic to make tick capture fully reliable.
minor alignment adjustments
modified slopeToArrowSymbol to add intermediate indexing function -- future use in selecting arrow images  on gear widget
method ReadPerfs => ReadPrefs
added slight dimmed alpha bkgd for time/date and BG readings so graph line doesn't interfere with readability when it's behind the letters
@jamorham
Copy link
Owner

Hi there, thanks for this. I haven't reviewed the code in any detail yet and I will likely have more questions. But at the moment it appears there is a merge conflict because of refactoring which has occurred to the master branch after your made your fork. The test which fails so far is that the static preferences reading has been moved to its own Pref class.

You should either try to merge the upstream master and update your code accordingly or simply add the Pref class to your tree and change the failing bits of code which still access it when it used to be inside Home

@dwallersv
Copy link
Author

dwallersv commented Jan 31, 2018 via email

@dwallersv
Copy link
Author

merged the current upstream master, made the changes for the Pref class refactor. Built, tested. I'll keep watch to see if it passes the automated tests.

@dwallersv dwallersv closed this Jan 31, 2018
@dwallersv dwallersv reopened this Jan 31, 2018
@@ -55,61 +35,41 @@ public WidgetUpdateService() {}

@Override
public void onCreate() {
context = getApplicationContext();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't store the application context in a static field here, just use xdrip.getAppContext() if you need it from static, otherwise just store it in a local variable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make the change.

}
}

public static String slopeToArrowSymbol(double slope) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the reason for refactoring this method?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The up-right and down-right arrow symbols from the font are visually very different than the normal up, down, and right arrows. I did this refactoring in preparation to add some pure images for the arrows, and was going to refactor the gear widget to use them. Never got around to finishing it, but I intend to in the near future.

I've got the code in a local branch, I'll remove it for now so it's not confusing.

@@ -46,6 +47,10 @@
public void onCreate() {
xdrip.context = getApplicationContext();
super.onCreate();

//start widget update service to capture time ticks
this.startService(new Intent(this, WidgetUpdateService.class));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem because its going to enable the service even if no widgets are active. How about I make a new preference option in Smart Watch Features for Galaxy Gear / Wearable Widgets with an option users can enable. We can then make this early start conditional on that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to add another setting for this. The existence of Gear widgets can be determined dynamically, so the service (and the clock tick event) can be handled properly.

Frankly, I was too focused on the Gear widget when I was doing this that I forgot about making sure the original widget was being handled properly. More in the next comment...

Log.d(TAG, "enableClockTicks");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_TIME_TICK);
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks from the diff like this will always be listening for clock ticks. This isn't good for anyone who isn't using wearable widgets from a power saving point of view so I would suggest that the original behavior is restored but with it always enabling listening for clock ticks when the wearable widgets preference item I suggested is enabled. I can add that item in today so you have something to work with easily.

@jamorham
Copy link
Owner

jamorham commented Feb 2, 2018

Thanks for submitting this. I know there are gear users who are looking for this feature.

I have added some by line questions where I think changes are needed. In the CONTRIBUTING.md file there is a section about impacts on existing functionality and controlling changes to behavior with a preference switch. The changes I'm looking for are really down to this. The effect that merging this would have on users who are not part of this use case, eg not using wearable widgets.

I plan to add the preference item later today so you can hook on to that for the changes.

@abutmim
Copy link

abutmim commented Jul 14, 2018

Widget for Galaxy Gear S2/3 watchface using Wearable Widgets

is it available?

@abutmim
Copy link

abutmim commented Jul 24, 2018

how can I show time in the Widget in Galaxy Gear S2/3 watchface using Wearable Widgets ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants