blob: 8f24f16d66e11c2e64306158c04a20f769326498 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
package com.mapswithme.maps.maplayer.traffic;
import android.support.annotation.IntDef;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
final class TrafficState
{
interface StateChangeListener
{
// This method is called from JNI layer.
@SuppressWarnings("unused")
@MainThread
void onTrafficStateChanged(@Value int state);
}
@Retention(RetentionPolicy.SOURCE)
@IntDef({ DISABLED, ENABLED, WAITING_DATA, OUTDATED, NO_DATA, NETWORK_ERROR, EXPIRED_DATA, EXPIRED_APP})
@interface Value {}
// These values should correspond to
// TrafficManager::TrafficState enum (from map/traffic_manager.hpp)
static final int DISABLED = 0;
static final int ENABLED = 1;
static final int WAITING_DATA = 2;
static final int OUTDATED = 3;
static final int NO_DATA = 4;
static final int NETWORK_ERROR = 5;
static final int EXPIRED_DATA = 6;
static final int EXPIRED_APP = 7;
@MainThread
static native void nativeSetListener(@NonNull StateChangeListener listener);
static native void nativeRemoveListener();
static native void nativeEnable();
static native void nativeDisable();
static native boolean nativeIsEnabled();
private TrafficState() {}
static String nameOf(int state)
{
switch (state)
{
case DISABLED:
return "DISABLED";
case ENABLED:
return "ENABLED";
case WAITING_DATA:
return "WAITING_DATA";
case OUTDATED:
return "OUTDATED";
case NO_DATA:
return "NO_DATA";
case NETWORK_ERROR:
return "NETWORK_ERROR";
case EXPIRED_DATA:
return "EXPIRED_DATA";
case EXPIRED_APP:
return "EXPIRED_APP";
default:
return "Unknown: " + state;
}
}
}
|