Search in sources :

Example 1 with PlaceViewModel

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));
}
Also used : PlaceViewModel(com.github.pedrovgs.sample.viewmodel.PlaceViewModel) MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) LatLng(com.google.android.gms.maps.model.LatLng)

Example 2 with PlaceViewModel

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);
}
Also used : PlacesCollectionRendererBuilder(com.github.pedrovgs.sample.renderer.rendererbuilder.PlacesCollectionRendererBuilder) PlaceViewModel(com.github.pedrovgs.sample.viewmodel.PlaceViewModel) PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) Renderer(com.pedrogomez.renderers.Renderer) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) LinkedList(java.util.LinkedList) Provides(dagger.Provides)

Example 3 with PlaceViewModel

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);
}
Also used : PlaceViewModel(com.github.pedrovgs.sample.viewmodel.PlaceViewModel)

Aggregations

PlaceViewModel (com.github.pedrovgs.sample.viewmodel.PlaceViewModel)3 PlaceRenderer (com.github.pedrovgs.sample.renderer.PlaceRenderer)1 TvShowRenderer (com.github.pedrovgs.sample.renderer.TvShowRenderer)1 PlacesCollectionRendererBuilder (com.github.pedrovgs.sample.renderer.rendererbuilder.PlacesCollectionRendererBuilder)1 LatLng (com.google.android.gms.maps.model.LatLng)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1 Renderer (com.pedrogomez.renderers.Renderer)1 Provides (dagger.Provides)1 LinkedList (java.util.LinkedList)1