use of app.akexorcist.gdaplibrary.GoogleDirection.OnAnimateListener in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.
the class DirectionActivity1 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_direction_1);
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(start, 15));
gd = new GoogleDirection(this);
gd.setOnDirectionResponseListener(new OnDirectionResponseListener() {
public void onResponse(String status, Document doc, GoogleDirection gd) {
mDoc = doc;
mMap.addPolyline(gd.getPolyline(doc, 3, Color.RED));
mMap.addMarker(new MarkerOptions().position(start).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
mMap.addMarker(new MarkerOptions().position(end).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
buttonAnimate.setVisibility(View.VISIBLE);
}
});
gd.setOnAnimateListener(new OnAnimateListener() {
public void onStart() {
textProgress.setVisibility(View.VISIBLE);
}
public void onProgress(int progress, int total) {
textProgress.setText(progress + " / " + total);
}
public void onFinish() {
buttonAnimate.setVisibility(View.VISIBLE);
textProgress.setVisibility(View.GONE);
}
});
textProgress = (TextView) findViewById(R.id.textProgress);
textProgress.setVisibility(View.GONE);
buttonRequest = (Button) findViewById(R.id.buttonRequest);
buttonRequest.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.setVisibility(View.GONE);
gd.setLogging(true);
gd.request(start, end, GoogleDirection.MODE_DRIVING);
}
});
buttonAnimate = (Button) findViewById(R.id.buttonAnimate);
buttonAnimate.setVisibility(View.GONE);
buttonAnimate.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.setVisibility(View.GONE);
gd.animateDirection(mMap, gd.getDirection(mDoc), GoogleDirection.SPEED_FAST, true, false, true, false, null, false, true, null);
}
});
}
use of app.akexorcist.gdaplibrary.GoogleDirection.OnAnimateListener in project Android-GoogleDirectionAndPlaceLibrary by akexorcist.
the class DirectionActivity3 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_direction_1);
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(start, 15));
gd = new GoogleDirection(this);
gd.setOnDirectionResponseListener(new OnDirectionResponseListener() {
public void onResponse(String status, Document doc, GoogleDirection gd) {
mDoc = doc;
mMap.addPolyline(gd.getPolyline(doc, 3, Color.RED));
buttonAnimate.setVisibility(View.VISIBLE);
}
});
gd.setOnAnimateListener(new OnAnimateListener() {
public void onStart() {
textProgress.setVisibility(View.VISIBLE);
}
public void onProgress(int progress, int total) {
textProgress.setText((int) ((float) progress / total * 100) + "% / 100%");
}
public void onFinish() {
buttonAnimate.setVisibility(View.VISIBLE);
textProgress.setVisibility(View.GONE);
}
});
textProgress = (TextView) findViewById(R.id.textProgress);
textProgress.setVisibility(View.GONE);
buttonRequest = (Button) findViewById(R.id.buttonRequest);
buttonRequest.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.setVisibility(View.GONE);
gd.setLogging(true);
gd.request(start, end, GoogleDirection.MODE_DRIVING);
}
});
buttonAnimate = (Button) findViewById(R.id.buttonAnimate);
buttonAnimate.setVisibility(View.GONE);
buttonAnimate.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.setVisibility(View.GONE);
gd.animateDirection(mMap, gd.getDirection(mDoc), GoogleDirection.SPEED_VERY_SLOW, true, false, true, true, new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.car)), true, false, null);
}
});
}
Aggregations