Adding localization plugin example#593
Conversation
| } | ||
| }); | ||
|
|
||
|
|
There was a problem hiding this comment.
can we get rid of the double spacings between click listeners?
| Snackbar.make(view, R.string.change_device_language_instruction, Snackbar.LENGTH_LONG).show(); | ||
|
|
||
| try { | ||
| localizationPlugin.matchMapLanguageWithDeviceDefault(); |
There was a problem hiding this comment.
what is potentially throwing the null point exception here? Isn't this a runtime exception?
There was a problem hiding this comment.
Fixed to runtime exception for when mapLocale==null in the LocalizationPlugin class. I also changed the snackbar message because it doesn't need to show the actual exception message. Now it's
catch (RuntimeException exception) {
Snackbar.make(view, R.string.try_different_language_instruction, Snackbar.LENGTH_LONG).show();
}with try_different_language_instruction being
<string name="try_different_language_instruction">Try setting your phone to a different language. German or French perhaps?</string>
👇
| app:mapbox_cameraZoom="11.316102" | ||
| app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"> | ||
|
|
||
| </com.mapbox.mapboxsdk.maps.MapView> |
| xmlns:mapbox="http://schemas.android.com/tools" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:orientation="vertical"> |
|
|
||
| </com.mapbox.mapboxsdk.maps.MapView> | ||
|
|
||
| <android.support.constraint.ConstraintLayout |
There was a problem hiding this comment.
Why not just make the entire layout a constraintLayout? No need to have a FrameLayout as the parent.
There was a problem hiding this comment.
That's what I originally had, but then decided to have the instructional cardview and buttons to be on top of the map in a frame layout, rather than the top of the map ending at the bottom of the buttons in a constraint layout...

This pr adds an example of the localization plugin for Android. The example's three buttons use the plugin's
setMapLanguage()method to change map text on-the-fly. Showing off the plugin's ability to set map text according to the device language is a bit funkier to show off. That's why I have the instructional snackbar that appears when the fab is tapped. I couldn't think of a better way to show the actual "localization" . If it's too much as is, one option would to just get rid of the fab all together and just have the Arabic, Russian, and Mandarin buttons...