Se puede usar tanto la primera como la segunda cadena de texto para generar notificaciones
This commit is contained in:
@@ -150,6 +150,20 @@ void Notify::clearFinishedNotifications()
|
|||||||
// Muestra una notificación de texto por pantalla;
|
// Muestra una notificación de texto por pantalla;
|
||||||
void Notify::showText(std::string text1, std::string text2, int icon)
|
void Notify::showText(std::string text1, std::string text2, int icon)
|
||||||
{
|
{
|
||||||
|
// Si no hay texto, acaba
|
||||||
|
if (text1 == "" && text2 == "")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cuenta el número de textos a mostrar
|
||||||
|
int numTexts = 0;
|
||||||
|
if (text1 != "")
|
||||||
|
numTexts++;
|
||||||
|
if (text2 != "")
|
||||||
|
numTexts++;
|
||||||
|
|
||||||
|
// Si las notificaciones no se apilan, elimina las anteriores
|
||||||
if (!stack)
|
if (!stack)
|
||||||
{
|
{
|
||||||
clearNotifications();
|
clearNotifications();
|
||||||
@@ -162,7 +176,6 @@ void Notify::showText(std::string text1, std::string text2, int icon)
|
|||||||
const int iconSpace = icon >= 0 ? iconSize + paddingIn : 0;
|
const int iconSpace = icon >= 0 ? iconSize + paddingIn : 0;
|
||||||
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
||||||
const int width = text->lenght(txt) + (paddingIn * 2) + iconSpace;
|
const int width = text->lenght(txt) + (paddingIn * 2) + iconSpace;
|
||||||
const int numTexts = text2 == "" ? 1 : 2;
|
|
||||||
const int height = (text->getCharacterSize() * numTexts) + (paddingIn * 2);
|
const int height = (text->getCharacterSize() * numTexts) + (paddingIn * 2);
|
||||||
const notification_shape_t shape = notification_shape_squared;
|
const notification_shape_t shape = notification_shape_squared;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user