本文整理汇总了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));
}
示例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;
}