Added new libraries and made it so it can speak dutch

This commit is contained in:
2024-04-24 13:58:27 +02:00
parent 0482c2b386
commit ea184c9fc4

View File

@@ -9,7 +9,11 @@ import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
import com.aldebaran.qi.sdk.builder.SayBuilder;
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
import com.aldebaran.qi.sdk.design.activity.conversationstatus.SpeechBarDisplayStrategy;
import com.aldebaran.qi.sdk.object.conversation.Phrase;
import com.aldebaran.qi.sdk.object.conversation.Say;
import com.aldebaran.qi.sdk.object.locale.Language;
import com.aldebaran.qi.sdk.object.locale.Locale;
import com.aldebaran.qi.sdk.object.locale.Region;
public class MainActivity extends RobotActivity implements RobotLifecycleCallbacks {
@@ -30,13 +34,24 @@ public class MainActivity extends RobotActivity implements RobotLifecycleCallbac
@Override
public void onRobotFocusGained(QiContext qiContext) {
// Create a new say action.
Say say = SayBuilder.with(qiContext) // Create the builder with the context.
.withText("Hallo hoe gaat het?") // Set the text to say.
.build(); // Build the say action.
String locationName = ("Krijg de tyfus");
String locationDescription = ("Je bent een teringlijer");
Locale locale = new Locale(Language.DUTCH, Region.NETHERLANDS);
// Execute the action.
say.run();
Phrase namePhrase = new Phrase("This location is " + locationName);
Say sayName = SayBuilder.with(qiContext)
.withPhrase(namePhrase)
.withLocale(locale)
.build();
Phrase descriptionPhrase = new Phrase(locationDescription);
Say sayDescription = SayBuilder.with(qiContext)
.withPhrase(descriptionPhrase)
.withLocale(locale)
.build();
sayName.run();
sayDescription.run();
}
@Override