~aleteoryx/muditaos

ref: db6e7d041660788240588d28ede400247c57794f muditaos/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp -rw-r--r-- 1.7 KiB
db6e7d04 — Marek Niepieklo [CP-163] Implement FS Endpoint read file 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <AppWindow.hpp>
#include <gui/widgets/Label.hpp>
#include <Translator.hpp>
#include <notifications/NotificationsModel.hpp>
#include <ListView.hpp>

namespace app
{
    class ApplicationDesktop;
}

namespace gui
{
    class PhoneLockedWindow : public AppWindow
    {
      protected:
        gui::Label *time                                            = nullptr;
        gui::Label *dayText                                         = nullptr;
        gui::ListView *notificationsList                            = nullptr;
        std::shared_ptr<gui::NotificationsModel> notificationsModel = nullptr;

        /// Locking timer on pressing enter
        class LockingTimer
        {
            bool enterPressed        = false;
            uint32_t unLockStartTime = 0;
            uint32_t unLockTime      = 3000;

          public:
            bool storeEnter(const InputEvent &evt);
            void clear() noexcept;
            bool cached() noexcept;
        } lockingTimer;

        bool processLongReleaseEvent(const InputEvent &inputEvent);
        bool processShortReleaseEvent(const InputEvent &inputEvent);

      public:
        PhoneLockedWindow(app::Application *app, const std::string &name);

        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void buildInterface() override;
        status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;

        bool updateTime() override;
    };

} /* namespace gui */