Skip to content

Commit

Permalink
Corrects capitalization of GmapsPlaceSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
hufman committed Jan 22, 2022
1 parent a2f197f commit 71ad055
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class InstrumentedTestGMaps {
@Test
fun testGmapSearch() {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
val search = GmapsPlaceSearch.getInstance(appContext, locationProvider)
val search = GMapsPlaceSearch.getInstance(appContext, locationProvider)
runBlocking {
val results = search.searchLocationsAsync("test", LatLng(37.333, -122.416)).await()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GMapsController(private val context: Context, private val carLocationProvi
private var lastSettingsTime = 0L // the last time we checked settings, for day/night check
private val SETTINGS_TIME_INTERVAL = 5 * 60000 // milliseconds between checking day/night

val gMapLocationSource = GMapLocationSource()
val gMapLocationSource = GMapsLocationSource()
var currentLocation: Location? = null

var animatingCamera = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package me.hufman.androidautoidrive.carapp.maps
import android.location.Location
import com.google.android.gms.maps.LocationSource

class GMapLocationSource: LocationSource {
class GMapsLocationSource: LocationSource {
private var listener: LocationSource.OnLocationChangedListener? = null
var location: Location? = null
private set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import com.google.android.libraries.places.api.net.PlacesClient
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Deferred

class GmapsPlaceSearch(private val placesClient: PlacesClient, private val locationProvider: CarLocationProvider, private val timeProvider: () -> Long = {System.currentTimeMillis()}): MapPlaceSearch {
class GMapsPlaceSearch(private val placesClient: PlacesClient, private val locationProvider: CarLocationProvider, private val timeProvider: () -> Long = {System.currentTimeMillis()}): MapPlaceSearch {
companion object {
private const val SEARCH_SESSION_TTL = 180000L // number of milliseconds that a search session can live https://stackoverflow.com/a/52339858
fun getInstance(context: Context, locationProvider: CarLocationProvider): GmapsPlaceSearch {
fun getInstance(context: Context, locationProvider: CarLocationProvider): GMapsPlaceSearch {
val api_key = context.packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA)
.metaData.getString("com.google.android.geo.API_KEY") ?: ""
Places.initialize(context, api_key)
val placesClient = Places.createClient(context)
return GmapsPlaceSearch(placesClient, locationProvider)
return GMapsPlaceSearch(placesClient, locationProvider)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ import android.app.Presentation
import android.content.Context
import android.graphics.Point
import android.os.Bundle
import androidx.core.content.ContextCompat
import android.util.Log
import android.view.Display
import android.view.WindowManager
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.MapView
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MapStyleOptions
import io.bimmergestalt.idriveconnectkit.SidebarRHMIDimensions
import io.bimmergestalt.idriveconnectkit.SubsetRHMIDimensions
import me.hufman.androidautoidrive.*
import me.hufman.androidautoidrive.utils.TimeUtils
import java.util.*

class GMapsProjection(val parentContext: Context, display: Display, val appSettings: AppSettingsObserver, val locationSource: GMapLocationSource): Presentation(parentContext, display) {
class GMapsProjection(val parentContext: Context, display: Display, val appSettings: AppSettingsObserver, val locationSource: GMapsLocationSource): Presentation(parentContext, display) {
val TAG = "GMapsProjection"
var map: GoogleMap? = null
var mapListener: Runnable? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MapAppService: CarAppService() {
this.virtualDisplay = virtualDisplay
val mapController = GMapsController(applicationContext, carLocationProvider, virtualDisplay, MutableAppSettingsReceiver(applicationContext, null /* specifically main thread */))
this.mapController = mapController
val mapPlaceSearch = GmapsPlaceSearch.getInstance(this, carLocationProvider)
val mapPlaceSearch = GMapsPlaceSearch.getInstance(this, carLocationProvider)
val mapListener = MapsInteractionControllerListener(applicationContext, mapController)
mapListener.onCreate()
this.mapListener = mapListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.google.android.libraries.places.api.net.*
import com.nhaarman.mockito_kotlin.*
import kotlinx.coroutines.runBlocking
import me.hufman.androidautoidrive.carapp.maps.CarLocationProvider
import me.hufman.androidautoidrive.carapp.maps.GmapsPlaceSearch
import me.hufman.androidautoidrive.carapp.maps.GMapsPlaceSearch
import me.hufman.androidautoidrive.carapp.maps.LatLong
import me.hufman.androidautoidrive.carapp.maps.MapResult
import org.junit.Assert.*
Expand All @@ -23,7 +23,7 @@ private infix fun OngoingStubbing<SpannableString>.doReturn(s: String): OngoingS
mock<SpannableString> { on {toString()} doReturn s }
}

class GmapsPlaceSearchTest {
class GMapsPlaceSearchTest {
var time = 0L
val timeProvider: () -> Long = { time }
val mockLocationProvider = mock<CarLocationProvider>()
Expand All @@ -48,7 +48,7 @@ class GmapsPlaceSearchTest {
on { fetchPlace(placeQueryArgs.capture()) } doReturn placeResultTask
}

val placeSearch = GmapsPlaceSearch(mockPlacesClient, mockLocationProvider, timeProvider)
val placeSearch = GMapsPlaceSearch(mockPlacesClient, mockLocationProvider, timeProvider)

@Test
fun testSearchUnknownLocation(): Unit = runBlocking {
Expand Down

0 comments on commit 71ad055

Please sign in to comment.