Slight layout changes
This commit is contained in:
@@ -254,6 +254,9 @@ STR_YES: "Yes"
|
|||||||
STR_NO: "No"
|
STR_NO: "No"
|
||||||
STR_SHOW: "Show"
|
STR_SHOW: "Show"
|
||||||
STR_HIDE: "Hide"
|
STR_HIDE: "Hide"
|
||||||
|
STR_SHIFT: "shift"
|
||||||
|
STR_SHIFT_CAPS: "SHIFT"
|
||||||
|
STR_ABC: "abc"
|
||||||
STR_STATE_ON: "ON"
|
STR_STATE_ON: "ON"
|
||||||
STR_STATE_OFF: "OFF"
|
STR_STATE_OFF: "OFF"
|
||||||
STR_NOT_SET: "Not Set"
|
STR_NOT_SET: "Not Set"
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
#include "components/UITheme.h"
|
#include "components/UITheme.h"
|
||||||
#include "fontIds.h"
|
#include "fontIds.h"
|
||||||
|
|
||||||
const char* const KeyboardEntryActivity::shiftString[2] = {"shift", "SHIFT"};
|
|
||||||
|
|
||||||
void KeyboardEntryActivity::onEnter() {
|
void KeyboardEntryActivity::onEnter() {
|
||||||
Activity::onEnter();
|
Activity::onEnter();
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
@@ -25,6 +23,8 @@ int KeyboardEntryActivity::getBottomKeyCount() const { return isPassword ? 6 : 5
|
|||||||
|
|
||||||
bool KeyboardEntryActivity::isBottomRow(const int row) const { return row == getContentRowCount(); }
|
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 {
|
char KeyboardEntryActivity::getSelectedChar() const {
|
||||||
const KeyDef(*layout)[COLS] = symMode ? symLayout : abcLayout;
|
const KeyDef(*layout)[COLS] = symMode ? symLayout : abcLayout;
|
||||||
|
|
||||||
@@ -308,8 +308,8 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
|||||||
|
|
||||||
std::vector<BottomKeyInfo> bottomKeys;
|
std::vector<BottomKeyInfo> bottomKeys;
|
||||||
bottomKeys.reserve(6);
|
bottomKeys.reserve(6);
|
||||||
bottomKeys.push_back({KeyboardKeyType::Shift, symMode ? shiftString[0] : shiftString[shiftState]});
|
bottomKeys.push_back({KeyboardKeyType::Shift, getShiftLabel()});
|
||||||
bottomKeys.push_back({KeyboardKeyType::Mode, symMode ? "abc" : "#@!"});
|
bottomKeys.push_back({KeyboardKeyType::Mode, symMode ? tr(STR_ABC) : "#@!"});
|
||||||
if (isPassword) {
|
if (isPassword) {
|
||||||
bottomKeys.push_back({KeyboardKeyType::Reveal, passwordVisible ? tr(STR_HIDE) : tr(STR_SHOW)});
|
bottomKeys.push_back({KeyboardKeyType::Reveal, passwordVisible ? tr(STR_HIDE) : tr(STR_SHOW)});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class KeyboardEntryActivity : public Activity {
|
|||||||
{'`', '\0'}},
|
{'`', '\0'}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* const shiftString[2];
|
const char* getShiftLabel() const;
|
||||||
|
|
||||||
int getContentRowCount() const;
|
int getContentRowCount() const;
|
||||||
int getTotalRowCount() const;
|
int getTotalRowCount() const;
|
||||||
|
|||||||
@@ -913,10 +913,14 @@ void BaseTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
|
|||||||
|
|
||||||
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
|
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
|
||||||
const int primaryOffset = 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 textX = rect.x + (rect.width - itemWidth) / 2;
|
||||||
const int textY = rect.y + (rect.height - renderer.getLineHeight(UI_12_FONT_ID)) / 2 + primaryOffset;
|
const int textY = rect.y + (rect.height - renderer.getLineHeight(fontId)) / 2 + primaryOffset;
|
||||||
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !isSelected);
|
renderer.drawText(fontId, textX, textY, label, !isSelected);
|
||||||
|
|
||||||
if (hasSecondary) {
|
if (hasSecondary) {
|
||||||
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
|
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
|
||||||
|
|||||||
@@ -830,10 +830,14 @@ void LyraTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
|
|||||||
|
|
||||||
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
|
const bool hasSecondary = secondaryLabel != nullptr && secondaryLabel[0] != '\0';
|
||||||
const int primaryOffset = 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 textX = rect.x + (rect.width - textWidth) / 2;
|
||||||
const int textY = rect.y + (rect.height - renderer.getLineHeight(UI_12_FONT_ID)) / 2 + primaryOffset;
|
const int textY = rect.y + (rect.height - renderer.getLineHeight(fontId)) / 2 + primaryOffset;
|
||||||
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !invert);
|
renderer.drawText(fontId, textX, textY, label, !invert);
|
||||||
|
|
||||||
if (hasSecondary) {
|
if (hasSecondary) {
|
||||||
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
|
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
|
||||||
|
|||||||
Reference in New Issue
Block a user