Fix code quality check failures after new rules from #935 has been merged on develop.
This commit is contained in:
parent
b20448bf08
commit
1a1d4c2957
4 changed files with 13 additions and 18 deletions
|
|
@ -46,13 +46,13 @@ internal class MapTilerStaticMapUrlBuilder(
|
|||
density: Float
|
||||
): String {
|
||||
val mapId = if (darkMode) darkMapId else lightMapId
|
||||
val zoom = zoom.coerceIn(zoomRange)
|
||||
val finalZoom = zoom.coerceIn(zoomRange)
|
||||
|
||||
// Request @2x density for xhdpi and above (xhdpi == 320dpi == 2x density).
|
||||
val is2x = density >= 2
|
||||
|
||||
// Scale requested width/height according to the reported display density.
|
||||
val (width, height) = coerceWidthAndHeight(
|
||||
val (finalWidth, finalHeight) = coerceWidthAndHeight(
|
||||
width = (width / density).roundToInt(),
|
||||
height = (height / density).roundToInt(),
|
||||
is2x = is2x,
|
||||
|
|
@ -65,7 +65,7 @@ internal class MapTilerStaticMapUrlBuilder(
|
|||
// image smaller than the available space in pixels.
|
||||
// The resulting image will have to be scaled to fit the available space in order
|
||||
// to keep the perceived content size constant at the expense of sharpness.
|
||||
return "$MAPTILER_BASE_URL/${mapId}/static/${lon},${lat},${zoom}/${width}x${height}${scale}.webp?key=${apiKey}&attribution=bottomleft"
|
||||
return "$MAPTILER_BASE_URL/${mapId}/static/${lon},${lat},${finalZoom}/${finalWidth}x${finalHeight}${scale}.webp?key=${apiKey}&attribution=bottomleft"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,12 +78,12 @@ private fun coerceWidthAndHeight(width: Int, height: Int, is2x: Boolean): Pair<I
|
|||
val aspectRatio = width.toDouble() / height.toDouble()
|
||||
val range = if (is2x) widthHeightRange2x else widthHeightRange
|
||||
return if (width >= height) {
|
||||
width.coerceIn(range).let { width ->
|
||||
width to (width / aspectRatio).roundToInt()
|
||||
width.coerceIn(range).let { coercedWidth ->
|
||||
coercedWidth to (coercedWidth / aspectRatio).roundToInt()
|
||||
}
|
||||
} else {
|
||||
height.coerceIn(range).let { height ->
|
||||
(height * aspectRatio).roundToInt() to height
|
||||
height.coerceIn(range).let { coercedHeight ->
|
||||
(coercedHeight * aspectRatio).roundToInt() to coercedHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.ui.zIndex
|
||||
import androidx.constraintlayout.compose.ConstrainScope
|
||||
import androidx.constraintlayout.compose.ConstraintLayout
|
||||
import com.google.accompanist.flowlayout.FlowMainAxisAlignment
|
||||
import io.element.android.features.messages.impl.timeline.aTimelineItemEvent
|
||||
import io.element.android.features.messages.impl.timeline.aTimelineItemReactions
|
||||
import io.element.android.features.messages.impl.timeline.components.event.TimelineItemEventContentView
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ fun TimelineItemReactionsLayout(
|
|||
lastRow.forEachIndexed { i, placeable ->
|
||||
val horizontalSpacing = if (i == 0) 0 else itemSpacing.toPx().toInt()
|
||||
rowX += placeable.width + horizontalSpacing
|
||||
if (rowX > (constraints.maxWidth - (buttonsWidth + horizontalSpacing))) {
|
||||
if (rowX > constraints.maxWidth - (buttonsWidth + horizontalSpacing)) {
|
||||
val lastRowWithButton = lastRow.take(i) + listOf(expandButton, addMoreButton)
|
||||
rows[rows.size - 1] = lastRowWithButton
|
||||
return rows
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class RoomMemberListPresenterTests {
|
|||
Truth.assertThat(initialState.searchQuery).isEmpty()
|
||||
Truth.assertThat(initialState.searchResults).isInstanceOf(SearchBarResultState.NotSearching::class.java)
|
||||
Truth.assertThat(initialState.isSearchActive).isFalse()
|
||||
|
||||
val loadedState = awaitItem()
|
||||
Truth.assertThat(loadedState.roomMembers).isInstanceOf(Async.Success::class.java)
|
||||
Truth.assertThat((loadedState.roomMembers as Async.Success).data.invited).isEqualTo(listOf(aVictor(), aWalter()))
|
||||
|
|
@ -66,11 +65,9 @@ class RoomMemberListPresenterTests {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
skipItems(1)
|
||||
val loadedState = awaitItem()
|
||||
|
||||
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
||||
|
||||
val searchActiveState = awaitItem()
|
||||
Truth.assertThat(searchActiveState.isSearchActive).isTrue()
|
||||
}
|
||||
|
|
@ -82,11 +79,11 @@ class RoomMemberListPresenterTests {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
skipItems(1)
|
||||
val loadedState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
||||
val searchActiveState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("something"))
|
||||
searchActiveState.eventSink(RoomMemberListEvents.UpdateSearchQuery("something"))
|
||||
val searchQueryUpdatedState = awaitItem()
|
||||
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("something")
|
||||
val searchSearchResultDelivered = awaitItem()
|
||||
|
|
@ -100,18 +97,17 @@ class RoomMemberListPresenterTests {
|
|||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
skipItems(1)
|
||||
val loadedState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
||||
val searchActiveState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("Alice"))
|
||||
searchActiveState.eventSink(RoomMemberListEvents.UpdateSearchQuery("Alice"))
|
||||
val searchQueryUpdatedState = awaitItem()
|
||||
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("Alice")
|
||||
val searchSearchResultDelivered = awaitItem()
|
||||
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.Results::class.java)
|
||||
Truth.assertThat((searchSearchResultDelivered.searchResults as SearchBarResultState.Results).results.joined.first().displayName)
|
||||
.isEqualTo("Alice")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue