Skip to content

Commit 6a6e887

Browse files
jLynxcomann
authored andcommitted
Adds one radius circle around search location when search is finished (#216)
1 parent ef2a3b7 commit 6a6e887

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app/src/main/java/com/omkarmoghe/pokemap/views/map/MapWrapperFragment.java

+22
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.omkarmoghe.pokemap.models.map.GymMarkerExtended;
4646
import com.omkarmoghe.pokemap.models.map.PokemonMarkerExtended;
4747
import com.omkarmoghe.pokemap.models.map.PokestopMarkerExtended;
48+
import com.omkarmoghe.pokemap.models.map.SearchParams;
4849
import com.omkarmoghe.pokemap.util.PokemonIdUtils;
4950
import com.pokegoapi.api.map.fort.Pokestop;
5051
import com.pokegoapi.api.map.pokemon.CatchablePokemon;
@@ -88,6 +89,7 @@ public class MapWrapperFragment extends Fragment implements OnMapReadyCallback,
8889
private GoogleMap mGoogleMap;
8990
private Location mLocation = null;
9091
private Marker userSelectedPositionMarker = null;
92+
private Location currentCenter = new Location("0,0");
9193
private Map<String, GymMarkerExtended> gymsList = new HashMap<>();
9294
Map<Integer, String> gymTeamImageUrls = new HashMap<>();
9395
String lurePokeStopImageUrl = "http://i.imgur.com/2BI3Cqv.png";
@@ -590,6 +592,26 @@ private String getExpirationBreakdown(long millis) {
590592
public void onEvent(CatchablePokemonEvent event) {
591593
setPokemonMarkers(event.getCatchablePokemon());
592594
drawCatchedPokemonCircle(event.getLat(), event.getLongitude());
595+
if(positionNum == 1) {
596+
currentCenter.setLatitude(event.getLat());
597+
currentCenter.setLongitude(event.getLongitude());
598+
}
599+
if(positionNum == LOCATION_PERMISSION_REQUEST)
600+
{
601+
if (mGoogleMap != null) {
602+
603+
if (mPref.getShowScannedPlaces()) {
604+
605+
double radiusInMeters = ((SearchParams.DEFAULT_RADIUS *3)-(27*3))*2;//((3*100)-(27*3))*2
606+
int strokeColor = 0x4400CCFF; // outline
607+
int shadeColor = 0x4400CCFF; // fill
608+
609+
CircleOptions circleOptions = new CircleOptions().center(new LatLng(currentCenter.getLatitude(), currentCenter.getLongitude())).radius(radiusInMeters).fillColor(shadeColor).strokeColor(strokeColor).strokeWidth(8);
610+
clearCatchedPokemonCircle();
611+
userSelectedPositionCircles.add(mGoogleMap.addCircle(circleOptions));
612+
}
613+
}
614+
}
593615
}
594616

595617
/**

0 commit comments

Comments
 (0)