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


Java DetectedActivityFence.IN_VEHICLE属性代码示例

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


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

示例1: testValues

@Test
public void testValues() {
    StorableActivityFence fence = StorableActivityFence.starting(
            DetectedActivityFence.IN_VEHICLE, DetectedActivityFence.RUNNING);
    int[] startActivities = {DetectedActivityFence.IN_VEHICLE, DetectedActivityFence.RUNNING};
    assertThat(fence.getType(), Matchers.is(StorableFence.Type.ACTIVITY));
    assertThat(fence.getActivityTypes(), is(startActivities));
    assertThat(fence.getTransitionType(), is(StorableActivityFence.START_TYPE));

    fence = StorableActivityFence.stopping(
            DetectedActivityFence.ON_BICYCLE, DetectedActivityFence.WALKING);
    int[] stopActivities = {DetectedActivityFence.ON_BICYCLE, DetectedActivityFence.WALKING};
    assertThat(fence.getType(), Matchers.is(StorableFence.Type.ACTIVITY));
    assertThat(fence.getActivityTypes(), is(stopActivities));
    assertThat(fence.getTransitionType(), is(StorableActivityFence.STOP_TYPE));

    fence = StorableActivityFence.during(
            DetectedActivityFence.ON_FOOT, DetectedActivityFence.STILL, DetectedActivityFence.UNKNOWN);
    int[] duringActivities = {DetectedActivityFence.ON_FOOT, DetectedActivityFence.STILL, DetectedActivityFence.UNKNOWN};
    assertThat(fence.getType(), Matchers.is(StorableFence.Type.ACTIVITY));
    assertThat(fence.getActivityTypes(), is(duringActivities));
    assertThat(fence.getTransitionType(), is(StorableActivityFence.DURING_TYPE));
}
 
开发者ID:djavan-bertrand,项目名称:JCVD,代码行数:23,代码来源:StorableActivityFenceTest.java

示例2: getFenceStr

public String getFenceStr(StorableFence fence) {
    String str = "";
    switch (fence.getType()) {
        case ACTIVITY:
            for (@StorableActivityFence.ActivityType int act : ((StorableActivityFence) fence).getActivityTypes()) {
                if (!str.isEmpty()) {
                    str += ", ";
                }
                switch (act) {
                    case DetectedActivityFence.IN_VEHICLE:
                        str += "IN_VEHICLE";
                        break;
                    case DetectedActivityFence.ON_BICYCLE:
                        str += "ON_BICYCLE";
                        break;
                    case DetectedActivityFence.ON_FOOT:
                        str += "ON_FOOT";
                        break;
                    case DetectedActivityFence.RUNNING:
                        str += "RUNNING";
                        break;
                    case DetectedActivityFence.STILL:
                        str += "STILL";
                        break;
                    case DetectedActivityFence.WALKING:
                        str += "WALKING";
                        break;
                    case DetectedActivityFence.UNKNOWN:
                    default:
                        str += "UNKNOWN";
                        break;
                }
            }
            break;
        case LOCATION:
            StorableLocationFence locFence = (StorableLocationFence) fence;
            str += "(" + locFence.getLatitude() + ", " + locFence.getLongitude() + ") ";
            break;
        default:
            break;
    }
    return str;
}
 
开发者ID:djavan-bertrand,项目名称:JCVD,代码行数:43,代码来源:FenceRecyclerAdapter.java


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