fix: add default switch case, remove duplicate fillRect, suppress unused textWidth, rename bottomSelectedRow
This commit is contained in:
@@ -82,6 +82,8 @@ bool KeyboardEntryActivity::handleKeyPress() {
|
|||||||
case SpecOk:
|
case SpecOk:
|
||||||
onComplete(text);
|
onComplete(text);
|
||||||
return false;
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +256,7 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
|||||||
const int bkSpacing = metrics.keyboardBottomKeySpacing;
|
const int bkSpacing = metrics.keyboardBottomKeySpacing;
|
||||||
const int contentTotalWidth = COLS * keyWidth + (COLS - 1) * keySpacing;
|
const int contentTotalWidth = COLS * keyWidth + (COLS - 1) * keySpacing;
|
||||||
const int bottomKeyWidth = (contentTotalWidth - (BOTTOM_KEY_COUNT - 1) * bkSpacing) / BOTTOM_KEY_COUNT;
|
const int bottomKeyWidth = (contentTotalWidth - (BOTTOM_KEY_COUNT - 1) * bkSpacing) / BOTTOM_KEY_COUNT;
|
||||||
const int bottomSelectedRow = isBottomRow(selectedRow);
|
const bool bottomSelected = isBottomRow(selectedRow);
|
||||||
|
|
||||||
struct BottomKeyInfo {
|
struct BottomKeyInfo {
|
||||||
KeyboardKeyType themeType;
|
KeyboardKeyType themeType;
|
||||||
@@ -270,7 +272,7 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
|||||||
|
|
||||||
for (int i = 0; i < BOTTOM_KEY_COUNT; i++) {
|
for (int i = 0; i < BOTTOM_KEY_COUNT; i++) {
|
||||||
const int keyX = leftMargin + i * (bottomKeyWidth + bkSpacing);
|
const int keyX = leftMargin + i * (bottomKeyWidth + bkSpacing);
|
||||||
const bool isSelected = bottomSelectedRow && i == selectedCol;
|
const bool isSelected = bottomSelected && i == selectedCol;
|
||||||
|
|
||||||
GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected,
|
GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected,
|
||||||
nullptr, bottomKeys[i].themeType);
|
nullptr, bottomKeys[i].themeType);
|
||||||
|
|||||||
@@ -862,6 +862,7 @@ void BaseTheme::drawHelpText(const GfxRenderer& renderer, Rect rect, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseTheme::drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const {
|
void BaseTheme::drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth) const {
|
||||||
|
(void)textWidth;
|
||||||
const int lineHeight = renderer.getLineHeight(UI_12_FONT_ID);
|
const int lineHeight = renderer.getLineHeight(UI_12_FONT_ID);
|
||||||
const int bracketHeight = lineHeight;
|
const int bracketHeight = lineHeight;
|
||||||
const int fieldLeft = rect.x + 10;
|
const int fieldLeft = rect.x + 10;
|
||||||
@@ -914,10 +915,6 @@ void BaseTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
|
|||||||
const int itemWidth = renderer.getTextWidth(UI_12_FONT_ID, label);
|
const int itemWidth = renderer.getTextWidth(UI_12_FONT_ID, 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(UI_12_FONT_ID)) / 2 + primaryOffset;
|
||||||
|
|
||||||
if (isSelected) {
|
|
||||||
renderer.fillRect(rect.x, rect.y, rect.width, rect.height, true);
|
|
||||||
}
|
|
||||||
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !isSelected);
|
renderer.drawText(UI_12_FONT_ID, textX, textY, label, !isSelected);
|
||||||
|
|
||||||
if (hasSecondary) {
|
if (hasSecondary) {
|
||||||
|
|||||||
Reference in New Issue
Block a user