当前位置: 首页>>代码示例>>Java>>正文


Java SimpleCard类代码示例

本文整理汇总了Java中com.amazon.speech.ui.SimpleCard的典型用法代码示例。如果您正苦于以下问题:Java SimpleCard类的具体用法?Java SimpleCard怎么用?Java SimpleCard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleCard类属于com.amazon.speech.ui包,在下文中一共展示了SimpleCard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWelcomeResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates and returns a {@code SpeechletResponse} with a welcome message.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getWelcomeResponse() {
    String speechText = "Welcome to the Alexa Skills Kit, you can say hello";

    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);

    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);

    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:arun-gupta,项目名称:alexa-skill-java,代码行数:24,代码来源:HelloWorldSpeechlet.java

示例2: getHelloResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates a {@code SpeechletResponse} for the hello intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getHelloResponse(int times) {
    String speechText = "";
    for (int i=0; i<times; i++) {
        speechText += "Hello world " + (i+1) + " time. ";
    }
    
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);

    return SpeechletResponse.newTellResponse(speech, card);
}
 
开发者ID:arun-gupta,项目名称:alexa-skill-java,代码行数:23,代码来源:HelloWorldSpeechlet.java

示例3: getHelloDbResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
private SpeechletResponse getHelloDbResponse(Person person, String id) {
    String speechText = "";
    
    if (person != null && person.getId() != null)
        speechText = "Name of the person with id " + person.getId() + " is " + person.getName();
    else
        speechText = "No person found with id " + id;

    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloDbWorld");
    card.setContent(speechText);

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);

    return SpeechletResponse.newTellResponse(speech, card);
}
 
开发者ID:arun-gupta,项目名称:alexa-skill-java,代码行数:20,代码来源:HelloWorldSpeechlet.java

示例4: getHelpResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates a {@code SpeechletResponse} for the help intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getHelpResponse() {
    String speechText = "You can say hello to me!";

    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);

    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);

    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:arun-gupta,项目名称:alexa-skill-java,代码行数:24,代码来源:HelloWorldSpeechlet.java

示例5: buildCardSpeechletResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
static public SpeechletResponse buildCardSpeechletResponse(final String output, final boolean shouldEndSession) {
    SimpleCard card = new SimpleCard();
    card.setTitle(AlexaSpeechlet.SKILLNAME);
    card.setContent(String.format("%s", output));

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(output);

    // Create the speechlet response.
    SpeechletResponse response = new SpeechletResponse();
    response.setShouldEndSession(shouldEndSession);
    response.setOutputSpeech(speech);
    response.setCard(card);
    return response;
}
 
开发者ID:hennroja,项目名称:rh-dropwizard-alexa,代码行数:17,代码来源:IntentHandler.java

