@BindView(R.id.oi) TextView dataHora;
@Override
public void onCreate(Bundle bundle) {
LayoutInflater inflater = (LayoutInflater)getLayoutInflater();
View v = inflater.inflate(R.layout.activity_mapa, null);
super.onCreate(bundle);
getMapAsync(this);
ButterKnife.bind((Activity) getContext());
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
centralizaImagem(googleMap);
circuloNoMapa();
Call<List<AppSync>> calldata = (Call<List<AppSync>>) new RetrofitInicializador().getServices().lista();
calldata.enqueue(new Callback<List<AppSync>>() {
@Override
public void onResponse(Call<List<AppSync>> call, Response<List<AppSync>> response) {
AppSync objeto = response.body().get(0);
String url = objeto.getUrl();
String fileDate = objeto.getFileDate();
String fileTime = objeto.getFileTime();
dataHora.setText(fileDate + " - " + fileTime + " GTM") ;
convertido = new ImageView(getContext());
Picasso.with(getContext())
.load(url)
.into(convertido);
convertido.setDrawingCacheEnabled(true);
convertido.buildDrawingCache();
Bitmap bitmap= Bitmap.createBitmap(convertido.getDrawingCache());
configuraBmpMapa();
}
@Override
public void onFailure(Call<List<AppSync>> call, Throwable t) {
Log.e("ERRO RETROFIT", t.getMessage() );
}
});
}
private void configuraBmpMapa() {
LatLngBounds newarkBounds = new LatLngBounds(
new LatLng(LATITUDE_MINIMA, LONGITUDE_MINIMA), // South west corner
new LatLng(LATITUDE_MAXIMA, LONGITUDE_MAXIMA)); // North east corner
GroundOverlayOptions newarkMap = new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromResource(R.drawable.oi))
.positionFromBounds(newarkBounds);
GroundOverlay imageOverlay = mMap.addGroundOverlay(newarkMap);
}