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

Watchface #7

Open
GreatApo opened this issue Jul 25, 2018 · 4 comments
Open

Watchface #7

GreatApo opened this issue Jul 25, 2018 · 4 comments

Comments

@GreatApo
Copy link

This project can also include a watchface.

The data must be saved in a system value (and be updated) and then the watchface can show them. The only problem is the update interval (the locked screen updates in specific cases). A work around could be updating the watchface every time calories,heart rate or weather is updated...

@Klaus3d3
Copy link
Owner

Thats good to hear. Sadly beside copying all files from your Greatfit Watchface into my project, i don't know where to start.

@GreatApo
Copy link
Author

I am already working on the documentation...

If you want to experiment a little, edit the following file, this is where AM/PM is shown (wifi/BT status are in development too):
java/com/dinodevs/greatfitwatchface/widget/GreatWidget.java

"init" runs once when the watchface is selected and then screen-on is constantly refreshed through the "draw" function. On the other hand, screen-off is made through "buildSlptViewComponent". Data are refreshed in "onDataUpdate" (when screen is on "draw" is constantly refreshed but when screen is off the refresh is not constant).

There are 2 ways to show your data. You either save them through your widget somewhere (for example in Settings.System, if possible and then you load them like on line 63) and you just get them and show them OR you directly connect to your phone through the watchface (like your widget does). I recomend the first option.

So, you somehow get the data you want to display in a variable and then in "draw" function you just draw them on the canvas, ex:

canvas.drawText("my data", 10, 10, textPaint); //numbers are left and top positions, leave textPaint or define a new font-size etc

In order for your data to be updated, you have to re-save the new data (if any) in the variable they are saved through "onDataUpdate" function.

Screen off is a little more complicated. Start with the screen-on and i can help you then with the locked screen.

@Klaus3d3
Copy link
Owner

Ha, even copying your files seems to be very complicate :-(

@Klaus3d3
Copy link
Owner

atm i'm trying to write and read from settings

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

No branches or pull requests

2 participants