示例6: handleConfirmed

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
private SpeechletResponse handleConfirmed(IntentRequest request, Session session)
    throws CalendarWriteException {
  final String dateFormat = session.getAttribute(SESSION_DATE_FORMAT).toString();
  final DateTimeFormatter parser = DateTimeFormat.forPattern(dateFormat);
  final String title = collectSummary(request);
  final String calendar = session.getAttribute(SESSION_CALENDAR) != null ? session.getAttribute(SESSION_CALENDAR).toString() : null;
  final String from = session.getAttribute(SESSION_FROM).toString();
  final String to = session.getAttribute(SESSION_TO).toString();

  calendarService.createEvent(calendar, title,
      parser.parseDateTime(from),
      parser.parseDateTime(to));

  SimpleCard card = new SimpleCard();
  card.setTitle(messageService.de("event.new.card.title"));
  card.setContent(messageService.de("event.new.card.content", title, from, to));

  session.removeAttribute(BasicSpeechlet.KEY_DIALOG_TYPE);

  return SpeechletResponse.newTellResponse(
      speechService.speechNewEventSaved(request.getLocale()),
      card);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:24,代码来源:NewEventSpeechlet.java

示例7: getWelcomeResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates and returns a {@code SpeechletResponse} with a welcome message.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
@OnLaunch
public SpeechletResponse getWelcomeResponse() {
  String speechText = "Welcome to the Alexa Skills Kit, you can say hello";

  // Create the Simple card content.
  SimpleCard card = new SimpleCard();
  card.setTitle("HelloWorld");
  card.setContent(speechText);

  // Create the plain text output.
  PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
  speech.setText(speechText);

  // Create reprompt
  Reprompt reprompt = new Reprompt();
  reprompt.setOutputSpeech(speech);

  return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:25,代码来源:HelloWorldSpeechlet.java

示例8: getHelloResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates a {@code SpeechletResponse} for the hello intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
@OnIntent("HelloWorldIntent")
public SpeechletResponse getHelloResponse() {
  String speechText = "Hello world";

  // Create the Simple card content.
  SimpleCard card = new SimpleCard();
  card.setTitle("HelloWorld");
  card.setContent(speechText);

  // Create the plain text output.
  PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
  speech.setText(speechText);

  return SpeechletResponse.newTellResponse(speech, card);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:21,代码来源:HelloWorldSpeechlet.java

示例9: getHelpResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates a {@code SpeechletResponse} for the help intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
@OnIntent({ "AMAZON.HelpIntent", "AMAZON.StopIntent", "AMAZON.CancelIntent" })
public SpeechletResponse getHelpResponse() {
  String speechText = "You can say hello to me!";

  // Create the Simple card content.
  SimpleCard card = new SimpleCard();
  card.setTitle("HelloWorld");
  card.setContent(speechText);

  // Create the plain text output.
  PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
  speech.setText(speechText);

  // Create reprompt
  Reprompt reprompt = new Reprompt();
  reprompt.setOutputSpeech(speech);

  return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:25,代码来源:HelloWorldSpeechlet.java

示例10: onLaunch

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException {
    String speechText = "Hello world, this is Snoolexa! Try asking for hot posts!";

    //TODO: Query the me endpoint and tell asker about currently signed in redditor and any notifications

    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("Snoolexa");
    card.setContent(speechText);

    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);

    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);

    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:winterton,项目名称:snoolexa,代码行数:22,代码来源:SnoolexaSpeechlet.java

示例11: buildSpeechletResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
private SpeechletResponse buildSpeechletResponse(AlexaResponse controllerResponse, String title) {
	// Create the Simple card content.
       SimpleCard card = new SimpleCard();
       card.setTitle(String.format("Response from Alexa Skill"));
       card.setContent(controllerResponse.getContent());

       // Create the plain text output.
       PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
       speech.setText(controllerResponse.getContent());

       // Create the speechlet response.
       SpeechletResponse response = new SpeechletResponse();
       response.setShouldEndSession(controllerResponse.getShouldEndInteraction());
       response.setOutputSpeech(speech);
       response.setCard(card);
       return response;
}
 
开发者ID:rs22,项目名称:alexa-routing,代码行数:18,代码来源:SpeechRouter.java

示例12: getWelcomeResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates and returns a {@code SpeechletResponse} with a welcome message.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getWelcomeResponse() {
	String speechText = "This is Sky, how can I help you";

	// create the Simple card content
	SimpleCard card = new SimpleCard();
	card.setTitle("Sky");
	card.setContent(speechText);

	// create the plain text output
	PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
	speech.setText(speechText);

	// create reprompt
	Reprompt reprompt = new Reprompt();
	reprompt.setOutputSpeech(speech);

	return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:24,代码来源:SkySpeechlet.java

示例13: getPauseResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
private SpeechletResponse getPauseResponse() {
	String speechText;

	// create the card
	SimpleCard card = new SimpleCard();
	card.setTitle("Pause");

	// create the plain text output
	PlainTextOutputSpeech speech = new PlainTextOutputSpeech();

	try {
		pauseRecording();
		speechText = "Paused playback";

		setFeedback(speechText, speech, card);
	}
	catch (Exception e) {
		reportException(e, speech, card);
		speech.setText("Failed to pause playback");
	}

	return SpeechletResponse.newTellResponse(speech, card);
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:24,代码来源:SkySpeechlet.java

示例14: getStopResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
private SpeechletResponse getStopResponse() {
	String speechText;

	// create the card
	SimpleCard card = new SimpleCard();
	card.setTitle("Stop");

	// create the plain text output
	PlainTextOutputSpeech speech = new PlainTextOutputSpeech();

	try {
		stopRecording();
		speechText = "Stopped playback";

		setFeedback(speechText, speech, card);
	}
	catch (Exception e) {
		reportException(e, speech, card);
		speech.setText("Failed to stop playback");
	}

	return SpeechletResponse.newTellResponse(speech, card);
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:24,代码来源:SkySpeechlet.java

示例15: getHelpResponse

import com.amazon.speech.ui.SimpleCard; //导入依赖的package包/类
/**
 * Creates a {@code SpeechletResponse} for the help intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getHelpResponse() {
	String speechText = "I am not a very helpful skill I'm afraid!";

	// Create the Simple card content.
	SimpleCard card = new SimpleCard();
	card.setTitle("Sky");
	card.setContent(speechText);

	// Create the plain text output.
	PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
	speech.setText(speechText);

	// Create reprompt
	Reprompt reprompt = new Reprompt();
	reprompt.setOutputSpeech(speech);

	return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:24,代码来源:SkySpeechlet.java


注:本文中的com.amazon.speech.ui.SimpleCard类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。