Slight layout changes

This commit is contained in:
jpirnay
2026-04-12 23:32:19 +02:00
parent bb9687d585
commit 5f82a28ac6
5 changed files with 22 additions and 11 deletions
@@ -8,8 +8,6 @@
#include "components/UITheme.h"
#include "fontIds.h"
const char* const KeyboardEntryActivity::shiftString[2] = {"shift", "SHIFT"};
void KeyboardEntryActivity::onEnter() {
Activity::onEnter();
requestUpdate();
@@ -25,6 +23,8 @@ int KeyboardEntryActivity::getBottomKeyCount() const { return isPassword ? 6 : 5
bool KeyboardEntryActivity::isBottomRow(const int row) const { return row == getContentRowCount(); }
const char* KeyboardEntryActivity::getShiftLabel() const { return tr(shiftState > 0 ? STR_SHIFT_CAPS : STR_SHIFT); }
char KeyboardEntryActivity::getSelectedChar() const {
const KeyDef(*layout)[COLS] = symMode ? symLayout : abcLayout;
@@ -308,8 +308,8 @@ void KeyboardEntryActivity::render(RenderLock&&) {
std::vector<BottomKeyInfo> bottomKeys;
bottomKeys.reserve(6);
bottomKeys.push_back({KeyboardKeyType::Shift, symMode ? shiftString[0] : shiftString[shiftState]});
bottomKeys.push_back({KeyboardKeyType::Mode, symMode ? "abc" : "#@!"});
bottomKeys.push_back({KeyboardKeyType::Shift, getShiftLabel()});
bottomKeys.push_back({KeyboardKeyType::Mode, symMode ? tr(STR_ABC) : "#@!"});
if (isPassword) {
bottomKeys.push_back({KeyboardKeyType::Reveal, passwordVisible ? tr(STR_HIDE) : tr(STR_SHOW)});
}
+1 -1
View File
@@ -144,7 +144,7 @@ class KeyboardEntryActivity : public Activity {
{'`', '\0'}},
};
static const char* const shiftString[2];
const char* getShiftLabel() const;
int getContentRowCount() const;
int getTotalRowCount() const;
+7 -3
View File
@@ -913,10 +913,14 @@ void BaseTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
const int primaryOffset = 0;
const int itemWidth = renderer.getTextWidth(UI_12_FONT_ID, label);
const int fontId = (keyType == KeyboardKeyType::Shift || keyType == KeyboardKeyType::Mode ||
keyType == KeyboardKeyType::Reveal || keyType == KeyboardKeyType::Ok)
? UI_10_FONT_ID
: UI_12_FONT_ID;
const int itemWidth = renderer.getTextWidth(fontId, label);
const int textX = rect.x + (rect.width - itemWidth) / 2;
const int textY = rect.y + (rect.height - renderer.getLineHeight(UI_12_FONT_ID)) / 2 + primaryOffset;
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !isSelected);
const int textY = rect.y + (rect.height - renderer.getLineHeight(fontId)) / 2 + primaryOffset;
renderer.drawText(fontId, textX, textY, label, !isSelected);
if (hasSecondary) {
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
+7 -3
View File
@@ -830,10 +830,14 @@ void LyraTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
const int primaryOffset = 0;
const int textWidth = renderer.getTextWidth(UI_12_FONT_ID, label);
const int fontId = (keyType == KeyboardKeyType::Shift || keyType == KeyboardKeyType::Mode ||
keyType == KeyboardKeyType::Reveal || keyType == KeyboardKeyType::Ok)
? UI_10_FONT_ID
: UI_12_FONT_ID;
const int textWidth = renderer.getTextWidth(fontId, label);
const int textX = rect.x + (rect.width - textWidth) / 2;
const int textY = rect.y + (rect.height - renderer.getLineHeight(UI_12_FONT_ID)) / 2 + primaryOffset;
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !invert);
const int textY = rect.y + (rect.height - renderer.getLineHeight(fontId)) / 2 + primaryOffset;
renderer.drawText(fontId, textX, textY, label, !invert);
if (hasSecondary) {
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);