首页 > 解决方案 > Bixby:想在我的胶囊中实现秒表

问题描述

我想为我的胶囊显示秒表(计时器)。

那么,有什么方法可以在我的视图页面中显示计时器,它会每秒刷新一次。我不明白从哪里开始。时间将如何刷新?

对此有任何帮助。

标签: bixbybixbystudio

解决方案


您可以使用内置的刷新命令重新绘制屏幕。例如,

result-view {
  match {
    Activity (this) {
      min (Required)
      max (One)
      from-output: CheckRideShareStatus (check)
    }
  }
  message {
    if (this.countdown != 0) {
      template ("Your ride will arrive in #{value(this.countdown)} seconds.") 
    } else {
      template ("I hope you are enjoying your ride")
    }
  }
  refresh {
  if (this.countdown != 0) {
    spec {
      delay-seconds (5)
      with-request {
        intent {
          goal: CheckRideShareStatus
          value {
            $expr (this)
          }
        }
      }
    }
  }
}
  render {
    layout-macro (activity-map-macro) {
      param (activity) {
        expression (this)
      }
    }
  }
}

Bixby 团队在Github上提供了一个工作示例

此处刷新详情


推荐阅读