Skip to content

Conversation

@danesfeder
Copy link
Contributor

@danesfeder danesfeder commented Sep 26, 2018

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:

The MainActivity list of examples is still accessible via settings:

ezgif com-video-to-gif

Copy link
Member

@tobrun tobrun left a 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"
Copy link
Member

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"/>
Copy link
Member

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"
Copy link
Member

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"
Copy link
Member

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

@tobrun
Copy link
Member

tobrun commented Sep 27, 2018

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.

@danesfeder danesfeder force-pushed the example-activity branch 2 times, most recently from d35be46 to 8fea674 Compare September 27, 2018 17:27
@danesfeder danesfeder changed the base branch from navigation-native to master September 27, 2018 18:16
@danesfeder danesfeder force-pushed the example-activity branch 3 times, most recently from 8121397 to d5e2a82 Compare September 27, 2018 18:52
@danesfeder danesfeder changed the title [WIP] Add example test Activity for Navigation Test Application Add example test Activity for Navigation Test Application Sep 27, 2018
@danesfeder danesfeder added ✓ ready for review and removed ⚠️ DO NOT MERGE PR should not be merged! labels Sep 27, 2018
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good so far. Great work!

I've left some comments code-related. I've also noticed some "behavioral" issues when playing with the example 👀 (probably some of them are known issues)

example_activity_back_button_not_working

activity_example_null_island_no_puck

activity_example_select_routes_while_navigating_plus_no_bottomsheet_after_exit_navigation

example_activity_routes_not_updated_when_new_poi

example_activity_multiple_routes_selected_issue_plus_duplicated_voice_instructions_when_selecting_an_alternative_route

example_activity_settings_lost_after_selecting_a_destination_not_able_to_go_back

example_activity_simulation_mode_not_working

example_activity_search_bar_cursor_not_updated

Let me know if you have any questions on ☝️ or if further clarification / explanation is needed.

package="com.mapbox.services.android.navigation.testapp">

<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Copy link
Contributor

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
right? If so, we should request the permissions to the user as we do with location permissions.


companion object {
var instance: NavigationApplication by DelegatesExt.notNullSingleValue()
const val DEFAULT_MAPBOX_ACCESS_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN_GOES_HERE"
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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()
Copy link
Contributor

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 👇

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@Guardiola31337
Copy link
Contributor

@danesfeder is this still WIP? Just need to address the comments? I'm excited to see this new 💯 example land!

@danesfeder
Copy link
Contributor Author

@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!

@danesfeder danesfeder force-pushed the example-activity branch 2 times, most recently from e24f9a7 to 53e0339 Compare October 17, 2018 15:20
@danesfeder
Copy link
Contributor Author

@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.

@danesfeder danesfeder modified the milestones: 0.22.0, v0.23.0 Oct 25, 2018
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a 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 :shipit:

danesfeder and others added 15 commits November 2, 2018 15:05
* 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
@danesfeder
Copy link
Contributor Author

:shipit:

@danesfeder danesfeder merged commit 4b2c20c into master Nov 2, 2018
@danesfeder danesfeder deleted the example-activity branch November 7, 2018 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants