@Test public void showPluginSwitcherViewShouldEnableFab() { FloatingActionButton floatingActionButton = Mockito.mock(FloatingActionButton.class); Mockito.doReturn(floatingActionButton) .when(kujakuMapView) .findViewById(Mockito.eq(R.id.fab_mapview_layerSwitcher)); baseLayerSwitcherPlugin.showPluginSwitcherView(); Mockito.verify(kujakuMapView, Mockito.times(1)) .findViewById(Mockito.eq(R.id.fab_mapview_layerSwitcher)); Mockito.verify(floatingActionButton, Mockito.times(1)) .setVisibility(Mockito.eq(View.VISIBLE)); }
public void showPluginSwitcherView() { if (kujakuMapView != null) { if (layerSwitcherFab == null) { layerSwitcherFab = kujakuMapView.findViewById(R.id.fab_mapview_layerSwitcher); } layerSwitcherFab.setVisibility(View.VISIBLE); layerSwitcherFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (popupMenu == null) { showPopup(layerSwitcherFab); } else { popupMenu.dismiss(); } } }); } }
BaseLayerSwitcherPlugin implements PopupMenu.OnMenuItemClickListener { public void showPluginSwitcherView() { if (kujakuMapView != null) { if (layerSwitcherFab == null) { layerSwitcherFab = kujakuMapView.findViewById(R.id.fab_mapview_layerSwitcher); } layerSwitcherFab.setVisibility(View.VISIBLE); layerSwitcherFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (popupMenu == null) { showPopup(layerSwitcherFab); } else { popupMenu.dismiss(); } } }); } } }
BaseLayerSwitcherPlugin implements PopupMenu.OnMenuItemClickListener { public void showPluginSwitcherView() { if (kujakuMapView != null) { if (layerSwitcherFab == null) { layerSwitcherFab = kujakuMapView.findViewById(R.id.fab_mapview_layerSwitcher); } layerSwitcherFab.setVisibility(View.VISIBLE); layerSwitcherFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (popupMenu == null) { showPopup(layerSwitcherFab); } else { popupMenu.dismiss(); } } }); } } BaseLayerSwitcherPlugin(@NonNull KujakuMapView kujakuMapView, @NonNull Style style); }
BaseLayerSwitcherPlugin implements PopupMenu.OnMenuItemClickListener { public void showPluginSwitcherView() { if (kujakuMapView != null) { if (layerSwitcherFab == null) { layerSwitcherFab = kujakuMapView.findViewById(R.id.fab_mapview_layerSwitcher); } layerSwitcherFab.setVisibility(View.VISIBLE); layerSwitcherFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (popupMenu == null) { showPopup(layerSwitcherFab); } else { popupMenu.dismiss(); } } }); } } BaseLayerSwitcherPlugin(@NonNull KujakuMapView kujakuMapView, @NonNull Style style); boolean addBaseLayer(@NonNull BaseLayer baseLayer, boolean isDefault); boolean removeBaseLayerFromMap(@NonNull BaseLayer baseLayer); boolean removeBaseLayer(@NonNull BaseLayer baseLayer); @NonNull ArrayList<BaseLayer> getBaseLayers(); void show(); void showPluginSwitcherView(); void showPopup(@NonNull View anchorView); @Override boolean onMenuItemClick(MenuItem item); }
BaseLayerSwitcherPlugin implements PopupMenu.OnMenuItemClickListener { public void showPluginSwitcherView() { if (kujakuMapView != null) { if (layerSwitcherFab == null) { layerSwitcherFab = kujakuMapView.findViewById(R.id.fab_mapview_layerSwitcher); } layerSwitcherFab.setVisibility(View.VISIBLE); layerSwitcherFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (popupMenu == null) { showPopup(layerSwitcherFab); } else { popupMenu.dismiss(); } } }); } } BaseLayerSwitcherPlugin(@NonNull KujakuMapView kujakuMapView, @NonNull Style style); boolean addBaseLayer(@NonNull BaseLayer baseLayer, boolean isDefault); boolean removeBaseLayerFromMap(@NonNull BaseLayer baseLayer); boolean removeBaseLayer(@NonNull BaseLayer baseLayer); @NonNull ArrayList<BaseLayer> getBaseLayers(); void show(); void showPluginSwitcherView(); void showPopup(@NonNull View anchorView); @Override boolean onMenuItemClick(MenuItem item);  }