Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Apr 15, 2018

results->map, not done yet: map->results, some tests, more tests to come

Before I write more tests and handle the way from maps-tab back to results-tab I would like to ask for some feedback :)

I would also like to do nice Markers as a separate issue, as it's already quite a lot to review.

@ghost ghost requested review from peter-tackage and tomaszpolanski April 15, 2018 19:53
@ghost ghost added the pr::awaiting review label Apr 15, 2018
@ghost ghost requested a review from pabloper April 16, 2018 12:40
import javax.inject.Inject


class MapFragment : BindginBaseMapViewFragment<MapFragmentComponent>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix typo and newline

@Inject
internal lateinit var simpleMapViewViewModel: MapViewModel

private val dataBinder = object : DataBinder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use SimpleDataBinder

}

@Test
fun hasGeotag() {
Copy link
Contributor

Choose a reason for hiding this comment

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

With the test method name, you should include the scenario that you are testing in the name. The general form is like: <assert condition>_<input/state condition>

```
freesound.api.clientId=yourapiclientidvaluegoeshere
freesound.api.clientSecret=yourapiclientsecretvaluegoeshere
google.maps.api.key=yourgooglemapsapikeygoeshere
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll look up how to include this secret so that Travis builds.

d += tabController.tabRequestStream
.observeOn(schedulerProvider.ui())
.subscribe(
{ soundItem ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this action a named method.

}

private fun switchTab(soundInfo: SoundInfo) {
container.currentItem = if (soundInfo.tabType == TabType.RESULTS) 0 else 1
Copy link
Contributor

Choose a reason for hiding this comment

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

There ought to be a better way to couple/define the TabType and its corresponding position.

import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions

internal abstract class SimpleMapViewViewModel : BaseViewModel(), OnMapReadyCallback {
Copy link
Contributor

@peter-tackage peter-tackage Apr 26, 2018

Choose a reason for hiding this comment

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

This class should most likely be removed when refactoring to treat GoogleMap as a View. Perhaps parts of it could be absorbed into the BaseBindingMapFragment?

android:layout_width="match_parent"
android:layout_height="match_parent">

</com.google.android.gms.maps.MapView> No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Add newline at eof.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could just terminate XML tag block with /> because the body is empty.


<ImageButton
android:id="@+id/mapButton"
android:layout_width="48dp"
Copy link
Contributor

Choose a reason for hiding this comment

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

We have some constants for size, but they could probably use some revision. Consider also, using styles.

class MapFragment : BindingBaseMapViewFragment<MapFragmentComponent>() {

@Inject
internal lateinit var simpleMapViewViewModel: MapViewModel
Copy link
Contributor

@peter-tackage peter-tackage Apr 26, 2018

Choose a reason for hiding this comment

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

simpleMapViewViewModel name will need to be changed.

import polanski.option.Option
import timber.log.Timber

internal class MapViewModel(private val tabController: TabController,
Copy link
Contributor

@peter-tackage peter-tackage Apr 26, 2018

Choose a reason for hiding this comment

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

Expose Observables with map properties in this ViewModel.

Also move Map related classes such as this to a subpackage: com.futurice.freesound.feature.search.map.

when (position) {
0 -> getString(R.string.search_tab_results)
1 -> getString(R.string.search_tab_map)
else -> ""
Copy link
Contributor

@peter-tackage peter-tackage Apr 26, 2018

Choose a reason for hiding this comment

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

A position other than 0 or 1 is a error condition, correct? If so then throw an IllegalArgumentException with an explanation from here.

super.onLowMemory()
map?.onLowMemory()
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline at eof.

}

override fun onPause() {
super.onPause()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Google give an advice about whether map.onPause() should be called before after super.onPause()? (similarly for onStop, onDestroy and any other "teardown" lifecycle callbacks).

@@ -0,0 +1 @@
mock-maker-inline No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

newline at eof. Is there some sort of content-agnostic Linter we can use to check this?

@@ -0,0 +1,36 @@
/*
* Copyright 2016 Futurice GmbH
Copy link
Contributor

Choose a reason for hiding this comment

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

Also update your template for the copyright - 2018.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant