-
Notifications
You must be signed in to change notification settings - Fork 131
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 extension function for locationComponent to support show and hide arrow bearing image. #1012
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
December 21, 2021 10:33
bc6a21c
to
bdaf889
Compare
kiryldz
reviewed
Jan 4, 2022
...src/test/java/com/mapbox/maps/plugin/locationcomponent/LocationIndicatorLayerRendererTest.kt
Outdated
Show resolved
Hide resolved
kiryldz
reviewed
Jan 4, 2022
...src/test/java/com/mapbox/maps/plugin/locationcomponent/LocationIndicatorLayerRendererTest.kt
Outdated
Show resolved
Hide resolved
@Chaoba can we add visuals in PR description here? |
kiryldz
reviewed
Jan 4, 2022
...ationcomponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationPuckManager.kt
Outdated
Show resolved
Hide resolved
9 tasks
...ain/java/com/mapbox/maps/plugin/locationcomponent/generated/LocationComponentSettingsBase.kt
Outdated
Show resolved
Hide resolved
...ent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationIndicatorLayerRenderer.kt
Outdated
Show resolved
Hide resolved
...ationcomponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationPuckManager.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/mapbox/maps/testapp/examples/LocationComponentActivity.kt
Outdated
Show resolved
Hide resolved
Chaoba
changed the title
Add showBearingImage config for locationComponent.
Add puck styles for locationComponent.
Jan 10, 2022
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
January 10, 2022 02:50
8d20fe8
to
3910b29
Compare
kiryldz
reviewed
Jan 10, 2022
...ponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationComponentPluginImpl.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Jan 10, 2022
...ponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationComponentPluginImpl.kt
Outdated
Show resolved
Hide resolved
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
January 10, 2022 10:59
3910b29
to
005a7c3
Compare
Chaoba
changed the title
Add puck styles for locationComponent.
Add extension functions for locationComponent to support show and hide arrow bearing image.
Jan 10, 2022
pengdev
reviewed
Jan 10, 2022
...ponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationComponentPluginImpl.kt
Outdated
Show resolved
Hide resolved
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
January 10, 2022 11:46
005a7c3
to
801f0ea
Compare
Chaoba
requested review from
yunikkk,
pengdev,
alexander-kulikovskii and
kiryldz
January 10, 2022 11:46
...tioncomponent/src/main/java/com/mapbox/maps/plugin/locationcomponent/LocationComponentExt.kt
Outdated
Show resolved
Hide resolved
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
January 10, 2022 12:19
801f0ea
to
dd57f0b
Compare
Chaoba
force-pushed
the
kl-location-puck-bearing
branch
from
January 11, 2022 01:22
dd57f0b
to
7140bdf
Compare
Chaoba
changed the title
Add extension functions for locationComponent to support show and hide arrow bearing image.
Add extension function for locationComponent to support show and hide arrow bearing image.
Jan 11, 2022
kiryldz
reviewed
Jan 11, 2022
app/src/main/java/com/mapbox/maps/testapp/examples/LocationComponentActivity.kt
Outdated
Show resolved
Hide resolved
kiryldz
approved these changes
Jan 11, 2022
…ponentActivity.kt Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
pengdev
approved these changes
Jan 11, 2022
Comment on lines
+28
to
+60
return LocationPuck2D( | ||
topImage = ResourcesCompat.getDrawable(context.resources, R.drawable.mapbox_user_icon, null), | ||
bearingImage = ResourcesCompat.getDrawable( | ||
context.resources, | ||
R.drawable.mapbox_user_bearing_icon, | ||
null | ||
), | ||
shadowImage = ResourcesCompat.getDrawable( | ||
context.resources, | ||
R.drawable.mapbox_user_stroke_icon, | ||
null | ||
) | ||
) | ||
} else { | ||
return LocationPuck2D( | ||
topImage = ResourcesCompat.getDrawable( | ||
context.resources, | ||
R.drawable.mapbox_user_icon, | ||
null | ||
), | ||
bearingImage = ResourcesCompat.getDrawable( | ||
context.resources, | ||
R.drawable.mapbox_user_stroke_icon, | ||
null | ||
), | ||
shadowImage = ResourcesCompat.getDrawable( | ||
context.resources, | ||
R.drawable.mapbox_user_icon_shadow, | ||
null | ||
) | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val bearingImageId = if (withBearing) R.drawable.mapbox_user_bearing_icon else R.drawable.mapbox_user_stroke_icon
val shadowImage = if (withBearing) R.drawable.mapbox_user_stroke_icon else R.drawable.mapbox_user_icon_shadow
return LocationPuck2D(
topImage = ResourcesCompat.getDrawable(context.resources, R.drawable.mapbox_user_icon, null),
bearingImage = ResourcesCompat.getDrawable(
context.resources,
bearingImageId,
null
),
shadowImage = ResourcesCompat.getDrawable(
context.resources,
shadowImage,
null
)
)
also small extension for context:
fun Context.getCompatDrawable(resId:Int) = ResourcesCompat.getDrawable(
this,
resId,
null
)
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
This PR adds an extension function. Users can show or hide the bearing image by switching LocationPuck instance getting from it.
Record_2022-01-10-10-38-33_e38d0e4b1b9ec9f0e9b280cd077e482c.mp4
User impact (optional)
Pull request checklist:
@JvmOverloads
,@file:JvmName
, etc).mapbox-maps-android
changelog:<changelog>Add extension function for locationComponent to support show and hide arrow bearing image.</changelog>
.v10.[version]
release branch fix / enhancement, merge it tomain
firstly and then port tov10.[version]
release branch.Fixes: < Link to related issues that will be fixed by this pull request, if they exist >
PRs must be submitted under the terms of our Contributor License Agreement CLA.