[apps/external] Fixed external app color bug

This commit is contained in:
M4x1m3
2020-06-12 21:16:18 +02:00
parent 973a64c813
commit 2d1e48eb79
3 changed files with 9 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ namespace Home {
AppCell::AppCell() :
HighlightCell(),
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::HomeCellText, Palette::HomeCellTextActive),
m_visible(true)
m_visible(true), m_external_app(false)
{
}
@@ -34,17 +34,19 @@ void AppCell::layoutSubviews(bool force) {
}
void AppCell::setExtAppDescriptor(const char* name, const Image* icon) {
m_external_app = true;
m_iconView.setImage(icon);
m_nameView.setText(name);
m_nameView.setTextColor(Palette::AccentText);
m_nameView.setTextColor(Palette::HomeCellTextExternal);
m_nameView.setMessage(I18n::Message::Default);
layoutSubviews();
}
void AppCell::setAppDescriptor(::App::Descriptor * descriptor) {
m_external_app = false;
m_iconView.setImage(descriptor->icon());
m_nameView.setMessage(descriptor->name());
m_nameView.setTextColor(Palette::PrimaryText);
m_nameView.setTextColor(Palette::HomeCellText);
m_nameView.setText(nullptr);
layoutSubviews();
}
@@ -57,7 +59,7 @@ void AppCell::setVisible(bool visible) {
}
void AppCell::reloadCell() {
m_nameView.setTextColor(isHighlighted() ? Palette::HomeCellTextActive : Palette::HomeCellText);
m_nameView.setTextColor(isHighlighted() ? (m_external_app ? Palette::HomeCellTextExternalActive : Palette::HomeCellTextActive) : (m_external_app ? Palette::HomeCellTextExternal : Palette::HomeCellText));
m_nameView.setBackgroundColor(isHighlighted() ? Palette::HomeCellBackgroundActive : Palette::HomeCellBackground);
}

View File

@@ -27,6 +27,7 @@ private:
ImageView m_iconView;
MessageTextView m_nameView;
bool m_visible;
bool m_external_app;
};
}

View File

@@ -98,6 +98,8 @@ constexpr KDColor Palette::HomeCellBackground;
constexpr KDColor Palette::HomeCellBackgroundActive;
constexpr KDColor Palette::HomeCellText;
constexpr KDColor Palette::HomeCellTextActive;
constexpr KDColor Palette::HomeCellTextExternal;
constexpr KDColor Palette::HomeCellTextExternalActive;
constexpr KDColor Palette::YellowDark; // Done
constexpr KDColor Palette::YellowLight; // Done