Skip to content

Commit

Permalink
799 route preview orientation (#801)
Browse files Browse the repository at this point in the history
* Remove unused RouteEvent and route event posting

* Only invoke checkedChangeListener if user presses btn
  • Loading branch information
sarahsnow1 authored and ecgreb committed Dec 20, 2016
1 parent 6e16662 commit 47c49dc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -906,28 +906,28 @@ class MainActivity : AppCompatActivity(), MainViewController,

private fun initRoutePreviewModeBtns() {
byCar.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
if (buttonView.isPressed && isChecked) {
routeManager.type = Router.Type.DRIVING
route()
}
}

byBike.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
if (buttonView.isPressed && isChecked) {
routeManager.type = Router.Type.BIKING
route()
}
}

byFoot.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
if (buttonView.isPressed && isChecked) {
routeManager.type = Router.Type.WALKING
route()
}
}

byTransit.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
if (buttonView.isPressed && isChecked) {
routeManager.type = Router.Type.MULTIMODAL
route()
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import com.mapzen.erasermap.model.PermissionManager
import com.mapzen.erasermap.model.RouteManager
import com.mapzen.erasermap.model.event.LocationChangeEvent
import com.mapzen.erasermap.model.event.RouteCancelEvent
import com.mapzen.erasermap.model.event.RouteEvent
import com.mapzen.erasermap.model.event.RoutePreviewEvent
import com.mapzen.erasermap.presenter.ViewStateManager.ViewState.DEFAULT
import com.mapzen.erasermap.presenter.ViewStateManager.ViewState.ROUTE_DIRECTION_LIST
Expand Down Expand Up @@ -577,7 +576,6 @@ open class MainPresenterImpl(val mapzenLocation: MapzenLocation, val bus: Bus,
return
}

bus.post(RouteEvent())
mainViewController?.resetMute() //must call before generateRoutingMode()
generateRoutingMode(true)
vsm.viewState = ViewStateManager.ViewState.ROUTING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.mapzen.erasermap.model.TestRouteManager
import com.mapzen.erasermap.model.ValhallaRouteManagerTest.TestRouteCallback
import com.mapzen.erasermap.model.event.LocationChangeEvent
import com.mapzen.erasermap.model.event.RouteCancelEvent
import com.mapzen.erasermap.model.event.RouteEvent
import com.mapzen.erasermap.model.event.RoutePreviewEvent
import com.mapzen.erasermap.presenter.ViewStateManager.ViewState.DEFAULT
import com.mapzen.erasermap.presenter.ViewStateManager.ViewState.ROUTE_DIRECTION_LIST
Expand Down Expand Up @@ -799,13 +798,6 @@ class MainPresenterTest {
assertThat(mainController.isRoutingModeVisible).isTrue()
}

@Test fun onClickStartNavigation_shouldPublishRouteEvent() {
val subscriber = RouteEventSubscriber()
presenter.bus.register(subscriber)
presenter.onClickStartNavigation()
assertThat(subscriber.event).isNotNull()
}

@Test fun onClickStartNavigation_shouldResetMute() {
mainController.muted = true
presenter.onClickStartNavigation()
Expand Down Expand Up @@ -1429,14 +1421,6 @@ class MainPresenterTest {
assertThat(mainController.compassRotated)
}

class RouteEventSubscriber {
var event: RouteEvent? = null

@Subscribe fun onRouteEvent(event: RouteEvent) {
this.event = event
}
}

class ResolutionLocationSettingsChecker : LocationSettingsChecker {
override fun getLocationStatus(mapzenLocation: MapzenLocation,
locationClientManager: LocationClientManager): Status {
Expand Down

0 comments on commit 47c49dc

Please sign in to comment.