mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Add an icon when mode exam is on
Change-Id: I5b12f7857fe27d7b2db97062c17cafe7b571e303
This commit is contained in:
@@ -30,6 +30,8 @@ app_objs += $(addprefix apps/,\
|
||||
variable_box_leaf_cell.o\
|
||||
)
|
||||
|
||||
app_images += apps/exam_icon.png
|
||||
|
||||
# Tracking which source file uses which image is painful. But we need to ensure
|
||||
# that a .png file has been inlined before building any source file that uses
|
||||
# said image (because it will expect the ".h" file to be there).
|
||||
|
||||
BIN
apps/exam_icon.png
Normal file
BIN
apps/exam_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 550 B |
@@ -58,6 +58,7 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
|
||||
} else {
|
||||
Ion::LED::setColor(KDColorBlack);
|
||||
}
|
||||
container->refreshPreferences();
|
||||
container->activeApp()->dismissModalViewController();
|
||||
}, parentResponder), KDText::FontSize::Small)),
|
||||
m_warningTextView(MessageTextView(KDText::FontSize::Small, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack)),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "title_bar_view.h"
|
||||
#include "exam_icon.h"
|
||||
#include "global_preferences.h"
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
@@ -11,6 +13,7 @@ TitleBarView::TitleBarView() :
|
||||
m_titleView(KDText::FontSize::Small, I18n::Message::Default, 0.5f, 0.5f, KDColorWhite, Palette::YellowDark),
|
||||
m_preferenceView(KDText::FontSize::Small, 1.0f, 0.5, KDColorWhite, Palette::YellowDark)
|
||||
{
|
||||
m_examModeIconView.setImage(ImageStore::ExamIcon);
|
||||
}
|
||||
|
||||
void TitleBarView::setTitle(I18n::Message title) {
|
||||
@@ -26,7 +29,7 @@ bool TitleBarView::setIsCharging(bool isCharging) {
|
||||
}
|
||||
|
||||
int TitleBarView::numberOfSubviews() const {
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
View * TitleBarView::subviewAtIndex(int index) {
|
||||
@@ -36,6 +39,9 @@ View * TitleBarView::subviewAtIndex(int index) {
|
||||
if (index == 1) {
|
||||
return &m_preferenceView;
|
||||
}
|
||||
if (index == 2) {
|
||||
return &m_examModeIconView;
|
||||
}
|
||||
return &m_batteryView;
|
||||
}
|
||||
|
||||
@@ -44,6 +50,11 @@ void TitleBarView::layoutSubviews() {
|
||||
m_preferenceView.setFrame(KDRect(0, 0, m_preferenceView.minimalSizeForOptimalDisplay()));
|
||||
KDSize batterySize = m_batteryView.minimalSizeForOptimalDisplay();
|
||||
m_batteryView.setFrame(KDRect(bounds().width() - batterySize.width() - k_batteryLeftMargin, (bounds().height()- batterySize.height())/2, batterySize));
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
|
||||
m_examModeIconView.setFrame(KDRect(k_examIconMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight));
|
||||
} else {
|
||||
m_examModeIconView.setFrame(KDRectZero);
|
||||
}
|
||||
}
|
||||
|
||||
void TitleBarView::refreshPreferences() {
|
||||
@@ -62,5 +73,6 @@ void TitleBarView::refreshPreferences() {
|
||||
}
|
||||
buffer[numberOfChar] = 0;
|
||||
m_preferenceView.setText(buffer);
|
||||
// Layout the exam mode icon if needed
|
||||
layoutSubviews();
|
||||
}
|
||||
|
||||
@@ -14,12 +14,16 @@ public:
|
||||
void refreshPreferences();
|
||||
private:
|
||||
constexpr static KDCoordinate k_batteryLeftMargin = 5;
|
||||
constexpr static KDCoordinate k_examIconWidth = 18;
|
||||
constexpr static KDCoordinate k_examIconHeight = 9;
|
||||
constexpr static KDCoordinate k_examIconMargin = 93;
|
||||
int numberOfSubviews() const override;
|
||||
void layoutSubviews() override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
MessageTextView m_titleView;
|
||||
BatteryView m_batteryView;
|
||||
BufferTextView m_preferenceView;
|
||||
ImageView m_examModeIconView;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user