zoukankan      html  css  js  c++  java
  • 谷歌眼镜--时间轴卡管理

    所有时间轴卡显示你的用户看到的内容是用户体验的核心。时间轴卡可以是文字,丰富的HTML,图像或视频。您也可以时间表卡捆绑在一起,成一个的时间表卡,扩展到一个子时间表,便于组织。

    谷歌镜API操作,如创建,更新,删除,更提供端点。

    时间轴卡的更多信息,请参阅以下资源:

      • 开发人员指南
      • 参考文档
      • UI指南

    1、开发人员指南

    下面是一个例子,一组布置在用户的时间轴的时间轴卡:

        

    1>插入一个时间表项目:

     http

    POST /mirror/v1/timeline HTTP/1.1
    Host: www.googleapis.com
    Authorization:Bearer{auth token}
    Content-Type: application/json
    Content-Length:26

    {"text":"Hello world"}

    java

    TimelineItem timelineItem =newTimelineItem();
    timelineItem
    .setText("Hello world");
    service
    .timeline().insert(timelineItem).execute();

    python

    timeline_item ={'text':'Hello world'}
    service
    .timeline().insert(body=timeline_item).execute()

    成功时,您会收到201创建响应代码创建项目的完整副本。对于前面的例子,一个成功的响应可能看起来像这样:

    HTTP/1.1201Created
    Date:Tue,25Sep201223:30:11 GMT
    Content-Type: application/json
    Content-Length:303

    {
     
    "kind":"glass#timelineItem",
     
    "id":"1234567890",
     
    "selfLink":"https://www.googleapis.com/mirror/v1/timeline/1234567890",
     
    "created":"2012-09-25T23:28:43.192Z",
     
    "updated":"2012-09-25T23:28:43.192Z",
     
    "etag":""G5BI0RWvj-0jWdBrdWrPZV7xPKw/t25selcGS3uDEVT6FB09hAG-QQ"",
     
    "text":"Hello world"
    }

    插入项目,将出现在用户的时间轴看起来像这样:

    2>插入带有附件的项目时间表:

     一张图片胜过千言万语,这是很多比你更可以融入一个时间表的项目。为此,你也可以附加图片和视频的时间表项目。如何插入一个时间表的项目照片附件下面是一个例子:

    http

    POST /upload/mirror/v1/timeline HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer {auth token}
    Content-Type: multipart/related; boundary="mymultipartboundary"
    Content-Length: {length}
    
    --mymultipartboundary
    Content-Type: application/json; charset=UTF-8
    
    { "text": "A solar eclipse of Saturn. Earth is also in this photo. Can you find it?" }
    --mymultipartboundary
    Content-Type: image/jpeg
    Content-Transfer-Encoding: binary
    
    [binary image data]
    --mymultipartboundary--

    java

    TimelineItem timelineItem = new TimelineItem();
    timelineItem.setText("Hello world");
    InputStreamContent mediaContent = new InputStreamContent(contentType, attachment);
    service.timeline().insert(timelineItem, mediaContent).execute();

    python

    timeline_item = {'text': 'Hello world'}
    media_body = MediaIoBaseUpload(
        io.BytesIO(attachment), mimetype=content_type, resumable=True)
    service.timeline().insert(body=timeline_item, media_body=media_body).execute()

    时间轴项目附加图像看起来像这样在玻璃上:

     Note: At a low level, attachments are uploaded using HTTP Multipart. Google APIs client libraries make this easy using media upload.

    最大的可能性冰法上传图片,使用谷歌api客户端更加方便实用

    3>增加视频

    POST /upload/mirror/v1/timeline HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer {auth token}
    Content-Type: multipart/related; boundary="mymultipartboundary"
    Content-Length: {length}
    
    --mymultipartboundary
    Content-Type: application/json; charset=UTF-8
    
    { "text": "Skateboarding kittens" }
    --mymultipartboundary
    Content-Type: video/vnd.google-glass.stream-url
    
    http://example.com/path/to/kittens.mp4
    --mymultipartboundary--

    See supported media formats for a list of supported media types.

    查看支持的视频格式列表

    3>阅读时间表项目

    你的服务可以访问所有的时间表,它创建项目,以及所有共享项目时间表。以下是如何 为您服务是可见的项目列出时间表。

    http

    GET /mirror/v1/timeline HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer {auth token}

    java

    TimelineItem timelineItem = new TimelineItem();
    service.timeline().list().execute();

    pyton

    service.timeline().list().execute()

    您可以使用其他REST操作, 更新和 删除时间轴项目。

    4>访问附件

    您可以访问附件的时间表项目名为“ 附件“通过一个数组属性然后,您可以通过contentUrl 物业附件或 附件端点的附件的二进制数据 

    注:附件内容是受保护的OAuth 2.0,就像其他调用的API端点。谷歌API客户端库提供访问附件使用媒体下载功能的二进制内容。

    http

    GET /mirror/v1/timeline/{itemId}/attachments/{attachmentId} HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer {auth token}

    java

    TimelineItem item = service.timeline().get(itemId).execute();
    String attachmentId = item.getAttachments().get(0).getId();
    service.attachments().get(itemId, attachmentId).executeAsInputStream();

    5>捆绑卡

    捆绑可以让你结合许多有关卡可扩展,可折叠成捆盖卡。束区别于正常时间轴卡的一个页面卷曲束的盖卡右上角。

    用户水龙头捆绑盖卡扩展卡捆绑到一个子时间表是独立在主时间轴上。用户可以刷卡子时间轴来查看卡,并通过刷卡,可以返回到主时间轴上来回。以下图片展示捆盖卡在右上角卷页和它下面的两个捆绑卡。

     

    有两种方式捆绑内容:寻呼和线程。

    使用分页的内容,不适合在单一时间轴卡。分页卡包中的所有共享相同的timelineId,因此有相同的一组菜单项。分页卡中,指定值 []属性timelineItem.htmlPages

    使用线程捆绑相关的项目,如电子邮件线程。主题时间表卡,创建他们bundleId相同的值 最近添 ​​加的项目是捆绑的封面卡。

  • 相关阅读:
    go引入包一直是红色,没有引入的解决办法
    php 把抛出错误记录到日志中
    亚马逊查询接口
    git 合并指定文件到另一个分支
    content-type
    Echarts(饼图Pie)
    DIN 模型速记
    DeepFM 要点速记
    youtube DNN 模型要点速记
    java设计模式之迭代器
  • 原文地址:https://www.cnblogs.com/tinytiny/p/3140502.html
Copyright © 2011-2022 走看看