Enable detekt rules UnnecessaryParentheses and cleanup the code.
This commit is contained in:
parent
2928073e22
commit
c75eabbcb0
16 changed files with 27 additions and 23 deletions
|
|
@ -29,7 +29,7 @@ fun Modifier.centerBottomEdge(scope: BoxScope): Modifier = with(scope) {
|
|||
Modifier.align { size, space, _ ->
|
||||
IntOffset(
|
||||
x = (space.width - size.width) / 2,
|
||||
y = (space.height / 2) - size.height,
|
||||
y = space.height / 2 - size.height,
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ data class LoginPasswordState(
|
|||
) {
|
||||
val submitEnabled: Boolean
|
||||
get() = loginAction !is Async.Failure &&
|
||||
((formState.login.isNotEmpty() && formState.password.isNotEmpty()))
|
||||
formState.login.isNotEmpty() &&
|
||||
formState.password.isNotEmpty()
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ fun TimelineItem.Event.toExtraPadding(): ExtraPadding {
|
|||
fun ExtraPadding.getStr(fontSize: TextUnit): String {
|
||||
if (nbChars == 0) return ""
|
||||
val timestampFontSize = ElementTheme.typography.fontBodyXsRegular.fontSize // 11.sp
|
||||
val nbOfSpaces = ((timestampFontSize.value / fontSize.value) * nbChars).toInt() + 1
|
||||
val nbOfSpaces = (timestampFontSize.value / fontSize.value * nbChars).toInt() + 1
|
||||
// A space and some unbreakable spaces
|
||||
return " " + "\u00A0".repeat(nbOfSpaces)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ private fun HtmlMxReply(
|
|||
Surface(
|
||||
modifier = modifier
|
||||
.padding(bottom = 4.dp)
|
||||
.offset(x = -(8.dp)),
|
||||
.offset(x = (-8).dp),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
shape = shape,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class AttachmentsPreviewPresenterTest {
|
|||
val loadingState = awaitItem()
|
||||
assertThat(loadingState.sendActionState).isEqualTo(SendActionState.Sending.Processing)
|
||||
val failureState = awaitItem()
|
||||
assertThat(failureState.sendActionState).isEqualTo((SendActionState.Failure(failure)))
|
||||
assertThat(failureState.sendActionState).isEqualTo(SendActionState.Failure(failure))
|
||||
assertThat(room.sendMediaCount).isEqualTo(0)
|
||||
failureState.eventSink(AttachmentsPreviewEvents.ClearSendState)
|
||||
val clearedState = awaitItem()
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class RoomInviteMembersPresenter @Inject constructor(
|
|||
value = if (value.contains(user)) {
|
||||
value.filterNot { it == user }
|
||||
} else {
|
||||
(value + user)
|
||||
value + user
|
||||
}.toImmutableList()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class RoomMemberListPresenterTests {
|
|||
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
||||
|
||||
val searchActiveState = awaitItem()
|
||||
Truth.assertThat((searchActiveState.isSearchActive)).isTrue()
|
||||
Truth.assertThat(searchActiveState.isSearchActive).isTrue()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class RoomMemberListPresenterTests {
|
|||
val searchActiveState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("something"))
|
||||
val searchQueryUpdatedState = awaitItem()
|
||||
Truth.assertThat((searchQueryUpdatedState.searchQuery)).isEqualTo("something")
|
||||
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("something")
|
||||
val searchSearchResultDelivered = awaitItem()
|
||||
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.NoResults::class.java)
|
||||
}
|
||||
|
|
@ -106,9 +106,9 @@ class RoomMemberListPresenterTests {
|
|||
val searchActiveState = awaitItem()
|
||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("Alice"))
|
||||
val searchQueryUpdatedState = awaitItem()
|
||||
Truth.assertThat((searchQueryUpdatedState.searchQuery)).isEqualTo("Alice")
|
||||
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("Alice")
|
||||
val searchSearchResultDelivered = awaitItem()
|
||||
Truth.assertThat((searchSearchResultDelivered.searchResults)).isInstanceOf(SearchBarResultState.Results::class.java)
|
||||
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.Results::class.java)
|
||||
Truth.assertThat((searchSearchResultDelivered.searchResults as SearchBarResultState.Results).results.joined.first().displayName)
|
||||
.isEqualTo("Alice")
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ private fun RowScope.NameAndTimestampRow(room: RoomListRoomSummary) {
|
|||
@Composable
|
||||
private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) {
|
||||
// Last Message
|
||||
val attributedLastMessage = (room.lastMessage as? AnnotatedString)
|
||||
val attributedLastMessage = room.lastMessage as? AnnotatedString
|
||||
?: AnnotatedString(room.lastMessage.orEmpty().toString())
|
||||
Text(
|
||||
modifier = Modifier
|
||||
|
|
@ -186,10 +186,10 @@ class PercentRectangleSizeShape(private val percent: Float) : Shape {
|
|||
val halfPercent = percent / 2f
|
||||
val path = Path().apply {
|
||||
val rect = Rect(
|
||||
0f,
|
||||
size.height * halfPercent,
|
||||
size.width,
|
||||
size.height - (size.height * halfPercent)
|
||||
left = 0f,
|
||||
top = size.height * halfPercent,
|
||||
right = size.width,
|
||||
bottom = size.height * (1 - halfPercent)
|
||||
)
|
||||
addRect(rect)
|
||||
close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue