Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LocationCompassEngine for location component #1131

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

Mapbox welcomes participation and contributions from everyone.

## Features ✨ and improvements 🏁
* Add accuracy radius support for LocationComponent. ([#1016](https://github.com/mapbox/mapbox-maps-android/pull/1016))
* Add support for custom widgets rendered on top of the map. ([#1036](https://github.com/mapbox/mapbox-maps-android/pull/1036))

# 10.4.0-beta.1
Chaoba marked this conversation as resolved.
Show resolved Hide resolved

## Features ✨ and improvements 🏁
* Refactor scheduling logic for render thread in general slightly improving rendering performance. ([#1068](https://github.com/mapbox/mapbox-maps-android/pull/1068))
* Add LocationCompassEngine and accuracy radius support for location component plugin. ([#1016](https://github.com/mapbox/mapbox-maps-android/pull/1016)) ([#1131](https://github.com/mapbox/mapbox-maps-android/pull/1131))
Inorder to avoid breaking api changes, interface location2 is introduced for updating `puckBearingSource`, `puckBearingEnabled` and `showAccuracyRing` properties.
Chaoba marked this conversation as resolved.
Show resolved Hide resolved
```
// Change the puck bearing source.
mapView.location2.puckBearingSource = PuckBearingSource.HEADING
mapView.location2.puckBearingSource = PuckBearingSource.COURSE
// Change the visibility of accuracy ring.
mapView.location2.showAccuracyRing = true
mapView.location2.showAccuracyRing = false
// Change the puck bearing enabled.
mapView.location2.puckBearingEnabled = true
mapView.location2.puckBearingEnabled = false
```
* Add support for custom widgets rendered on top of the map. ([#1036](https://github.com/mapbox/mapbox-maps-android/pull/1036))

## Bug fixes 🐞
* Fix skipping / crashing user events scheduled on a render thread with `MapView#queueEvent`. ([#1068](https://github.com/mapbox/mapbox-maps-android/pull/1068))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.mapbox.maps.Style
import com.mapbox.maps.extension.style.expressions.dsl.generated.interpolate
import com.mapbox.maps.plugin.LocationPuck2D
import com.mapbox.maps.plugin.LocationPuck3D
import com.mapbox.maps.plugin.PuckBearingSource
import com.mapbox.maps.plugin.gestures.gestures
import com.mapbox.maps.plugin.locationcomponent.*
import com.mapbox.maps.testapp.R
Expand Down Expand Up @@ -100,13 +101,23 @@ class LocationComponentActivity : AppCompatActivity() {
}
return true
}
R.id.heading -> {
binding.mapView.location2.puckBearingSource = PuckBearingSource.HEADING
item.isChecked = true
return true
}
R.id.course -> {
binding.mapView.location2.puckBearingSource = PuckBearingSource.COURSE
item.isChecked = true
return true
}
R.id.action_accuracy_enabled -> {
binding.mapView.location2.updateSettings2 { showAccuracyRing = true }
binding.mapView.location2.showAccuracyRing = true
item.isChecked = true
return true
}
R.id.action_accuracy_disable -> {
binding.mapView.location2.updateSettings2 { showAccuracyRing = false }
binding.mapView.location2.showAccuracyRing = false
item.isChecked = true
return true
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_location_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapbox_locationComponentEnabled = "true"
mapbox:mapbox_locationComponentPuckBearingSource = "heading"
tools:context=".examples.LocationComponentActivity" />
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
mapbox:mapbox_locationComponentAccuracyRingBorderColor = "#000000"
mapbox:mapbox_locationComponentLayerAbove = "testString"
mapbox:mapbox_locationComponentLayerBelow = "testString"
mapbox:mapbox_locationComponentPuckBearingEnabled = "false"
Chaoba marked this conversation as resolved.
Show resolved Hide resolved
mapbox:mapbox_locationComponentPuckBearingSource = "heading"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- End of generated file. -->
15 changes: 15 additions & 0 deletions app/src/main/res/menu/menu_location_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<item android:id="@+id/action_component_enabled"
android:title="@string/location_enable_component"
app:showAsAction="never"/>

<item android:id="@+id/action_show_bearing"
android:title="@string/location_show_bearing"
app:showAsAction="never"/>
Expand All @@ -31,4 +32,18 @@
<item android:id="@+id/action_accuracy_enabled"
android:title="@string/location_enable_accuracy"
app:showAsAction="never"/>

<group
android:id="@+id/group"
android:checkableBehavior="single">
<item
android:id="@+id/heading"
android:title="@string/heading"
android:checked="true"
app:showAsAction="never" />
<item
android:id="@+id/course"
android:title="@string/course"
app:showAsAction="never" />
</group>
</menu>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
<string name="change_language_instruction">Make sure that the device\'s default language is not English</string>
<string name="map_not_localized">Map localized to selected language</string>
<string name="map_localized">Map localized to device language</string>

<!--Location component Activity-->
<string name="heading">Bearing source: Heading</string>
<string name="course">Bearing source: Course</string>
<string name="english">English</string>
<string name="spanish">Spanish</string>
<string name="french">French</string>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions plugin-locationcomponent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,20 @@ private inner class CustomLocationProvider : LocationProvider {
}
```

#### Interface location2
Inorder to avoid breaking api changes, interface location2 is introduced for updating `puckBearingSource`, `puckBearingEnabled` and `showAccuracyRing` properties.
```
// Change the puck bearing source.
mapView.location2.puckBearingSource = PuckBearingSource.HEADING
mapView.location2.puckBearingSource = PuckBearingSource.COURSE
// Change the visibility of accuracy ring.
mapView.location2.showAccuracyRing = true
mapView.location2.showAccuracyRing = false
// Change the puck bearing enabled.
mapView.location2.puckBearingEnabled = true
mapView.location2.puckBearingEnabled = false
```

More concrete examples of the location component plugin can be found in our [test application](https://github.com/mapbox/mapbox-maps-android/tree/master/app/src/main/java/com/mapbox/maps/testapp).

#### Dependencies
Expand Down
Loading