File tree Expand file tree Collapse file tree 6 files changed +56
-1
lines changed
main/java/com/mapzen/places/api/internal
test/java/com/mapzen/places/api/internal Expand file tree Collapse file tree 6 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public class PlacePickerActivity extends Activity implements
5858 }
5959
6060 mapView = (MapView ) findViewById (R .id .mz_map_view );
61- mapView .getMapAsync (this );
61+ presenter .getMapAsync (mapView , this );
6262
6363 final PlaceDialogFragment fragment =
6464 (PlaceDialogFragment ) getFragmentManager ().findFragmentByTag (PlaceDialogFragment .TAG );
Original file line number Diff line number Diff line change 11package com .mapzen .places .api .internal ;
22
3+ import com .mapzen .android .graphics .MapView ;
4+ import com .mapzen .android .graphics .OnMapReadyCallback ;
35import com .mapzen .places .api .Place ;
46
57import java .util .Map ;
810 * Interface for managing state associated with the {@link PlacePickerViewController}.
911 */
1012interface PlacePickerPresenter {
13+
14+ /**
15+ * Get a reference to {@link com.mapzen.android.graphics.MapzenMap}.
16+ * @param mapView
17+ */
18+ void getMapAsync (MapView mapView , OnMapReadyCallback callback );
19+
1120 /**
1221 * Sets the presenter's controller. Must be called before any other methods in the interface
1322 * can be called.
Original file line number Diff line number Diff line change 11package com .mapzen .places .api .internal ;
22
3+ import com .mapzen .android .graphics .MapView ;
4+ import com .mapzen .android .graphics .OnMapReadyCallback ;
35import com .mapzen .places .api .Place ;
46
57import android .util .Log ;
@@ -25,6 +27,10 @@ class PlacePickerPresenterImpl implements PlacePickerPresenter {
2527 detailFetcher = fetcher ;
2628 }
2729
30+ @ Override public void getMapAsync (MapView mapView , OnMapReadyCallback callback ) {
31+ mapView .getMapAsync (new PlacesBubbleWrapStyle (), callback );
32+ }
33+
2834 @ Override public void setController (PlacePickerViewController controller ) {
2935 this .controller = controller ;
3036 }
Original file line number Diff line number Diff line change 1+ package com .mapzen .places .api .internal ;
2+
3+ import com .mapzen .android .graphics .model .BubbleWrapStyle ;
4+
5+ /**
6+ * Style used for place picker UI. Sets highest label level as default label level.
7+ */
8+ class PlacesBubbleWrapStyle extends BubbleWrapStyle {
9+
10+ @ Override public int getDefaultLabelLevel () {
11+ return 11 ;
12+ }
13+ }
Original file line number Diff line number Diff line change 11package com .mapzen .places .api .internal ;
22
3+ import com .mapzen .android .graphics .MapView ;
4+ import com .mapzen .android .graphics .OnMapReadyCallback ;
35import com .mapzen .places .api .Place ;
46
57import org .junit .Before ;
810import java .util .HashMap ;
911
1012import static org .assertj .core .api .Assertions .assertThat ;
13+ import static org .mockito .Matchers .any ;
14+ import static org .mockito .Matchers .eq ;
15+ import static org .mockito .Mockito .mock ;
16+ import static org .mockito .Mockito .verify ;
1117
1218public class PlacePickerPresenterTest {
1319
@@ -20,6 +26,13 @@ public class PlacePickerPresenterTest {
2026 presenter .setController (controller );
2127 }
2228
29+ @ Test public void getMapAsync_shouldLoadPlacesBubbleWrapStyle () throws Exception {
30+ MapView mapView = mock (MapView .class );
31+ OnMapReadyCallback callback = mock (OnMapReadyCallback .class );
32+ presenter .getMapAsync (mapView , callback );
33+ verify (mapView ).getMapAsync (any (PlacesBubbleWrapStyle .class ), eq (callback ));
34+ }
35+
2336 @ Test public void onLabelPicked_shouldShowDialog () {
2437 HashMap <String , String > properties = new HashMap <>();
2538 properties .put ("name" , "Hanjan" );
Original file line number Diff line number Diff line change 1+ package com .mapzen .places .api .internal ;
2+
3+ import org .junit .Test ;
4+
5+ import static org .assertj .core .api .Assertions .assertThat ;
6+
7+ public class PlacesBubbleWrapStyleTest {
8+
9+ PlacesBubbleWrapStyle bubbleWrap = new PlacesBubbleWrapStyle ();
10+
11+ @ Test public void shouldReturnCorrectLabelLevel () throws Exception {
12+ assertThat (bubbleWrap .getDefaultLabelLevel ()).isEqualTo (11 );
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments