Skip to content

Commit

Permalink
Implemented feature: Added option to enable or disable 3D map mode (#…
Browse files Browse the repository at this point in the history
…1218)

* Implemented feature: Added option to enable or disable 3D map mode
  • Loading branch information
amrhossamdev authored May 15, 2024
1 parent 7036d6e commit 0b4aec4
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ private void initMap(Bundle savedInstanceState) {
uiSettings.setMyLocationButtonEnabled(false);
// Hide Toolbar
uiSettings.setMapToolbarEnabled(false);
// Check for 3D map mode settings
updateMap3DModeSettings();
// Instantiate class that holds generic markers to be added by outside classes
mSimpleMarkerOverlay = new SimpleMarkerOverlay(mMap);

Expand Down Expand Up @@ -508,7 +510,7 @@ public void onResume() {
controller.notifyMapChanged();
}
}

updateMap3DModeSettings();
super.onResume();
}

Expand Down Expand Up @@ -1487,4 +1489,26 @@ public boolean onMarkerClick(Marker marker) {
return false;
}
}

/**
* Updates the map settings based on the current state of 3D mode preference.
*/
private void updateMap3DModeSettings() {
if(mMap == null) return;

boolean isEnabled = Application.getPrefs().getBoolean(getString(R.string.preference_key_enable_map_3d_mode), true);

mMap.getUiSettings().setTiltGesturesEnabled(isEnabled);
mMap.setBuildingsEnabled(isEnabled);

// Reset tilt to 0 degrees
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(
new CameraPosition.Builder()
.target(mMap.getCameraPosition().target)
.zoom(mMap.getCameraPosition().zoom)
.tilt(0)
.build()
));
}

}
2 changes: 2 additions & 0 deletions onebusaway-android/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1098,4 +1098,6 @@
<string name="preferences_reset_donation_timestamps_summary">Al tocar esta opción se borrarán las marcas de tiempo de \'Recuérdame más tarde\' y \'No me molestes\' asociadas con las solicitudes de donación.</string>
<string name="preferences_show_weather_view">Mostrar vista del clima</string>
<string name="show">Mostrar</string>
<string name="preferences_enable_map_3d_mode_title">Activar modo 3D del mapa</string>
<string name="preferences_enable_map_3d_mode_summary">Incluir edificios en 3D en el mapa</string>
</resources>
2 changes: 2 additions & 0 deletions onebusaway-android/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -695,5 +695,7 @@
<string name="preferences_reset_donation_timestamps_summary">Tämän vaihtoehdon napauttaminen poistaa sekä \'Muistuta minua myöhemmin\' että \'Älä vaivaudu\' aikaleimat, jotka liittyvät lahjoituspyyntöihin.</string>
<string name="preferences_show_weather_view">Näytä säätönäkymä</string>
<string name="show">Näytä</string>
<string name="preferences_enable_map_3d_mode_title">Ota käyttöön kartan 3D-tila</string>
<string name="preferences_enable_map_3d_mode_summary">Sisällytä 3D-rakennukset karttaan</string>

</resources>
2 changes: 2 additions & 0 deletions onebusaway-android/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,7 @@
<string name="preferences_reset_donation_timestamps_summary">Toccando questa opzione verranno cancellati i timestamp di \'Ricordamelo più tardi\' e \'Non disturbarmi\' associati alle richieste di donazione.</string>
<string name="preferences_show_weather_view">Mostra vista meteo</string>
<string name="show">Mostra</string>
<string name="preferences_enable_map_3d_mode_title">Abilita la modalità 3D della mappa</string>
<string name="preferences_enable_map_3d_mode_summary">Includi edifici in 3D nella mappa</string>

</resources>
2 changes: 2 additions & 0 deletions onebusaway-android/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -715,5 +715,7 @@
<string name="preferences_reset_donation_timestamps_summary">Dotknięcie tej opcji spowoduje wyczyszczenie znaczników czasu \'Przypomnij mi później\' i \'Nie przeszkadzaj mi\' związanych z prośbami o darowizny.</string>
<string name="preferences_show_weather_view">Pokaż widok pogody</string>
<string name="show">Pokaż</string>
<string name="preferences_enable_map_3d_mode_title">Włącz tryb 3D mapy</string>
<string name="preferences_enable_map_3d_mode_summary">Uwzględnij budynki 3D na mapie</string>

</resources>
1 change: 1 addition & 0 deletions onebusaway-android/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<string name="preference_key_arrival_info_style">preference_arrival_info_style</string>
<string name="preference_key_show_negative_arrivals">preference_show_negative_arrivals</string>
<string name="preference_key_show_zoom_controls">preference_show_zoom_controls</string>
<string name="preference_key_enable_map_3d_mode">preference_enable_map_3d_view</string>
<string name="preference_key_hide_alerts">preference_hide_alerts</string>
<string name="preference_key_default_stop_sort">preference_default_stop_sort</string>
<string name="preference_key_default_reminder_time">preference_default_reminder_time</string>
Expand Down
3 changes: 2 additions & 1 deletion onebusaway-android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1247,5 +1247,6 @@
<string name="preferences_reset_donation_timestamps_summary">Tapping this option will clear both the \'Remind Me Later\' and \'Don\'t Bother Me\' timestamps associated with donation requests.</string>
<string name="preferences_show_weather_view">Show weather view</string>
<string name="show">Show</string>

<string name="preferences_enable_map_3d_mode_title">Enable map 3D mode</string>
<string name="preferences_enable_map_3d_mode_summary">Include 3D buildings in the map</string>
</resources>
6 changes: 6 additions & 0 deletions onebusaway-android/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
android:summary="@string/preferences_show_zoom_controls_summary"
android:title="@string/preferences_show_zoom_controls_title" />

<CheckBoxPreference
android:defaultValue="true"
android:key="@string/preference_key_enable_map_3d_mode"
android:summary="@string/preferences_enable_map_3d_mode_summary"
android:title="@string/preferences_enable_map_3d_mode_title" />

<CheckBoxPreference
android:defaultValue="true"
android:key="@string/preference_key_show_tutorial_screens"
Expand Down

0 comments on commit 0b4aec4

Please sign in to comment.