use of com.google.android.gms.maps.model.LatLngBounds in project iNaturalistAndroid by inaturalist.
the class ExploreActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
actionBar.setElevation(0);
actionBar.setCustomView(R.layout.explore_action_bar_new);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.getCustomView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(ExploreActivity.this, ExploreSearchActivity.class);
intent.putExtra(ExploreSearchActivity.SEARCH_FILTERS, mSearchFilters);
startActivityForResult(intent, SEARCH_REQUEST_CODE);
}
});
mHelper = new ActivityHelper(this);
setContentView(R.layout.explore);
if (savedInstanceState == null) {
mActiveViewType = VIEW_TYPE_OBSERVATIONS;
mTotalResults = new int[] { NOT_LOADED, NOT_LOADED, NOT_LOADED, NOT_LOADED };
mResults = (List<JSONObject>[]) new List[] { null, null, null, null };
mSearchFilters = new ExploreSearchFilters();
mLastMapBounds = null;
} else {
mActiveViewType = savedInstanceState.getInt("mActiveViewType");
mTotalResults = savedInstanceState.getIntArray("mTotalResults");
mObservationsViewMode = savedInstanceState.getInt("mObservationsViewMode");
mSearchFilters = (ExploreSearchFilters) savedInstanceState.getSerializable("mSearchFilters");
mCurrentResultsPage = savedInstanceState.getIntArray("mCurrentResultsPage");
mLoadingNextResults = savedInstanceState.getBooleanArray("mLoadingNextResults");
mObservationsMapType = savedInstanceState.getInt("mObservationsMapType", GoogleMap.MAP_TYPE_TERRAIN);
mMapMoved = savedInstanceState.getBoolean("mMapMoved");
mResults = (List<JSONObject>[]) new List[] { null, null, null, null };
mResults[VIEW_TYPE_OBSERVATIONS] = mHelper.loadListFromBundle(savedInstanceState, "mObservations");
mResults[VIEW_TYPE_SPECIES] = mHelper.loadListFromBundle(savedInstanceState, "mSpecies");
mResults[VIEW_TYPE_OBSERVERS] = mHelper.loadListFromBundle(savedInstanceState, "mObservers");
mResults[VIEW_TYPE_IDENTIFIERS] = mHelper.loadListFromBundle(savedInstanceState, "mIdentifiers");
for (int i = 0; i < mResults.length; i++) {
mListViewIndex.put("mList" + i, savedInstanceState.getInt("mList" + i + "Index"));
mListViewOffset.put("mList" + i, savedInstanceState.getInt("mList" + i + "Offset"));
}
VisibleRegion vr = savedInstanceState.getParcelable("mapRegion");
mLastMapBounds = new LatLngBounds(new LatLng(vr.nearLeft.latitude, vr.farLeft.longitude), new LatLng(vr.farRight.latitude, vr.farRight.longitude));
}
onDrawerCreate(savedInstanceState);
// Tab Initialization
initializeTabs();
}
use of com.google.android.gms.maps.model.LatLngBounds in project iNaturalistAndroid by inaturalist.
the class ActivityHelper method addCircle.
private CameraUpdate addCircle(GoogleMap map, LatLng latlng, int radius, Observation observation, boolean updateCamera) {
int obsColor = observationColor(observation);
CircleOptions opts = new CircleOptions().center(latlng).radius(radius).fillColor(// Add 50% opacity
0x80FFFFFF & obsColor).strokeColor(obsColor);
map.addCircle(opts);
if (!updateCamera) {
return null;
}
LatLngBounds bounds = new LatLngBounds.Builder().include(SphericalUtil.computeOffset(latlng, radius, 0)).include(SphericalUtil.computeOffset(latlng, radius, 90)).include(SphericalUtil.computeOffset(latlng, radius, 180)).include(SphericalUtil.computeOffset(latlng, radius, 270)).build();
return CameraUpdateFactory.newLatLngBounds(bounds, 10);
}
Aggregations