Browse Source

threatmap replace default marker with wifi icon

Fabio Arnold 10 years ago
parent
commit
6f9e5add87

BIN
res/drawable-xxxhdpi/wifi_marker.png


+ 6 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ThreatMapFragment.java

@@ -22,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;
@@ -226,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();
@@ -237,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);
 			}