Merge branch 'develop' into patch-weather

This commit is contained in:
Avamander
2021-12-09 22:20:29 +02:00
committed by GitHub
16 changed files with 306 additions and 62 deletions

View File

@@ -26,6 +26,7 @@ namespace Pinetime {
Motion,
Steps,
Weather,
PassKey,
QuickSettings,
Settings,
SettingWatchFace,

View File

@@ -29,6 +29,7 @@
#include "displayapp/screens/FlashLight.h"
#include "displayapp/screens/BatteryInfo.h"
#include "displayapp/screens/Steps.h"
#include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h"
#include "drivers/Cst816s.h"
@@ -214,6 +215,9 @@ void DisplayApp::Refresh() {
} else {
LoadApp(Apps::Alarm, DisplayApp::FullRefreshDirections::None);
}
case Messages::ShowPairingKey:
LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
break;
case Messages::TouchEvent: {
if (state != States::Running) {
break;
@@ -351,6 +355,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
break;
case Apps::PassKey:
currentScreen = std::make_unique<Screens::PassKey>(this, bleController.GetPairingKey());
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::Notifications:
currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal);

View File

@@ -19,6 +19,7 @@ namespace Pinetime {
UpdateTimeOut,
DimScreen,
RestoreBrightness,
ShowPairingKey,
AlarmTriggered
};
}

View File

@@ -0,0 +1,24 @@
#include "PassKey.h"
#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) {
passkeyLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(passkeyLabel, "%06u", key);
lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20);
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, "");
}
PassKey::~PassKey() {
lv_obj_clean(lv_scr_act());
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include "Screen.h"
#include <lvgl/lvgl.h>
namespace Pinetime {
namespace Applications {
namespace Screens {
class PassKey : public Screen {
public:
PassKey(DisplayApp* app, uint32_t key);
~PassKey() override;
private:
lv_obj_t* passkeyLabel;
lv_obj_t* backgroundLabel;
};
}
}
}