Skip to content

Commit

Permalink
Added a function to return an instance of the current class so that P…
Browse files Browse the repository at this point in the history
…MD passes due to it failing when .this is used incorrectly.
  • Loading branch information
jd-alexander committed Jun 14, 2018
1 parent ac53f11 commit 354354a
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,20 @@ public void onCreate(Bundle savedInstanceState) {
isMapReady = false;
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(googleMap -> {
setupMap(googleMap);
locationClient.setListener(GeoPointMapActivity.this);
locationClient.setListener(getActivity());
});
}

/**
* Utilizing GeoPointMapActivity.this for the current activity instance causes
* PMD to fail so this method prevents that.
*
* @return an instance of this activity
*/
private GeoPointMapActivity getActivity() {
return this;
}

@Override
protected void onStart() {
super.onStart();
Expand Down Expand Up @@ -241,7 +251,7 @@ public void onClick(View v) {

// Menu Layer Toggle
ImageButton layers = findViewById(R.id.layer_menu);
layers.setOnClickListener(v -> helper.showLayersDialog(GeoPointMapActivity.this));
layers.setOnClickListener(v -> helper.showLayersDialog(getActivity()));
zoomDialogView = getLayoutInflater().inflate(R.layout.geo_zoom_dialog, null);
zoomLocationButton = zoomDialogView.findViewById(R.id.zoom_location);
zoomLocationButton.setOnClickListener(v -> {
Expand Down

0 comments on commit 354354a

Please sign in to comment.