-
Notifications
You must be signed in to change notification settings - Fork 320
Add example test Activity for Navigation Test Application #1317
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
Conversation
ebe1398 to
c42c3ad
Compare
tobrun
left a comment
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.
Just a couple of comments that I noticed while working on some follow up PRs
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="@dimen/fab_margin_bottom" | ||
| android:layout_marginEnd="@dimen/fab_margin_end" |
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.
missing marginRight for backwards compatibility
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="@dimen/fab_margin_bottom" | ||
| android:layout_marginEnd="@dimen/fab_margin_end" | ||
| app:srcCompat="@drawable/ic_my_location"/> |
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.
missing gradle configuration for vectorDrawables.useSupportLibrary=true
| android:id="@+id/settingsFab" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginStart="@dimen/fab_margin_default" |
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.
missing marginLeft for backwards compatibility (applicable to FAB below)
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_gravity="center_vertical" | ||
| android:layout_marginStart="8dp" |
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.
missing marginLeft for backwards compatibility
|
One additional comment is that keyboard shows when opening the app, this is a strange UX as you can't see the edittext and when typing you can see the results coming from it. I would suggest not showing it at all on startup. update: done in 9404856. |
90b2a47 to
404002f
Compare
48b4c8d to
3984572
Compare
51f5ea1 to
9a97a80
Compare
d35be46 to
8fea674
Compare
8121397 to
d5e2a82
Compare
d5e2a82 to
6eb307a
Compare
Guardiola31337
left a comment
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.
app/src/main/AndroidManifest.xml
Outdated
| package="com.mapbox.services.android.navigation.testapp"> | ||
|
|
||
| <uses-permission android:name="android.permission.VIBRATE"/> | ||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
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.
I believe these are needed because of
| implementation dependenciesList.searchSdk |
|
|
||
| companion object { | ||
| var instance: NavigationApplication by DelegatesExt.notNullSingleValue() | ||
| const val DEFAULT_MAPBOX_ACCESS_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN_GOES_HERE" |
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.
We should place DEFAULT_MAPBOX_ACCESS_TOKEN as private const in the file scope instead of inside the companion object especially because this is only used here in NavigationApplication (there's no other classes accessing to it) and also because the companion object is a new type that is created from the file.
| private var map: NavigationMapboxMap? = null | ||
|
|
||
| companion object { | ||
| const val ZERO_PADDING = 0 |
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.
Same here ☝️ - the companion object could be removed completely.
| class ExamplePresenter(private val view: ExampleView, private val viewModel: ExampleViewModel) { | ||
|
|
||
| companion object { | ||
| const val DEFAULT_ZOOM = 12.0 |
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.
Same here ☝️
| val top = resources.getDimension(R.dimen.route_overview_padding_top).toInt() | ||
| val right = resources.getDimension(R.dimen.route_overview_padding_right).toInt() | ||
| val bottom = resources.getDimension(R.dimen.route_overview_padding_bottom).toInt() | ||
| // left top right bottom |
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.
NIT - unnecessary comment
| class ExampleViewModel(application: Application) : AndroidViewModel(application) { | ||
|
|
||
| companion object { | ||
| const val ONE_SECOND_INTERVAL = 1000 |
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.
Same here ☝️
| private val accessToken: String) : Callback<DirectionsResponse> { | ||
|
|
||
| companion object { | ||
| const val BEARING_TOLERANCE = 90.0 |
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.
Same here ☝️
| private val routeFinder: ExampleRouteFinder | ||
| private val accessToken: String = instance.resources.getString(R.string.mapbox_access_token) | ||
|
|
||
| init { |
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.
We should explore the option of adding constructor properties and factory functions to make init shorter.
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.
@Guardiola31337 can you provide an example of this? I'm not entirely sure what you mean here.
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.
I was referring to extract "file" functions to initialize the different variables and make the init block shorter.
| const val ONE_SECOND_INTERVAL = 1000 | ||
| } | ||
|
|
||
| val location: MutableLiveData<Location> = MutableLiveData() |
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.
We should explore the option of using custom LiveDatas and postValue instead. Right now, because we're exposing MutableLiveData any other outside class could change mistakenly the values with setValue. The same thing applies to the rest of variables 👇
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.
@Guardiola31337 so like a custom class that extends from MutableLiveData and only exposes the postValue method?
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.
MutableLiveData exposes postValue. I was referring to using that one instead.
|
@danesfeder is this still WIP? Just need to address the comments? I'm excited to see this new 💯 example land! |
|
@Guardiola31337 nope, I'd say it's in a good spot to merge / iterate on in the future. I'll look into addressing the comments today, thanks! |
e24f9a7 to
53e0339
Compare
|
@Guardiola31337 I addressed most of your feedback here, thanks! I'd like to follow up on #1317 (comment) and #1317 (comment). Imo, they aren't blocking this PR and I'd like to learn more about how to implement these comments before the changes are made. |
53e0339 to
0576df1
Compare
Guardiola31337
left a comment
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.
I'd like to follow up on #1317 (comment) and #1317 (comment). Imo, they aren't blocking this PR and I'd like to learn more about how to implement these comments before the changes are made.
I've replied to your questions (we can discuss internally if you have any follow up questions) and I agree those don't block the PR (sorry if the comments meant that to you, my bad), let's ![]()
* Offline Routing Integration * add offline route activity, fix offline integration / apis and fix voice instruction milestones being fired off twice
* Add example test Activity for Navigation Test Application * Add ability to display / select alternative routes
* Offline Routing Integration * add offline route activity, fix offline integration / apis and fix voice instruction milestones being fired off twice
* Add example test Activity for Navigation Test Application * Add ability to display / select alternative routes
0576df1 to
40fcb77
Compare
|
|








This PR aims to create a more robust test application. When launching the test app now, you will be viewing
ExampleActivity, which serves as an example of search + finding route + navigation. It's currently pretty "watered down", but serves as a good starting point for our navigation driving custom user interfaces.TODO:
ManeuverViewnot showing correctlyExampleActivityhandle back press (Example activity onbackpressed #1323)The
MainActivitylist of examples is still accessible via settings: