고급 장소 목록 구성요소

고급 장소 목록 구성요소를 사용하면 장소 목록을 정의하고 표시할 수 있습니다. 장소 세부정보 구성요소 (장소 ID, 장소 리소스 이름 또는 위도/경도 좌표)에서 지원하는 동일한 ID 집합에서 최대 20개의 장소를 나열할 수 있습니다.

가로 또는 세로 목록 표시 중에서 선택할 수 있습니다. 기본 방향은 세로입니다. 각 목록 항목에 대해 축소형 및 전체 장소 세부정보 카드와 동일한 정보 및 구성 옵션을 사용할 수 있습니다.

AdvancedPlaceListFragmentPlaceActionProvider 인터페이스를 사용하여 목록을 만듭니다.

결제

각 목록 요청에 대해 요금이 청구되며 목록 변경사항은 새로운 청구 가능한 이벤트입니다.

AdvancedPlaceList 프래그먼트 만들기

Kotlin

// Initialize first
Places.initializeWithNewPlacesApiEnabled(context, API_KEY)

// how fragment is created
AdvancedPlaceListFragment.newInstance(
          selectedContent,
          orientation,
          R.style.BrandedPlaceDetailsTheme,
        )

// fragments support the same configurations that PlaceSearchFragment supports
fragment.preferTruncation = false
fragment.attributionPosition = AttributionPosition.BOTTOM
fragment.mediaSize = AdvancedPlaceListFragment.MediaSize.SMALL
fragment.selectable = true  

장소 목록 표시

Kotlin

// You can use resourceNames or placeIds
advancedPlaceListFragment.configureFromPlaceIds(placeIds)

advancedPlaceListFragment.configureFromResourceNames(resourceNames)

// Alternatively, use coordinates, which are a list of LatLng:
advancedPlaceListFragment.configureFromCoordinates(coordinates)
// Uses reverse geocoding to get the place

결과 수신 대기

Kotlin

// Attach the existing PlaceSearchFragmentListener to get notified when places load or are selected from the results list.
override fun onAttachFragment(fragment: Fragment) {
    super.onAttachFragment(fragment)
    when (fragment) {
      // Reuse the placeSearchFragmetnListener from the Essentials version
      is AdvancedPlaceSearchFragment -> fragment.registerListener(placeSearchFragmentListener)
      // Use placeListFragmentListener, it's functionally identical but with a new name.  
      is AdvancedPlaceListFragment -> fragment.registerListener(advancedPlaceListFragmentListener)
    }
}