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

Integrate color picker into PineTimeStyle watchface #718

Merged
merged 27 commits into from
Dec 30, 2021

Conversation

kieranc
Copy link
Contributor

@kieranc kieranc commented Oct 3, 2021

This PR aims to move the color picker functionality into the watchface, to avoid cluttering the settings list and potentially add color settings to other watchfaces.
The settings are now accessed with a long tap on the watchface, which shows a button - if the button is pressed within the timeout (currently 5 seconds), the color picker interface is loaded and can be used to change the colors as before. Otherwise the button disappears, this is to hopefully avoid accidental activation.
I plan to add a bit of logic to change the step gauge needle color depending on the background to fix #656 but I'm having a bit of trouble with my dev watch so I thought I'd create this PR to get some more eyes on the code first.

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

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

Looks good. I like this being integrated with the watch face a lot better. The way the buttons appear and disappear probably due to the way the screen is refreshed is interesting.

Seems like going to the settings and swiping to a nonexistent third page crashes the firmware though.

src/displayapp/screens/PineTimeStyle.cpp Show resolved Hide resolved
src/displayapp/screens/PineTimeStyle.cpp Outdated Show resolved Hide resolved
@kieranc
Copy link
Contributor Author

kieranc commented Oct 4, 2021

Thanks for your input Riku, I'm going to sort the gauge needle color later but I have noticed something of a bug if double tap to wake is enabled and I tap the buttons too fast, it turns the display off..
I've removed the 3rd screen from Settings.h which should resolve the crash.

@Riksu9000
Copy link
Contributor

Doubletapping on the watchface puts the watch to sleep. I believe this can be disabled by returning true in OnTouchEvent() when the gesture is doubletap and the buttons are visible.

PushMessageToSystemTask(System::Messages::GoToSleep);

@geekbozu geekbozu marked this pull request as draft October 4, 2021 17:15
@geekbozu geekbozu added enhancement Enhancement to an existing app/feature feature request labels Oct 4, 2021
@kieranc kieranc marked this pull request as ready for review October 18, 2021 22:23
@kieranc
Copy link
Contributor Author

kieranc commented Oct 19, 2021

I think there is a better way to implement the gauge needle color change but I haven't figured it out yet. As it stands if the BG is white/needle black and you hit randomise/reset, the needle stays black, until a reboot at least. I think I should be able to set it just once around line 167 but then I have to make sure the gauge is refreshed when closing the settings.

@kieranc
Copy link
Contributor Author

kieranc commented Oct 20, 2021

So much for tidy commits... However, this seems to work as expected, I can't find a better solution to the needle color change so it gets checked when the gauge is created, when the bar BG is changed and on randomize/reset. Not elegant, but it works.

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

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

I noticed that if you long press on the screen while the buttons are already visible, the big button appears anyway. Also I think pressing the back button should get rid of the buttons instead of going to sleep when the buttons are visible.

EDIT: also on sleep the buttons should probably go away.

src/displayapp/screens/settings/Settings.cpp Outdated Show resolved Hide resolved
src/displayapp/screens/PineTimeStyle.cpp Show resolved Hide resolved
src/displayapp/screens/PineTimeStyle.cpp Outdated Show resolved Hide resolved
@Riksu9000
Copy link
Contributor

Can you make pressing the physical button close the color picker?

@Riksu9000 Riksu9000 self-assigned this Oct 27, 2021
@kieranc
Copy link
Contributor Author

kieranc commented Oct 27, 2021

Can you make pressing the physical button close the color picker?

Yes, absolutely, but possibly not until next week.

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

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

This includes some changes by me, so someone else should check it too.

@kieranc
Copy link
Contributor Author

kieranc commented Nov 15, 2021

So, with help from Riku and others, this finally works as intended. The button closes the picker instead of turning off the screen, and the notification icon and ble icon happily co-exist.

I'm not terribly happy with the code for the icon alignment and am open to suggestions on how to improve it - with the previous [notificationState|bleState].IsUpdated code it seemed to hit the else on the second refresh after displaying the notification icon and realiging the ble icon to the center. By using [notificationState|bleState].Get, it works, the only edge case is that if the ble disconnects and the notification icon is visible, it doesn't move to the center.
I'll give it some more thought tomorrow and see if I can find a better solution but otherwise this is functional and ready for testing.

@Riksu9000
Copy link
Contributor

It would've been better to tweak the icons in a separate PR, because this PR was ready to merge, but now we need to work on the new changes too, which are not related to the color picker. If you were to revert those changes and work on them in another branch, we could get this merged quicker.

IsUpdated should be kept, as without it, the icons are refreshed with every cycle even if they haven't changed. It looks like you are aligning the icons next to each other. I think it would be preferrable if all the icons were aligned in a straight line. Have you tried aligning the icons relative to the previous icon, like in the digital watch face? That way when an icon disappears and all the icons are realigned, the later icons move back to fill the empty space.

@kieranc
Copy link
Contributor Author

kieranc commented Nov 16, 2021

