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


Java TimelineItem.setText方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: submitText

import com.google.api.services.mirror.model.TimelineItem; //导入方法依赖的package包/类
public void submitText(String text) throws IOException {
	TimelineItem timelineItem = new TimelineItem();
	timelineItem.setText(text);
	MirrorClient.addDeleteMenuItem(timelineItem);
	MirrorClient.insertTimelineItem(credential(), timelineItem);
}
 
开发者ID:jwilsoncredera,项目名称:spring-boot-glass,代码行数:7,代码来源:TimelineService.java


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