Metuuu
2/16/2018 - 6:42 PM

tyhmä delay koodi josta voi tehdä ajastimen

lateinit var clusterMarkers: (fromDelay: Boolean) -> Unit
		var originalDelayX100 = 25000L
		var delayX100 = originalDelayX100
		var clustering = false

		val startTime = System.currentTimeMillis()

		val calculateDelay: () -> Unit = {
			if (originalDelayX100 == delayX100) {
				Log.d("aaaaa", (System.currentTimeMillis() - startTime).toString())
				clusterManagerLocationPoint.cluster()
			} else {
				delayX100 -= originalDelayX100
				originalDelayX100 = delayX100
				clustering = false
				clusterMarkers(true)
			}
		}

		clusterMarkers = { fromDelay ->
			if (!clustering) {
				clustering = true
				Handler().postDelayed({
					calculateDelay()
				}, delayX100 / 100)

			}
			if (!fromDelay) delayX100 += 5
		}