Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3244 - Building Camera Duration test case in CameraActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Dec 14, 2015
1 parent 19d5237 commit 60f7cd3
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public void onClick(View view) {
@Override
public void onCancel() {
// NOTE: This shouldn't appear
Toast.makeText(getApplicationContext(), "animateCamera() onCancel Callback called.", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "onCancel Callback called.", Toast.LENGTH_SHORT).show();
}

@Override
public void onFinish() {
Toast.makeText(getApplicationContext(), "animateCamera() onFinish Callback called.", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "onFinish Callback called.", Toast.LENGTH_SHORT).show();
}
};

Expand All @@ -84,6 +84,33 @@ public void onFinish() {
}
});

Button cameraDurationButton = (Button) findViewById(R.id.cameraAnimateDurationButton);
cameraDurationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(-22.91214, -43.23012)) // Sets the center of the map to Maracanã
.zoom(16) // Sets the zoom
.bearing(270) // Sets the orientation of the camera to east
.tilt(20) // Sets the tilt of the camera to 30 degrees
.build(); // Creates a CameraPosition from the builder


MapView.CancelableCallback callback = new MapView.CancelableCallback() {
@Override
public void onCancel() {
Toast.makeText(getApplicationContext(), "Duration onCancel Callback called.", Toast.LENGTH_SHORT).show();
}

@Override
public void onFinish() {
Toast.makeText(getApplicationContext(), "Duration onFinish Callback called.", Toast.LENGTH_SHORT).show();
}
};

mMapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 5000, callback);
}
});

}

Expand Down

0 comments on commit 60f7cd3

Please sign in to comment.