Skip to content

Commit

Permalink
Add LocationCompassEngine for location component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Li committed Feb 14, 2022
1 parent cea9976 commit 245c526
Show file tree
Hide file tree
Showing 35 changed files with 708 additions and 36 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

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))

# 10.4.0-beta.1

## 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 accuracy radius support for location component plugin. ([#1016](https://github.com/mapbox/mapbox-maps-android/pull/1016))
* Add LocationCompassEngine for location component plugin. ([#1131](https://github.com/mapbox/mapbox-maps-android/pull/1131))

## 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,6 +101,16 @@ class LocationComponentActivity : AppCompatActivity() {
}
return true
}
R.id.heading -> {
binding.mapView.location2.updateSettings2 { puckBearingSource = PuckBearingSource.HEADING }
item.isChecked = true
return true
}
R.id.course -> {
binding.mapView.location2.updateSettings2 { puckBearingSource = PuckBearingSource.COURSE }
item.isChecked = true
return true
}
R.id.action_accuracy_enabled -> {
binding.mapView.location2.updateSettings2 { showAccuracyRing = true }
item.isChecked = 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" />
2 changes: 2 additions & 0 deletions app/src/main/res/layout/generated_test_locationcomponent.xml
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"
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.

Loading

0 comments on commit 245c526

Please sign in to comment.