This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun initializeUI() { | |
| binding?.apply { | |
| voiceSpeedSlider.addOnChangeListener { _, value, _ -> | |
| voiceSpeed = value | |
| isDefaultSpeedValueExceeded = value > 1f | |
| } | |
| maleRadioButton.setOnClickListener { | |
| isMale = true | |
| languageRadioGroup.clearCheck() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun initializeEngine() { | |
| ttsEngine = MLTtsEngine(ttsConfig) | |
| } | |
| private fun initializeCallback() { | |
| ttsCallback = object : MLTtsCallback { // Whole MLTtsCallback implementation } | |
| ttsEngine.setTtsCallback(ttsCallback) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun configureEnginePreferences() { | |
| ttsConfig = MLTtsConfig() | |
| .setLanguage(ENGLISH_LANGUAGE_CODE) | |
| .setPerson(ENGLISH_LANGUAGE_CODE + FEMALE_SPEAKER_CODE) | |
| .setSpeed(1f) | |
| .setVolume(1f) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| configureEnginePreferences() | |
| initializeEngine() | |
| initializeCallback() | |
| initializeUI() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (stepList != null) | |
| rotateCameraToCurrentDirection(locationResult.lastLocation, stepList!!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private inline fun addNearbyHospitals(radius: Float, crossinline onEnd: (nearbyHealthInstitutions: List<Site>) -> Unit) { | |
| if (siteKitManager == null) return | |
| val nearbyHealthInstitutions = mutableListOf<Site>() | |
| for (i in 1..SiteKitManager.MAX_PAGE_INDEX) { | |
| Log.i(TAG, "i is $i") | |
| if (siteKitManager!!.isInTheRangeOfMaxResult(pageIndex = i, pageSize = 20)) | |
| siteKitManager?.searchNearby( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private suspend fun getNearbyHealthInstitutions(radius: Meter = DEFAULT_KM_RADIUS): List<Site> { | |
| return CoroutineScope(Dispatchers.IO).async { | |
| val list = getHealthInstitutions() | |
| val filteredList = list?.filter { it.city == userLocation?.state?.toUpperCase() } | |
| val result = suspendCoroutine<List<Site>> { continuation -> | |
| addNearbyHospitals( | |
| radius = radius, | |
| onEnd = { nearbyHealthInstitutions -> | |
| compareHealthInstitutionLists( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun getRoute(`for`: RouteType, onFailed: ((errorMessage: String) -> Unit)? = null) { | |
| val originCoordinates = | |
| Coordinates(userLocation?.coordinate?.first!!, userLocation?.coordinate?.second!!) | |
| val destinationCoordinates = Coordinates( | |
| mapKitManager?.selectedMarker?.position!!.latitude, | |
| mapKitManager?.selectedMarker?.position!!.longitude | |
| ) | |
| val routeDirection = | |
| RouteDirection(origin = originCoordinates, destination = destinationCoordinates) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun requestLocationUpdates() { | |
| locationKitManager?.requestLocationUpdatesWithCallback( | |
| locationRequest = LocationRequest().apply { | |
| interval = 10000L | |
| priority = LocationRequest.PRIORITY_HIGH_ACCURACY | |
| needAddress = true // This let you to reach the current address information. | |
| }, | |
| locationCallback = object : LocationCallback() { | |
| override fun onLocationResult(locationResult: LocationResult?) { | |
| if (locationResult != null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun initialize(activity: Activity) { | |
| initializeManagers(activity) | |
| requestLocationUpdates() | |
| } |