-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Pride flag watchface #2201
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
Merged
Merged
Pride flag watchface #2201
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0a48fbc
Added trans watch face
Aperture32GLaDOS 7e2f2a1
Patched source files with fixed formatting
Aperture32GLaDOS ee2e868
Implemented suggested changes
Aperture32GLaDOS 9b8df1f
Made notification display not overlap battery level; changed name fro…
Aperture32GLaDOS bb388ef
Changed Mail to mail in notification
Aperture32GLaDOS 3c0ccf2
Merge remote-tracking branch 'upstream/main'
Aperture32GLaDOS e01e616
Moved AM/PM display to the day
Aperture32GLaDOS 879fb48
Fixed 12H mode displaying 24H times
Aperture32GLaDOS 56e7072
Merge remote-tracking branch 'upstream/main'
Aperture32GLaDOS 285ba00
Renamed WatchFaceTrans to WatchFaceTransFlag
Aperture32GLaDOS fe6bac2
Merge branch 'main' into main
Aperture32GLaDOS 1d59a7a
Applied formatting patches
Aperture32GLaDOS 1a470cf
Merge branch 'main' into main
Aperture32GLaDOS 5187d1e
Merge branch 'main' into main
Aperture32GLaDOS 5891adf
Added multiple pride flags
Aperture32GLaDOS 274798d
Applied formatting patches
Aperture32GLaDOS 857309e
Fixed labels having wrong position
Aperture32GLaDOS 156a629
Merge remote-tracking branch 'upstream/main'
Aperture32GLaDOS c8f45f8
Added text colour changing; fixed time label incorrectly aligned
Aperture32GLaDOS 1e570c6
Merge remote-tracking branch 'upstream/main'
Aperture32GLaDOS 12109a8
Fixed formatting
Aperture32GLaDOS 0adf807
Swapped out rainbow flag for MLM flag
Aperture32GLaDOS 3b856cd
Merge remote-tracking branch 'upstream/main'
Aperture32GLaDOS 2ab7f6b
Made top and bottom half of text have different colours in the MLM flag
Aperture32GLaDOS 7d53345
Fixed formatting
Aperture32GLaDOS 1f0265f
Incremented settingsVersion
Aperture32GLaDOS 32c3651
Implemented suggested changes
Aperture32GLaDOS 5cd30ac
- Moved all flag-specific data into a new FlagData class
Aperture32GLaDOS 3fb52d9
Merge branch 'main' into main
Aperture32GLaDOS f314569
Fixed signedness error in background section for-loop
Aperture32GLaDOS d0217ba
Renamed notificationIcon to notificationText, and changed security of…
Aperture32GLaDOS b582d3d
Swapped out C-style casts for C++ style
Aperture32GLaDOS 5643c2e
Changed UpdateScreen to private
Aperture32GLaDOS 1c6d4f0
Implemented suggested changes (moving PrideFlagData into cpp, making …
Aperture32GLaDOS 8ae772f
Cleaned up constructor usage
Aperture32GLaDOS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Added trans watch face
- Loading branch information
commit 0a48fbcd79d519d0c126d3eabdb8243877d51a25
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ namespace Pinetime { | |
| Terminal, | ||
| Infineat, | ||
| CasioStyleG7710, | ||
| Trans, | ||
| }; | ||
|
|
||
| template <Apps> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| #include <lvgl/lvgl.h> | ||
| #include "displayapp/screens/WatchFaceTrans.h" | ||
| #include "displayapp/screens/BatteryIcon.h" | ||
| #include "displayapp/screens/NotificationIcon.h" | ||
| #include "displayapp/screens/Symbols.h" | ||
| #include "components/battery/BatteryController.h" | ||
| #include "components/ble/BleController.h" | ||
| #include "components/motion/MotionController.h" | ||
| #include "components/settings/Settings.h" | ||
|
|
||
| using namespace Pinetime::Applications::Screens; | ||
|
|
||
| WatchFaceTrans::WatchFaceTrans(Controllers::DateTime& dateTimeController, | ||
| const Controllers::Battery& batteryController, | ||
| const Controllers::Ble& bleController, | ||
| Controllers::NotificationManager& notificationManager, | ||
| Controllers::Settings& settingsController, | ||
| Controllers::MotionController& motionController) | ||
| : currentDateTime {{}}, | ||
| dateTimeController {dateTimeController}, | ||
| batteryController {batteryController}, | ||
| bleController {bleController}, | ||
| notificationManager {notificationManager}, | ||
| settingsController {settingsController}, | ||
| motionController {motionController} { | ||
|
|
||
| topBlueBackground = lv_obj_create(lv_scr_act(), nullptr); | ||
| lv_obj_set_size(topBlueBackground, LV_HOR_RES, LV_VER_RES / 5); | ||
| lv_obj_set_pos(topBlueBackground, 0, 0); | ||
| lv_obj_set_style_local_bg_color(topBlueBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00bff3)); | ||
| lv_obj_set_style_local_radius(topBlueBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0); | ||
| topPinkBackground = lv_obj_create(lv_scr_act(), nullptr); | ||
| lv_obj_set_size(topPinkBackground, LV_HOR_RES, LV_VER_RES / 5); | ||
| lv_obj_set_pos(topPinkBackground, 0, LV_VER_RES / 5); | ||
| lv_obj_set_style_local_bg_color(topPinkBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf49ac1)); | ||
| lv_obj_set_style_local_radius(topPinkBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0); | ||
| whiteBackground = lv_obj_create(lv_scr_act(), nullptr); | ||
| lv_obj_set_size(whiteBackground, LV_HOR_RES, LV_VER_RES / 5); | ||
| lv_obj_set_pos(whiteBackground, 0, 2 * LV_VER_RES / 5); | ||
| lv_obj_set_style_local_bg_color(whiteBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xffffff)); | ||
| lv_obj_set_style_local_radius(whiteBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0); | ||
| bottomPinkBackground = lv_obj_create(lv_scr_act(), nullptr); | ||
| lv_obj_set_size(bottomPinkBackground, LV_HOR_RES, LV_VER_RES / 5); | ||
| lv_obj_set_pos(bottomPinkBackground, 0, 3 * LV_VER_RES / 5); | ||
| lv_obj_set_style_local_bg_color(bottomPinkBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf49ac1)); | ||
| lv_obj_set_style_local_radius(bottomPinkBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0); | ||
| bottomBlueBackground = lv_obj_create(lv_scr_act(), nullptr); | ||
| lv_obj_set_size(bottomBlueBackground, LV_HOR_RES, LV_VER_RES / 5); | ||
| lv_obj_set_pos(bottomBlueBackground, 0, 4 * LV_VER_RES / 5); | ||
| lv_obj_set_style_local_bg_color(bottomBlueBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00bff3)); | ||
| lv_obj_set_style_local_radius(bottomBlueBackground, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0); | ||
|
|
||
| bluetoothStatus = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_label_set_text_static(bluetoothStatus, ""); | ||
| lv_obj_align(bluetoothStatus, nullptr, LV_ALIGN_IN_TOP_RIGHT, -16, 0); | ||
|
|
||
| batteryValue = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_label_set_recolor(batteryValue, true); | ||
| lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -96); | ||
| lv_label_set_align(batteryValue, LV_LABEL_ALIGN_CENTER); | ||
| lv_obj_set_auto_realign(batteryValue, true); | ||
|
|
||
| notificationIcon = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100); | ||
| lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); | ||
|
|
||
| label_date = lv_label_create(lv_scr_act(), nullptr); | ||
mark9064 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| lv_label_set_recolor(label_date, true); | ||
| lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, -48); | ||
| lv_label_set_align(label_date, LV_LABEL_ALIGN_CENTER); | ||
| lv_obj_set_auto_realign(label_date, true); | ||
|
|
||
| label_time = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_label_set_recolor(label_time, true); | ||
| lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); | ||
| lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); | ||
| lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); | ||
| lv_obj_set_auto_realign(label_time, true); | ||
|
|
||
| label_day = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_label_set_recolor(label_day, true); | ||
| lv_obj_align(label_day, lv_scr_act(), LV_ALIGN_CENTER, 0, 48); | ||
| lv_label_set_align(label_day, LV_LABEL_ALIGN_CENTER); | ||
| lv_obj_set_auto_realign(label_day, true); | ||
|
|
||
| stepValue = lv_label_create(lv_scr_act(), nullptr); | ||
| lv_label_set_recolor(stepValue, true); | ||
| lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, 96); | ||
| lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); | ||
| lv_obj_set_auto_realign(stepValue, true); | ||
|
|
||
| taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); | ||
| Refresh(); | ||
| } | ||
|
|
||
| WatchFaceTrans::~WatchFaceTrans() { | ||
| lv_task_del(taskRefresh); | ||
| lv_obj_clean(lv_scr_act()); | ||
| } | ||
|
|
||
| void WatchFaceTrans::Refresh() { | ||
| powerPresent = batteryController.IsPowerPresent(); | ||
| bleState = bleController.IsConnected(); | ||
| batteryPercentRemaining = batteryController.PercentRemaining(); | ||
| if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) { | ||
| lv_label_set_text_fmt(batteryValue, "#ffffff %d%%", batteryPercentRemaining.Get()); | ||
| if (batteryController.IsPowerPresent()) { | ||
| lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging"); | ||
| } | ||
| } | ||
| if (bleState.IsUpdated()) { | ||
| if (bleState.Get()) { | ||
| lv_label_set_text_static(bluetoothStatus, Symbols::bluetooth); | ||
| } | ||
| else { | ||
| lv_label_set_text_static(bluetoothStatus, ""); | ||
| } | ||
| } | ||
|
|
||
| notificationState = notificationManager.AreNewNotificationsAvailable(); | ||
| if (notificationState.IsUpdated()) { | ||
| if (notificationState.Get()) { | ||
| lv_label_set_text_static(notificationIcon, "You have mail."); | ||
| } else { | ||
| lv_label_set_text_static(notificationIcon, ""); | ||
| } | ||
| } | ||
|
|
||
| currentDateTime = std::chrono::time_point_cast<std::chrono::seconds>(dateTimeController.CurrentDateTime()); | ||
| if (currentDateTime.IsUpdated()) { | ||
| uint8_t hour = dateTimeController.Hours(); | ||
| uint8_t minute = dateTimeController.Minutes(); | ||
| uint8_t second = dateTimeController.Seconds(); | ||
|
|
||
| if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { | ||
| char ampmChar[3] = "AM"; | ||
| if (hour == 0) { | ||
| hour = 12; | ||
| } else if (hour == 12) { | ||
| ampmChar[0] = 'P'; | ||
| } else if (hour > 12) { | ||
| hour = hour - 12; | ||
| ampmChar[0] = 'P'; | ||
| } | ||
| lv_label_set_text_fmt(label_time, "#000000 %02d:%02d:%02d %s#", hour, minute, second, ampmChar); | ||
| } else { | ||
| lv_label_set_text_fmt(label_time, "#000000 %02d:%02d:%02d", hour, minute, second); | ||
| } | ||
|
|
||
| currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); | ||
| if (currentDate.IsUpdated()) { | ||
| uint16_t year = dateTimeController.Year(); | ||
| Controllers::DateTime::Months month = dateTimeController.Month(); | ||
| uint8_t day = dateTimeController.Day(); | ||
| Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); | ||
| lv_label_set_text_fmt(label_date, "#ffffff %02d-%02d-%04d#", short(day), char(month), year); | ||
mark9064 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const char* dayString; | ||
| switch (dayOfWeek) { | ||
| case Controllers::DateTime::Days::Monday: | ||
| dayString = "Monday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Tuesday: | ||
| dayString = "Tuesday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Wednesday: | ||
| dayString = "Wednesday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Thursday: | ||
| dayString = "Thursday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Friday: | ||
| dayString = "Friday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Saturday: | ||
| dayString = "Saturday"; | ||
| break; | ||
| case Controllers::DateTime::Days::Sunday: | ||
| dayString = "Sunday"; | ||
| break; | ||
| default: | ||
| dayString = "?"; | ||
| break; | ||
mark9064 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| lv_label_set_text_fmt(label_day, "#ffffff %s", dayString); | ||
| } | ||
| } | ||
|
|
||
| stepCount = motionController.NbSteps(); | ||
| if (stepCount.IsUpdated()) { | ||
| lv_label_set_text_fmt(stepValue, "#ffffff %lu steps#", stepCount.Get()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| #pragma once | ||
|
|
||
| #include <lvgl/src/lv_core/lv_obj.h> | ||
| #include <chrono> | ||
| #include <cstdint> | ||
| #include <memory> | ||
| #include <displayapp/Controllers.h> | ||
| #include "displayapp/screens/Screen.h" | ||
| #include "displayapp/widgets/StatusIcons.h" | ||
| #include "components/datetime/DateTimeController.h" | ||
| #include "components/ble/BleController.h" | ||
| #include "utility/DirtyValue.h" | ||
|
|
||
| namespace Pinetime { | ||
| namespace Controllers { | ||
| class Settings; | ||
| class Battery; | ||
| class Ble; | ||
| class NotificationManager; | ||
| class MotionController; | ||
| } | ||
|
|
||
| namespace Applications { | ||
| namespace Screens { | ||
|
|
||
| class WatchFaceTrans : public Screen { | ||
| public: | ||
| WatchFaceTrans(Controllers::DateTime& dateTimeController, | ||
| const Controllers::Battery& batteryController, | ||
| const Controllers::Ble& bleController, | ||
| Controllers::NotificationManager& notificationManager, | ||
| Controllers::Settings& settingsController, | ||
| Controllers::MotionController& motionController); | ||
| ~WatchFaceTrans() override; | ||
|
|
||
| void Refresh() override; | ||
|
|
||
| private: | ||
| Utility::DirtyValue<int> batteryPercentRemaining {}; | ||
mark9064 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Utility::DirtyValue<bool> powerPresent {}; | ||
| Utility::DirtyValue<bool> bleState {}; | ||
| Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> currentDateTime {}; | ||
| Utility::DirtyValue<uint32_t> stepCount {}; | ||
| Utility::DirtyValue<bool> notificationState {}; | ||
| Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; | ||
|
|
||
| lv_obj_t* topBlueBackground; | ||
| lv_obj_t* topPinkBackground; | ||
| lv_obj_t* whiteBackground; | ||
| lv_obj_t* bottomPinkBackground; | ||
| lv_obj_t* bottomBlueBackground; | ||
| lv_obj_t* bluetoothStatus; | ||
| lv_obj_t* label_time; | ||
| lv_obj_t* label_date; | ||
| lv_obj_t* label_day; | ||
| lv_obj_t* batteryValue; | ||
| lv_obj_t* stepValue; | ||
| lv_obj_t* notificationIcon; | ||
|
|
||
| Controllers::DateTime& dateTimeController; | ||
| const Controllers::Battery& batteryController; | ||
| const Controllers::Ble bleController; | ||
| Controllers::NotificationManager& notificationManager; | ||
| Controllers::Settings& settingsController; | ||
| Controllers::MotionController& motionController; | ||
|
|
||
| lv_task_t* taskRefresh; | ||
| }; | ||
| } | ||
|
|
||
| template <> | ||
| struct WatchFaceTraits<WatchFace::Trans> { | ||
| static constexpr WatchFace watchFace = WatchFace::Trans; | ||
| static constexpr const char* name = "Trans"; | ||
|
|
||
| static Screens::Screen* Create(AppControllers& controllers) { | ||
| return new Screens::WatchFaceTrans(controllers.dateTimeController, | ||
| controllers.batteryController, | ||
| controllers.bleController, | ||
| controllers.notificationManager, | ||
| controllers.settingsController, | ||
| controllers.motionController); | ||
| }; | ||
|
|
||
| static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { | ||
| return true; | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.