blob: 323d2c0f1502160789ca7b304000a425c64e4506 (
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
|
package com.mapbox.mapboxsdk.testapp.utils;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.WorkerThread;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class FinishLoadingStyleIdlingResource extends MapboxIdlingResource {
@WorkerThread
public FinishLoadingStyleIdlingResource(final Activity activity) {
new Handler(Looper.getMainLooper()).post(() -> inflateMap(activity));
}
@Override
public void initMap(MapboxMap mapboxMap) {
super.initMap(mapboxMap);
mapboxMap.getStyle(style -> {
assertNotNull(style);
assertTrue(style.isFullyLoaded());
if (resourceCallback != null) {
resourceCallback.onTransitionToIdle();
}
});
}
@Override
public boolean isIdleNow() {
return getMapboxMap() != null && getMapboxMap().getStyle() != null;
}
}
|