|
@@ -12,6 +12,7 @@ import android.view.InflateException;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
|
import com.google.android.gms.common.GooglePlayServicesClient;
|
|
@@ -21,6 +22,8 @@ import com.google.android.gms.location.LocationRequest;
|
|
|
import com.google.android.gms.maps.CameraUpdateFactory;
|
|
|
import com.google.android.gms.maps.GoogleMap;
|
|
|
import com.google.android.gms.maps.MapFragment;
|
|
|
+import com.google.android.gms.maps.model.BitmapDescriptor;
|
|
|
+import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
|
import com.google.android.gms.maps.model.CircleOptions;
|
|
|
import com.google.android.gms.maps.model.LatLng;
|
|
|
import com.google.android.gms.maps.model.Marker;
|
|
@@ -225,6 +228,7 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
|
|
|
}
|
|
|
|
|
|
CircleOptions circleOptions = new CircleOptions().radius(200.0).fillColor(Color.argb(127, 240, 80, 60)).strokeWidth(0.0f);
|
|
|
+ BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.wifi_marker);
|
|
|
for (Map.Entry<String, ArrayList<SSIDArea>> entry : threadAreas.entrySet()) {
|
|
|
String ssid = entry.getKey();
|
|
|
ArrayList<SSIDArea> areas = entry.getValue();
|
|
@@ -236,9 +240,11 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
|
|
|
|
|
|
sMap.addCircle(circleOptions.center(center).radius(100.0 + radius).fillColor(color));
|
|
|
Marker marker = sMap.addMarker(new MarkerOptions()
|
|
|
- .title(ssid + ": " + area.numPoints + (area.numPoints == 1 ? getResources().getString(R.string.attack)
|
|
|
+ .title(ssid + ": " + area.numPoints + (area.numPoints == 1 ? getResources()
|
|
|
+ .getString(R.string.attack)
|
|
|
: getResources().getString(R.string.attacks))).position(
|
|
|
center));
|
|
|
+ marker.setIcon(bitmapDescriptor);
|
|
|
|
|
|
sMarkerIDToSSID.put(marker.getId(), ssid);
|
|
|
}
|
|
@@ -262,7 +268,7 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
|
|
|
* @return the view
|
|
|
*/
|
|
|
@Override
|
|
|
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
+ public View onCreateView(final LayoutInflater inflater, ViewGroup container,
|
|
|
Bundle savedInstanceState) {
|
|
|
super.onCreateView(inflater, container, savedInstanceState);
|
|
|
|
|
@@ -296,10 +302,29 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
|
|
|
}
|
|
|
if (sMap != null) {
|
|
|
sMap.setOnInfoWindowClickListener(this);
|
|
|
+ // custom info window layout
|
|
|
+ sMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
|
|
|
+ @Override
|
|
|
+ public View getInfoWindow(Marker marker) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public View getInfoContents(Marker marker) {
|
|
|
+ View view = inflater.inflate(R.layout.fragment_threatmap_infowindow, null);
|
|
|
+ if (view != null) {
|
|
|
+ TextView titleTextView = (TextView)view.findViewById(R.id.threatmap_infowindow_title);
|
|
|
+ if (titleTextView != null) {
|
|
|
+ titleTextView.setText(marker.getTitle());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return view;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// tell the user to enable wifi so map data can be streamed
|
|
|
- if (!HelperUtils.isWifiConnected(activity)) {
|
|
|
+ if (activity != null && !HelperUtils.isWifiConnected(activity)) {
|
|
|
new AlertDialog.Builder(activity)
|
|
|
.setTitle(R.string.information)
|
|
|
.setMessage(R.string.no_network_connection_threatmap_msg)
|