I could put the notification icon centrally aligned below the BLE icon and it wouldn't be too horrible, but it does need something doing since currently the BLE icon is at 0,25 and the notification icon is 0,40 and they overlap. I'll revert this and make a simpler fix later until i have a proper solution worked out.

@kieranc
Copy link
Contributor Author

kieranc commented Nov 16, 2021

Ok it's done, both icon locations are static but they no longer overlap. It'll look a bit odd when there are notifications but no BLE connection, but I'll start working on a better fix. it's already an improvement on overlapping icons, and tbh the notification icon is very rarely displayed unless people accidentally activate silent mode...

image

@kieranc kieranc mentioned this pull request Dec 8, 2021
6 tasks
FintasticMan added a commit to FintasticMan/InfiniTime that referenced this pull request Dec 13, 2021
…face

Squashed commit of the following:

commit 6cf4a93
Merge: ae4b9e0 42a5cdb
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Thu Dec 9 22:41:29 2021 +0100

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit ae4b9e0
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Dec 6 10:29:14 2021 +0100

    Include Colors.h

commit c00ad4a
Merge: 1b2a8a5 85a2530
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sun Dec 5 20:32:29 2021 +0100

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit 1b2a8a5
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Tue Nov 16 18:18:56 2021 +0100

    Improve notification icon alignment

commit bea5c60
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Tue Nov 16 18:10:34 2021 +0100

    Revert "Fix notification icon alignment"

    This reverts commit 29bb359.

commit 29bb359
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Tue Nov 16 00:06:13 2021 +0100

    Fix notification icon alignment

commit 50406ad
Merge: 5a0cf8e 624429b
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Nov 15 22:21:11 2021 +0100

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit 5a0cf8e
Merge: 2fa63c7 a57fda6
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Nov 15 19:38:29 2021 +0100

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit 2fa63c7
Merge: 18e3cc7 2e7b51c
Author: kieranc <kieranc@gmail.com>
Date:   Mon Nov 15 19:21:35 2021 +0100

    Merge pull request #1 from Riksu9000/pts-settings-fix

    Close customizer menu with button in PTS

commit 2e7b51c
Author: Riku Isokoski <riksu9000@gmail.com>
Date:   Sat Nov 13 13:11:32 2021 +0200

    clang-format and clang-tidy PineTimeStyle

commit 39157f2
Author: Riku Isokoski <riksu9000@gmail.com>
Date:   Sat Nov 13 13:02:00 2021 +0200

    Close menu with button

commit 18e3cc7
Merge: 85d494a 4a5b5f9
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sun Nov 7 17:49:54 2021 +0100

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit 85d494a
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sat Oct 23 18:12:41 2021 +0200

    Revert "Update GetNext/GetPrevious"

    This reverts commit 411c10e.

commit da97a94
Merge: 411c10e 9538eb9
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sat Oct 23 18:00:47 2021 +0200

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit 411c10e
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 18:07:08 2021 +0200

    Update GetNext/GetPrevious

commit 3ed01b3
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 17:44:10 2021 +0200

    Improve random color selection, disable longpress when settings are visible

commit 32978b6
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 15:36:28 2021 +0200

    Restore settings order

commit 37eed43
Merge: 074d342 f45e094
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 11:30:42 2021 +0200

    Merge branch 'pts-settings' of https://github.com/kieranc/InfiniTime into pts-settings

commit 074d342
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 11:30:06 2021 +0200

    Ensure needle color is visible on reset/randomize

commit f45e094
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Wed Oct 20 11:25:06 2021 +0200

    Ensure needle color is visible one reset/randomize

commit 994f373
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Tue Oct 19 00:22:45 2021 +0200

    Change gauge needle color when background is white

commit 1c3372b
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Oct 18 23:29:41 2021 +0200

    Fix settings merge error

commit ff1fce1
Merge: c4ab17f ab7c6e1
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Oct 18 23:14:39 2021 +0200

    Merge remote-tracking branch 'upstream/develop' into pts-settings

commit c4ab17f
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Oct 18 23:04:12 2021 +0200

    Disable DoubleTap when settings buttons are displayed

commit 1c86796
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Mon Oct 18 22:52:53 2021 +0200

    More duplicate color dodging

commit 7d1da9f
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sun Oct 3 20:11:04 2021 +0200

    Remove old PineTimeStyle settings app

commit 3320eae
Author: Kieran Cawthray <kieranc@gmail.com>
Date:   Sun Oct 3 20:01:46 2021 +0200

    Initial commit
@JF002
Copy link
Collaborator

JF002 commented Dec 30, 2021

Looks good to me, great work and nice collaboration @kieranc @Riksu9000 👍

@JF002 JF002 added this to the 1.8.0 milestone Dec 30, 2021
@JF002 JF002 merged commit 395590d into InfiniTimeOrg:develop Dec 30, 2021
@Itai-Nelken Itai-Nelken mentioned this pull request Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing app/feature feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PineTimeStyle allows setting colors that hide UI elements
4 participants