use of com.github.pedrovgs.sample.viewmodel.PlaceViewModel in project DraggablePanel by pedrovgs.
the class PlacesSampleActivity method showPlace.
/**
* Show a place in PlaceFragment and SupportMapFragment and apply the maximize effect over the
* DraggablePanel.
*/
private void showPlace(int position) {
draggablePanel.setVisibility(View.VISIBLE);
draggablePanel.maximize();
PlaceViewModel placeViewModel = placesAdapter.getItem(position);
placeFragment.showPlace(placeViewModel);
mapFragment.getMap().clear();
LatLng latitudeLongitude = new LatLng(placeViewModel.getLatitude(), placeViewModel.getLongitude());
MarkerOptions marker = new MarkerOptions().position(latitudeLongitude);
marker.title(placeViewModel.getName());
marker.snippet(placeViewModel.getLatitude() + " , " + placeViewModel.getLongitude());
mapFragment.getMap().addMarker(marker);
mapFragment.getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(latitudeLongitude, ZOOM));
}
use of com.github.pedrovgs.sample.viewmodel.PlaceViewModel in project DraggablePanel by pedrovgs.
the class MainModule method providePlaceCollectionRendererBuilder.
/**
* Provisioning of a RendererBuilder implementation to work with places ListView. More
* information in this library: {@link https://github.com/pedrovgs/Renderers}
*/
@Provides
protected PlacesCollectionRendererBuilder providePlaceCollectionRendererBuilder(Context context) {
List<Renderer<PlaceViewModel>> prototypes = new LinkedList<Renderer<PlaceViewModel>>();
prototypes.add(new PlaceRenderer(context));
return new PlacesCollectionRendererBuilder(prototypes);
}
use of com.github.pedrovgs.sample.viewmodel.PlaceViewModel in project DraggablePanel by pedrovgs.
the class PlaceRenderer method render.
/**
* Render the PlaceViewModel information.
*/
@Override
protected void render() {
PlaceViewModel place = getContent();
nameTextView.setText(place.getName());
Picasso.with(context).load(place.getPhoto()).placeholder(R.drawable.maps_placeholder).into(photoImageView);
}
Aggregations