Warning: session_start(): open(/var/lib/php/sessions/sess_3mhru9t5ntub9leihtls0cvsnc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static boolean showPicture = true; // global switch. if false, you get the normal text display instead of the smiley
static L emotions = litlist(
"#1001283", "happy",
"#1001284", "unhappy",
"#1001285", "oh",
"#1001286", "bored",
"#1001287", "wide mouth");
static int borderColor = 0xFFFFFFFF;
static S lastEmotionImage, lastEmotion /*, onScreenText = ""*/;
static void showText(S text) {
print(text);
/*if (neq(onScreenText, text) && lastEmotion != null) {
onScreenText = text;
emo_show();
}*/
}
static void emo(S emotion) {
if (!showPicture) return;
int i;
for (i = 0; i < emotions.size(); i += 2)
if (emotions.get(i+1).equalsIgnoreCase(emotion))
break;
if (i >= emotions.size()) {
print("Emotion not found: " + emotion);
// use the last one from the list as default
i -= 2;
}
lastEmotionImage = emotions.get(i);
lastEmotion = emotions.get(i+1);
emo_show();
}
static void emo_show() {
if (!showPicture) return;
androidShowClickableImageAndPrintLog(lastEmotionImage, borderColor, r {
if (manualStart)
//if (listening)
if (borderColor != -1) {
//androidLater(500, r { stopListening(); });
showText ("stop");
stopListening();
} else {
showText ("start");
newRecognizer(); }
});
}
static void setBorderColor(int color) {
if (color != borderColor) {
borderColor = color;
if (lastEmotion != null)
emo(lastEmotion);
}
}
static void happy() { emo("happy"); }
static void unhappy() { emo("unhappy"); }
static void oh() { emo("oh"); }
static void bored() { emo("bored"); }
static void wideMouth() { emo("wide mouth"); }
static void disappear() {
if (!showPicture) return;
happy();
androidLater(1000, runnable {
androidShowFullScreenColor(0xFFFFFFFF);
androidLater(1000, runnable {
System.exit(0); // totally unrecommended but works
});
});
}