• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TimelineItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: insertMultiHtmlTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void insertMultiHtmlTimelineItem( ServletContext ctx,
                                                 HttpServletRequest req )
    throws IOException, ServletException
{
  Mirror mirror = MirrorUtils.getMirror( req );
  Timeline timeline = mirror.timeline();

  // START:insertMultiHtmlTimelineItem
  // Generate a unique Lunch Roulette bundle id
  String bundleId = "lunchRoulette" + UUID.randomUUID();

  // First Cuisine Option
  TimelineItem timelineItem1 = new TimelineItem()
    .setHtml( renderRandomCuisine( ctx ) )
    .setBundleId( bundleId )
    .setIsBundleCover( true );
  timeline.insert( timelineItem1 ).execute();

  // Alternate Cuisine Option
  TimelineItem timelineItem2 = new TimelineItem()
    .setHtml( renderRandomCuisine( ctx ) )
    .setBundleId( bundleId );
  timeline.insert( timelineItem2 ).execute();
  // END:insertMultiHtmlTimelineItem
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:26,代码来源:LunchRoulette.java


示例2: insertAndSaveSimpleHtmlTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void insertAndSaveSimpleHtmlTimelineItem( ServletContext ctx,
                                                        String userId )
    throws IOException, ServletException
{
  Mirror mirror = MirrorUtils.getMirror( userId );
  Timeline timeline = mirror.timeline();

  // START:insertSimpleHtmlTimelineItem
  // get a cuisine, populate an object, and render the template
  String cuisine = getRandomCuisine();
  Map<String, String> data = Collections.singletonMap( "food", cuisine );
  String html = render( ctx, "glass/cuisine.ftl", data );

  TimelineItem timelineItem = new TimelineItem()
    .setTitle( "Lunch Roulette" )
    .setHtml( html )
    .setSpeakableText( "You should eat "+cuisine+" for lunch" );

  TimelineItem tiResp = timeline.insert( timelineItem ).execute();
  // END:insertSimpleHtmlTimelineItem

  setLunchRouletteId( userId, tiResp.getId() );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:24,代码来源:LunchRoulette.java


示例3: insertAndSaveSimpleTextTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void insertAndSaveSimpleTextTimelineItem( HttpServletRequest req )
    throws IOException
{
  String userId = SessionUtils.getUserId( req );
  Credential credential = AuthUtils.getCredential( userId );
  Mirror mirror = MirrorUtils.getMirror( credential );

  Timeline timeline = mirror.timeline();

  // START:insertAndSaveSimpleTimelineItem
  TimelineItem timelineItem = new TimelineItem()
    .setTitle( "Lunch Roulette" )
    .setText( getRandomCuisine() );

  TimelineItem tiResp = timeline.insert( timelineItem ).execute();
  
  setLunchRouletteId( userId, tiResp.getId() );
  // END:insertAndSaveSimpleTimelineItem
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:20,代码来源:LunchRoulette.java


示例4: welcome

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
@RequestMapping(value = "/greet")
public ModelAndView welcome(HttpServletRequest req, @RequestParam("greeting") String greeting) {

	// subscribe (only works deployed to production)
	String message = "";
	ModelAndView mav = new ModelAndView("info");
	try {

		mav.setViewName("greeting");
		mav.addObject("greeting", greeting);
		TimelineItem timelineItem  = mirrorTemplate.render(mav);			
		timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));
		TimelineItem insertedItem = mirrorTemplate.insertTimelineItem(timelineItem);
		message = "Inserted welcome message: " + insertedItem.getText();
		logger.info("Inserted welcome message " + greeting);
	} catch (Exception e) {
		logger.error("Could not send welcome  because " + e.getMessage(), e);
		message = "Could not send welcome. Check your log for details";
	}

	mav = new ModelAndView("info");
	mav.addObject("message", message);
	return mav;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:25,代码来源:MainController.java


示例5: insertPaginatedItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
@RequestMapping(value = "/insertPaginatedItem")
public ModelAndView insertPaginatedItem(HttpServletRequest req, @RequestParam("message") String message, @RequestParam("imageUrl") String imageUrl, @RequestParam("contentType") String contentType) throws Exception {

	String info = "";
	logger.info("Inserting Timeline Item");
	ModelAndView mav = new ModelAndView("samplePage");
	mav.addObject("hello", "Merhaba!");
	TimelineItem timelineItem = mirrorTemplate.render(mav);
	List<MenuItem> menuItemList = new ArrayList<MenuItem>();
	menuItemList.add(new MenuItem().setAction("OPEN_URI").setPayload(WebUtil.buildUrl(req, "/demo")));
	timelineItem.setMenuItems(menuItemList);

	// Triggers an audible tone when the timeline item is received
	timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));

	mirrorTemplate.insertTimelineItem(timelineItem);

	info = "A timeline item has been inserted.";
	mav = new ModelAndView("info");
	mav.addObject("message", info);
	return mav;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:23,代码来源:MainController.java


示例6: previewOnGlass

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
private void previewOnGlass() {
	try {
		Credential cred = GoogleLogin.getInstance().getCredential();
		cred.getAccessToken();
		Mirror m = new Mirror.Builder(GoogleNetHttpTransport.newTrustedTransport(), new JacksonFactory(), cred)
		.setApplicationName("Glassmaker Plugin")
		.build();

		String editorText = getDocumentProvider().getDocument(textEditor.getEditorInput()).get();
		deletePreviewFiles();
		TimelineItem timelineItem =  CardUtil.createTimeline(editorText);			
		Mirror.Timeline timeline = m.timeline();
		timeline.insert(timelineItem).execute();
		
	} catch (Exception e) {
		GlassmakerUIPlugin.logError(e.getMessage(), e);
	}
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:19,代码来源:CardEditor.java


示例7: createTimeLineItemWithAtachement

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
/**
 * The real Mirror API supports Multipart-bodies to attach images to cards, Emulator not, we will transformt the
 * card in one HTML TimeLineItem. https://github.com/Scarygami/mirror-api - REAMDME.md
 * 
 * @param content The initial timeline item.
 * @param mediaContent The attachement image.
 * @return The initial timeline item modified to look like one HTML card with the atachement.
 * @throws IOException
 * @throws FileNotFoundException
 */

public static TimelineItem createTimeLineItemWithAtachement(TimelineItem content,
        AbstractInputStreamContent mediaContent) throws IOException, FileNotFoundException {

    // We are going to transform the card in one HTML card.
    if (content.getHtml() != null && content.getHtml().isEmpty()) {
        // If the card already contains html then we do nothing
        LOG.log(Level.WARNING,
                "Emulation limitation : Images are transformes in HTML card, you must choose, or HTML or Attachement. your attachement will be ignored. ");
    } else {
        // Store the image
        String attachementURL = storeAttachement(mediaContent);

        // Transform card in one HTML card
        String cardText = content.getText() != null ? content.getText() : "";
        String html = "<article class=\"photo\">  <img src="
                + attachementURL
                + " width=\"100%\" height=\"100%\">  <div class=\"photo-overlay\"></div>  <section>    <p class=\"text-auto-size\">"
                + cardText + "</p>  </section></article>";
        content.setHtml(html);
    }
    return content;
}
 
开发者ID:MarcosBermudez,项目名称:java-mirror-api-emulator,代码行数:34,代码来源:EmulatorUtil.java


示例8: insertSimpleTextTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void insertSimpleTextTimelineItem( HttpServletRequest req )
    throws IOException
{
  Mirror mirror = MirrorUtils.getMirror( req );
  Timeline timeline = mirror.timeline();
  
  TimelineItem timelineItem = new TimelineItem()
    .setText( getRandomCuisine() );
  
  timeline.insert( timelineItem ).executeAndDownloadTo( System.out );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:12,代码来源:LunchRoulette.java


示例9: getLastSavedTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static TimelineItem getLastSavedTimelineItem( String userId )
    throws IOException
{
  Credential credential = AuthUtils.getCredential( userId );
  Mirror mirror = MirrorUtils.getMirror( credential );
  Timeline timeline = mirror.timeline();

  // START:getLastSavedTimelineItem
  String id = getLunchRouletteId( userId );

  TimelineItem timelineItem = timeline.get( id ).execute();
  // END:getLastSavedTimelineItem

  return timelineItem;
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:16,代码来源:LunchRoulette.java


示例10: setSimpleMenuItems

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void setSimpleMenuItems( TimelineItem ti, boolean hasRestaurant ) {
  // Add blank menu list
  ti.setMenuItems( new LinkedList<MenuItem>() );
  
  ti.getMenuItems().add( new MenuItem().setAction( "READ_ALOUD" ) );
  ti.getMenuItems().add( new MenuItem().setAction( "DELETE" ) );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:8,代码来源:LunchRoulette.java


示例11: doGet

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws IOException, ServletException
{
  ServletContext ctx = getServletContext();
  
  String userId = SessionUtils.getUserId( req );
  TimelineItem timelineItem = LunchRoulette.getLastSavedTimelineItem(userId);

  // If it exists, isn't deleted, and is pinned, then update
  if (timelineItem != null
      && !(timelineItem.getIsDeleted() != null && timelineItem.getIsDeleted())
      && (timelineItem.getIsPinned() != null && timelineItem.getIsPinned()))
  {
    String html = LunchRoulette.renderRandomCuisine( ctx );
    timelineItem.setHtml( html );

    // update the old timeline item
    Timeline timeline = MirrorUtils.getMirror( userId ).timeline();
    timeline.patch( timelineItem.getId(), timelineItem ).execute();
  }
  // Otherwise, create a new one
  else {
    LunchRoulette.insertAndSaveSimpleHtmlTimelineItem( ctx, userId );
  }

  resp.setContentType("text/plain");
  resp.getWriter().append( "Inserted Timeline Item" );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:29,代码来源:LunchRouletteServlet.java


示例12: buildRandomRestaurantTimelineItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static TimelineItem buildRandomRestaurantTimelineItem(
                               ServletContext ctx, String userId )
    throws IOException, ServletException
{
  Mirror mirror = MirrorUtils.getMirror( userId );

  Location location = mirror.locations().get("latest").execute();

  double latitude = location.getLatitude();
  double longitude = location.getLongitude();

  // START:insertRandomRestaurantTimelineItem
  // get a nearby restaurant from Google Places
  Place restaurant = getRandomRestaurant(latitude, longitude);
  // create a timeline item with restaurant information
  TimelineItem timelineItem = new TimelineItem()
    .setHtml( render( ctx, "glass/restaurant.ftl", restaurant ) )
    .setTitle( "Lunch Roulette" )
    .setMenuItems( new LinkedList<MenuItem>() )
    .setLocation(
      new Location()
        .setLatitude( restaurant.getLatitude() )
        .setLongitude( restaurant.getLongitude() )
        .setAddress( restaurant.getAddress() )
        .setDisplayName( restaurant.getName() )
        .setKind( restaurant.getKind() ) );
  // Add the NAVIGATE menu item
  timelineItem.getMenuItems().add(
    new MenuItem().setAction( "NAVIGATE" )
  );
  // END:insertRandomRestaurantTimelineItem
  timelineItem.getMenuItems().add(
    new MenuItem().setAction( "DELETE" )
  );

  return timelineItem;
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:38,代码来源:LunchRoulette.java


示例13: pushPost

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
/**
 * Create a timeline item for every follower of this blog
 */
// START:pushPost
private static void pushPost( Blog blog, Post post )
  throws IOException
{
  // find every user that follows that nickname
  List<User> users = blog.getFollowers();
  for (User user : users) {
    String userId = user.getId();
    Mirror mirror = MirrorUtils.getMirror( userId );
    TimelineItem timelineItem = new TimelineItem()
      .setText( post.getBody() );
    mirror.timeline().insert( timelineItem ).execute();
  }
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:18,代码来源:BlogHelper.java


示例14: addDeleteMenuItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
/**
 * Adds the "delete" menu option to the given {@link TimelineItem}<br>
 * to allow users to delete the item while using their Glass.
 */
public static void addDeleteMenuItem(TimelineItem timelineItem) {
	List<MenuItem> existingMenuItems = timelineItem.getMenuItems();
	if (existingMenuItems == null) {
		existingMenuItems = new ArrayList<MenuItem>();
		timelineItem.setMenuItems(existingMenuItems);
	}
	existingMenuItems.add(new MenuItem().setAction("DELETE"));
}
 
开发者ID:jwilsoncredera,项目名称:spring-boot-glass,代码行数:13,代码来源:MirrorClient.java


示例15: bootstrapNewUser

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
/**
 * Bootstrap a new user. Do all of the typical actions for a new user:
 * <ul>
 * <li>Creating a timeline subscription</li>
 * <li>Inserting a contact</li>
 * <li>Sending the user a welcome message</li>
 * </ul>
 */
public static void bootstrapNewUser(HttpServletRequest req, String userId) throws IOException {
  Credential credential = AuthUtil.newAuthorizationCodeFlow().loadCredential(userId);

  try {
    // Subscribe to locations updates
    Subscription subscription =
        MirrorClient.insertSubscription(credential, WebUtil.buildUrl(req, "/notify"), userId,
            "locations");
    LOG.info("Bootstrapper inserted subscription " + subscription
        .getId() + " for user " + userId);
  } catch (GoogleJsonResponseException e) {
    LOG.warning("Failed to create locations subscription. Might be running on "
        + "localhost. Details:" + e.getDetails().toPrettyString());
  }

  // Send welcome timeline item
  TimelineItem timelineItem = new TimelineItem();
  timelineItem.setText("Welcome to Kitty Compass");
  timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));
  final HttpServletRequest finalReq = req;
  timelineItem.setMenuItems(
      Lists.newArrayList(new MenuItem()
          .setAction("OPEN_URI")
          .setPayload("kittycompass://open")
          .setValues(Lists.newArrayList(new MenuValue()
              .setDisplayName("Open")
              .setIconUrl(WebUtil.buildUrl(finalReq, "/static/images/ic_compass.png"))
          ))
      )
  );


  TimelineItem insertedItem = MirrorClient.insertTimelineItem(credential, timelineItem);
  LOG.info("Bootstrapper inserted welcome message " + insertedItem.getId() + " for user "
      + userId);
}
 
开发者ID:mimming,项目名称:kitty-compass,代码行数:45,代码来源:NewUserBootstrapper.java


示例16: insertItem

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
@RequestMapping(value = "/insertItem")
public ModelAndView insertItem(@RequestParam("message") String message, @RequestParam("imageUrl") String imageUrl, @RequestParam("contentType") String contentType) throws IOException {

	String info = "";
	logger.info("Inserting Timeline Item");
	TimelineItem timelineItem = new TimelineItem();

	if (message != null) {
		timelineItem.setText(message);
	}

	// Triggers an audible tone when the timeline item is received
	timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));

	if (imageUrl != null) {
		// Attach an image, if we have one
		URL url = new URL(imageUrl);

		mirrorTemplate.insertTimelineItem(timelineItem, contentType, url.openStream());
	} else {
		mirrorTemplate.insertTimelineItem(timelineItem);
	}

	info = "A timeline item has been inserted.";
	ModelAndView mav = new ModelAndView("info");
	mav.addObject("message", info);
	return mav;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:29,代码来源:MainController.java


示例17: insertItemWithAction

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
@RequestMapping(value = "/insertItemWithAction")
public ModelAndView insertItemWithAction(HttpServletRequest req, @RequestParam("question") String question) throws Exception {

	String info = "";
	logger.info("Inserting Timeline Item");

	ModelAndView mav = new ModelAndView("samplePage");
	mav.addObject("hello", "Merhaba!");
	TimelineItem timelineItem = mirrorTemplate.render(mav);

	List<MenuItem> menuItemList = new ArrayList<MenuItem>();
	// Built in actions
	menuItemList.add(new MenuItem().setAction("REPLY"));
	menuItemList.add(new MenuItem().setAction("READ_ALOUD"));

	// And custom actions
	List<MenuValue> menuValues = new ArrayList<MenuValue>();
	menuValues.add(new MenuValue().setIconUrl(WebUtil.buildUrl(req, "/assets/images/menu_icons/ic_person_50.png")).setDisplayName("Ask Us"));
	menuItemList.add(new MenuItem().setValues(menuValues).setId("askus").setAction("CUSTOM"));
	timelineItem.setMenuItems(menuItemList);
	timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));

	mirrorTemplate.insertTimelineItem(timelineItem);

	info = "A timeline item has been inserted.";
	mav = new ModelAndView("info");
	mav.addObject("message", info);
	return mav;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:30,代码来源:MainController.java


示例18: createTimeline

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static TimelineItem createTimeline(String htmlFragment) {
	int indexOfArticle = htmlFragment.indexOf("<article");
	boolean hasArticle = indexOfArticle >= 0;
	TimelineItem timelineItem = new TimelineItem();
	if(hasArticle){
		timelineItem.setHtml(htmlFragment);
	}else{
		timelineItem.setText(htmlFragment);
	}
	// Triggers an audible tone when the timeline item is received
	timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));

	return timelineItem;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:15,代码来源:CardUtil.java


示例19: doGet

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	// get Access to Mirror Api
	Mirror mirror = getMirror(req);
	
	// get TimeLine
	Timeline timeline = mirror.timeline();
		
	try {
	    JSONObject json = new JSONObject(retrieveIPool());
	    JSONArray arr = json.getJSONArray("documents");
	    JSONArray media = new JSONArray();
	    
	    String title = null;
	    String content = null;
	    String URL = null;
	    
	    for (int i = 0; i < arr.length(); i++) {
	        title = arr.getJSONObject(i).getString("title");
	        // maybe for future use but for tts needs to be stripped from html tags
	        //content = arr.getJSONObject(i).getString("content");
	        media = arr.getJSONObject(i).getJSONArray("contentReferences");   
	    }
	    		    
	    if (media.length()!=0){
		    for (int i = 0; i < media.length(); i++) {
		    	URL = media.getJSONObject(i).getString("externalUrl");   
		    }
	    }
    
	    String html = "<article class=\"photo\">\n  <img src=\""+URL+"\" width=\"100%\" height=\"100%\">\n  <div class=\"overlay-gradient-tall-dark\"/>\n  <section>\n    <p class=\"text-auto-size\">"+title+"</p>\n  </section>\n</article>";
	    
	 // create a timeline item
		TimelineItem timelineItem = new TimelineItem()
			//.setSpeakableText(content)
			.setSpeakableText(title)
			.setHtml(html)
			.setDisplayTime(new DateTime(new Date()))
			.setNotification(new NotificationConfig().setLevel("Default"));
		
		// add menu items with built-in actions
		List<MenuItem> menuItemList = new ArrayList<MenuItem>();
		menuItemList.add(new MenuItem().setAction("DELETE"));
		menuItemList.add(new MenuItem().setAction("READ_ALOUD"));
		menuItemList.add(new MenuItem().setAction("TOGGLE_PINNED"));
		timelineItem.setMenuItems(menuItemList);
		
		// insert the crad into the timeline
		timeline.insert(timelineItem).execute();
		
		//print out results on the web browser
		resp.setContentType("text/html; charset=utf-8");
		//resp.setCharacterEncoding("UTF-8");
		resp.getWriter().println(
				"<html><head><meta http-equiv=\"refresh\" content=\"3;url=/index.html\"></head> "
						+ "<body>"+html+"</body></html>");
	} catch (JSONException e) {
	    
	    StringWriter errors = new StringWriter();
	    e.printStackTrace(new PrintWriter(errors));
	    String error =  errors.toString();
	    
	    //resp.setContentType("text/html; charset=utf-8");
	    resp.setCharacterEncoding("UTF-8");
		resp.getWriter().println(
				"<html><head><meta http-equiv=\"refresh\" content=\"3;url=/index.html\"></head> "
						+ "<body>JSON Exception " +error+" </body></html>");
	}
}
 
开发者ID:ipool,项目名称:GlassPool,代码行数:70,代码来源:IpoolAPIClient.java


示例20: setAllMenuItems

import com.google.api.services.mirror.model.TimelineItem; //导入依赖的package包/类
public static void setAllMenuItems( TimelineItem ti, boolean hasRestaurant )
{
  // Add blank menu list
  ti.setMenuItems( new LinkedList<MenuItem>() );

  ti.getMenuItems().add( new MenuItem().setAction( "READ_ALOUD" ) );
  ti.getMenuItems().add( new MenuItem().setAction( "SHARE" ) );

  if( hasRestaurant ) {
    // add custom menu item
    List<MenuValue> menuValues = new ArrayList<MenuValue>(2);
    menuValues.add( new MenuValue()
      .setState( "DEFAULT" )
      .setDisplayName( "Alternative" )
      // .setIconUrl( "" )
    );
    menuValues.add( new MenuValue()
      .setState( "PENDING" )
      .setDisplayName( "Generating Alternative" ) );

    ti.getMenuItems().add( new MenuItem()
      .setAction( "CUSTOM" )
        .setId( "ALT" )
        .setPayload( "ALT" )
        .setValues( menuValues )
    );

    ti.getMenuItems().add( new MenuItem()
    .setAction( "CUSTOM" )
      .setId( "ADD_CONTACT" )
      .setPayload( "ADD_CONTACT" )
      .setRemoveWhenSelected( true )
      .setValues( Collections.singletonList( new MenuValue()
        .setState( "DEFAULT" )
        .setDisplayName( "Add As Contact" ) ) 
      )
    );
  }
  
  ti.getMenuItems().add( new MenuItem().setAction( "TOGGLE_PINNED" ) );

  if( hasRestaurant ) {
    // Call and navigate to the restaurant, only if we have one
    ti.getMenuItems().add( new MenuItem().setAction( "VOICE_CALL" ) );
    ti.getMenuItems().add( new MenuItem().setAction( "NAVIGATE" ) );
    
    // only if we have a restaurant website
    // addMenuItem(ti, "VIEW_WEBSITE");
  }

  // It's good form to make DELETE the last item
  ti.getMenuItems().add( new MenuItem().setAction( "DELETE" ) );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:54,代码来源:LunchRoulette.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OWLPropertyExpression类代码示例发布时间:2022-05-22
下一篇:
Java AndroidNotification类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap