From cc78f29f26914c61fff557ab3d463c7d0dbe1c3d Mon Sep 17 00:00:00 2001 From: CiufudeanDani Date: Fri, 8 Apr 2022 13:52:16 +0300 Subject: [PATCH] display satelite map --- .../com/safemobile/safedispatch/HistoryActivity.java | 11 +++++++++++ .../com/safemobile/safedispatch/LiveActivity.java | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/HistoryActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/HistoryActivity.java index 5cb1ca0..e0e6735 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/HistoryActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/HistoryActivity.java @@ -100,6 +100,17 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall } }); + ImageView mapType = findViewById(R.id.changeMapTypeHeader); + mapType.setOnClickListener(view -> { + if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) { + mapType.setImageResource(R.drawable.map); + googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); + } else { + mapType.setImageResource(R.drawable.satellite); + googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); + } + }); + setDate(); } diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java index 9cb65aa..c5498ff 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/LiveActivity.java @@ -145,11 +145,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall // image View for changing map type satellite or map ImageView changeMapTypeImageView = findViewById(R.id.changeMapType); changeMapTypeImageView.setOnClickListener(v -> { - if (googleMap.getMapType() == GoogleMap.MAP_TYPE_SATELLITE) { - changeMapTypeImageView.setImageResource(R.drawable.satellite); + if (googleMap.getMapType() != GoogleMap.MAP_TYPE_SATELLITE) { + changeMapTypeImageView.setImageResource(R.drawable.map); googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); } else { - changeMapTypeImageView.setImageResource(R.drawable.map); + changeMapTypeImageView.setImageResource(R.drawable.satellite); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); } });