-
-
Notifications
You must be signed in to change notification settings - Fork 982
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
Introduce a restricted clock-only-mode when not woken with the button #1359
Open
tgc-dk
wants to merge
4
commits into
InfiniTimeOrg:main
Choose a base branch
from
tgc-dk:button-unlock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f768e07
Refactor the original ignore-touch implementation to work on latest code
tgc-dk ebf45f8
TouchHandler: default buttonUnlocksOn to false
NeroBurner b9786dd
PopupMessage: draw lock with lvgl, hard code size
NeroBurner a00a8d3
Remove new font, draw with lvgl
NeroBurner 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
There are no files selected for viewing
This file contains 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 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 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 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 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 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,29 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <lvgl/lvgl.h> | ||
#include "displayapp/screens/Screen.h" | ||
#include "displayapp/widgets/PageIndicator.h" | ||
|
||
namespace Pinetime { | ||
|
||
namespace Applications { | ||
namespace Screens { | ||
|
||
class Page : public Screen { | ||
public: | ||
Page(uint8_t screenID, uint8_t numScreens, lv_obj_t* contentObj) : contentObj {contentObj}, pageIndicator(screenID, numScreens) { | ||
pageIndicator.Create(); | ||
} | ||
|
||
~Page() override { | ||
lv_obj_clean(lv_scr_act()); | ||
} | ||
|
||
private: | ||
lv_obj_t* contentObj = nullptr; | ||
Widgets::PageIndicator pageIndicator; | ||
}; | ||
} | ||
} | ||
} |
This file contains 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 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 |
---|---|---|
|
@@ -4,7 +4,10 @@ | |
#include <cstdint> | ||
#include <lvgl/lvgl.h> | ||
#include "components/settings/Settings.h" | ||
#include "displayapp/screens/Page.h" | ||
#include "displayapp/screens/Screen.h" | ||
#include "displayapp/screens/ScreenList.h" | ||
#include "displayapp/widgets/PageIndicator.h" | ||
|
||
namespace Pinetime { | ||
|
||
|
@@ -13,27 +16,40 @@ namespace Pinetime { | |
|
||
class SettingWakeUp : public Screen { | ||
public: | ||
SettingWakeUp(Pinetime::Controllers::Settings& settingsController); | ||
SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
~SettingWakeUp() override; | ||
|
||
void UpdateSelected(lv_obj_t* object); | ||
|
||
bool OnTouchEvent(TouchEvents event) override; | ||
|
||
private: | ||
auto CreateScreenList(); | ||
std::unique_ptr<Screen> CreateScreen(size_t screenNum); | ||
|
||
struct Option { | ||
Controllers::Settings::WakeUpMode wakeUpMode; | ||
const char* name; | ||
}; | ||
|
||
static constexpr size_t numOptions = 6; | ||
static constexpr size_t optionsPerScreen = 4; | ||
static constexpr size_t nScreens = 2; | ||
|
||
Controllers::Settings& settingsController; | ||
static constexpr std::array<Option, 5> options = {{ | ||
|
||
ScreenList<nScreens> screens; | ||
|
||
static constexpr std::array<Option, numOptions> options = {{ | ||
{Controllers::Settings::WakeUpMode::SingleTap, "Single Tap"}, | ||
{Controllers::Settings::WakeUpMode::DoubleTap, "Double Tap"}, | ||
{Controllers::Settings::WakeUpMode::RaiseWrist, "Raise Wrist"}, | ||
{Controllers::Settings::WakeUpMode::Shake, "Shake Wake"}, | ||
{Controllers::Settings::WakeUpMode::LowerWrist, "Lower Wrist"}, | ||
{Controllers::Settings::WakeUpMode::ButtonUnlocks, "Button Unlock"}, | ||
}}; | ||
|
||
lv_obj_t* cbOption[options.size()]; | ||
std::array<lv_obj_t*, numOptions> cbOption; | ||
}; | ||
} | ||
} | ||
|
This file contains 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,56 @@ | ||
#include "displayapp/widgets/PopupMessage.h" | ||
#include "displayapp/InfiniTimeTheme.h" | ||
#include <libraries/log/nrf_log.h> | ||
|
||
using namespace Pinetime::Applications::Widgets; | ||
|
||
PopupMessage::PopupMessage() { | ||
} | ||
|
||
void PopupMessage::Create() { | ||
popup = lv_obj_create(lv_scr_act(), nullptr); | ||
lv_obj_set_size(popup, 90, 90); | ||
lv_obj_align(popup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); | ||
lv_obj_set_style_local_bg_color(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::bg); | ||
lv_obj_set_style_local_bg_opa(popup, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60); | ||
lv_obj_t* lockBody = lv_obj_create(popup, nullptr); | ||
lv_obj_set_size(lockBody, 55, 50); | ||
lv_obj_align(lockBody, popup, LV_ALIGN_CENTER, 0, 10); | ||
|
||
lv_obj_set_style_local_bg_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); | ||
lv_obj_set_style_local_bg_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); | ||
lv_obj_set_style_local_border_color(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); | ||
lv_obj_set_style_local_border_width(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 22); | ||
lv_obj_set_style_local_border_side(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); | ||
lv_obj_set_style_local_border_opa(lockBody, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); | ||
|
||
lv_obj_t* lockTop = lv_obj_create(popup, nullptr); | ||
lv_obj_set_size(lockTop, 30, 35); | ||
lv_obj_align(lockTop, popup, LV_ALIGN_CENTER, 0, -20); | ||
lv_obj_set_style_local_bg_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); | ||
lv_obj_set_style_local_bg_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); | ||
lv_obj_set_style_local_border_color(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); | ||
lv_obj_set_style_local_border_width(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 6); | ||
lv_obj_set_style_local_border_side(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); | ||
lv_obj_set_style_local_border_opa(lockTop, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); | ||
|
||
lv_obj_set_hidden(popup, isHidden); | ||
} | ||
|
||
void PopupMessage::SetHidden(bool hidden) { | ||
if (isHidden == hidden) { | ||
return; | ||
} | ||
isHidden = hidden; | ||
// create/delete on demand | ||
if (popup == nullptr && !isHidden) { | ||
Create(); | ||
} else if (popup != nullptr) { | ||
lv_obj_del(popup); | ||
popup = nullptr; | ||
} | ||
} | ||
|
||
bool PopupMessage::IsHidden() { | ||
return isHidden; | ||
} |
This file contains 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,20 @@ | ||
#pragma once | ||
#include <lvgl/lvgl.h> | ||
|
||
namespace Pinetime { | ||
namespace Applications { | ||
namespace Widgets { | ||
class PopupMessage { | ||
public: | ||
PopupMessage(); | ||
void Create(); | ||
void SetHidden(bool hidden); | ||
bool IsHidden(); | ||
|
||
private: | ||
lv_obj_t* popup = nullptr; | ||
bool isHidden = 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we shouldn't introduce the concept of "unlock mode" rather than adding this to the "wake up modes". What do you think?