Make SSD review callbacks non-null
ober
d2f325f0880100ce328c41c1924775ed33152b99
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -7126,7 +7126,7 @@ " session: SsdSession," " savingStatus: String," " savedStatus: String," - " afterSaved: (() -> Unit)? = null" + " afterSaved: () -> Unit = {}" " ) {" " val truth = ssdSessionToTruthJson(session)" " val viewport = reviewView.captureViewport()" @@ -7139,7 +7139,7 @@ " runOnUiThread {" " restoreViewportAfterLayout(viewport)" " setStatus(savedStatus)" - " afterSaved?.invoke()" + " afterSaved()" " }" " } catch (error: Exception) {" " runOnUiThread {" @@ -8230,9 +8230,9 @@ " field = value" " invalidate()" " }" - " var onAreaSelected: ((FloatArray, List<String>) -> Unit)? = null" - " var onGroupTapped: ((String) -> Unit)? = null" - " var onStatus: ((String) -> Unit)? = null" + " var onAreaSelected: (FloatArray, List<String>) -> Unit = { _, _ -> }" + " var onGroupTapped: (String) -> Unit = {}" + " var onStatus: (String) -> Unit = {}" "" " private val matrix = Matrix()" " private val inverse = Matrix()" @@ -8339,7 +8339,7 @@ " val point = viewToImage(event.x, event.y)" " hitGroup(point[0], point[1])?.let {" " selectedGroupId = it" - " onGroupTapped?.invoke(it)" + " onGroupTapped(it)" " }" " performClick()" " }" @@ -8428,12 +8428,12 @@ " invalidate()" " val sess = session" " if (sessionMissing(sess)) {" - " onStatus?.invoke(\"Selection ignored: truth/detection is still loading\")" + " onStatus(\"Selection ignored: truth/detection is still loading\")" " return" " }" " val activeSession = ssdSessionOrEmpty(sess)" " if (selectionRectTooSmall(rect, 4f)) {" - " onStatus?.invoke(\"Selection ignored: drag a larger area\")" + " onStatus(\"Selection ignored: drag a larger area\")" " return" " }" " val matching = if (shouldCollectSelectionMatches(snapSelectionToCells)) selectionMatchingCells(activeSession.cells, rect) else mutableListOf()" @@ -8444,8 +8444,8 @@ " } else {" " shrinkRectToBitmapContentOrOriginal(bitmap, rect)" " }" - " onStatus?.invoke(selectionResultStatus(snapSelectionToCells, matching.size))" - " onAreaSelected?.invoke(snapped, cellIdsForSelection(matching))" + " onStatus(selectionResultStatus(snapSelectionToCells, matching.size))" + " onAreaSelected(snapped, cellIdsForSelection(matching))" " invalidate()" " }" ""