From 753e3e75192b2f3a0a26726e5e929174fbb26560 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Tue, 11 Jan 2022 15:31:21 +0200 Subject: [PATCH] - fix ktlint format - Update Threads toolbar UI --- .../android/sdk/common/CommonTestHelper.kt | 2 +- .../session/room/threads/ThreadMessagingTest.kt | 3 --- .../session/room/timeline/DefaultTimeline.kt | 5 ++--- .../room/timeline/LoadTimelineStrategy.kt | 3 +-- .../session/room/timeline/TimelineChunk.kt | 4 ++-- .../room/timeline/TokenChunkEventPersistor.kt | 2 +- .../home/room/detail/TimelineFragment.kt | 1 - .../layout/view_room_detail_thread_toolbar.xml | 16 +++++++++------- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt index 9f9667a759..031d0a8bcf 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt @@ -216,7 +216,7 @@ class CommonTestHelper(context: Context) { timeout: Long = TestConstants.timeOutMillis): List { val timeline = room.createTimeline(null, TimelineSettings(10)) timeline.start() - val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout,rootThreadEventId) + val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout, rootThreadEventId) timeline.dispose() // Check that all events has been created assertEquals("Message number do not match $sentEvents", numberOfMessages.toLong(), sentEvents.size.toLong()) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/threads/ThreadMessagingTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/threads/ThreadMessagingTest.kt index 0fdcfb2870..62887beba7 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/threads/ThreadMessagingTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/threads/ThreadMessagingTest.kt @@ -261,7 +261,6 @@ class ThreadMessagingTest : InstrumentedTest { val firstMessage = sentMessages[0] val secondMessage = sentMessages[1] - // Alice will reply in thread to the second message 35 times val aliceThreadRepliesInSecondMessage = commonTestHelper.replyInThreadMessage( room = aliceRoom, @@ -288,7 +287,6 @@ class ThreadMessagingTest : InstrumentedTest { numberOfMessages = 20, rootThreadEventId = secondMessage.root.eventId.orEmpty()) - aliceThreadRepliesInSecondMessage.forEach { it.root.isThread().shouldBeTrue() it.root.isTextMessage().shouldBeTrue() @@ -337,5 +335,4 @@ class ThreadMessagingTest : InstrumentedTest { } aliceSession.stopSync() } - } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt index 03ea2fdcb5..037edbd83d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/DefaultTimeline.kt @@ -127,11 +127,10 @@ internal class DefaultTimeline(private val roomId: String, } timelineScope.launch { sequencer.post { - if (isStarted.compareAndSet(false, true)) { isFromThreadTimeline = rootThreadEventId != null this@DefaultTimeline.rootThreadEventId = rootThreadEventId - /// + // / val realm = Realm.getInstance(realmConfiguration) ensureReadReceiptAreLoaded(realm) backgroundRealm.set(realm) @@ -157,7 +156,7 @@ internal class DefaultTimeline(private val roomId: String, override fun restartWithEventId(eventId: String?) { timelineScope.launch { - openAround(eventId,rootThreadEventId) + openAround(eventId, rootThreadEventId) postSnapshot() } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt index 4aee1b1a30..1d92d89a3a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LoadTimelineStrategy.kt @@ -171,7 +171,7 @@ internal class LoadTimelineStrategy( } suspend fun loadMore(count: Int, direction: Timeline.Direction, fetchOnServerIfNeeded: Boolean = true): LoadMoreResult { - /// + // / if (mode is Mode.Permalink && timelineChunk == null) { val params = GetContextOfEventTask.Params(roomId, mode.originEventId) try { @@ -208,7 +208,6 @@ internal class LoadTimelineStrategy( } private fun getChunkEntity(realm: Realm): RealmResults { - return when (mode) { is Mode.Live -> { ChunkEntity.where(realm, roomId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt index 2f53c666bc..eac653c72d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt @@ -138,8 +138,8 @@ internal class TimelineChunk(private val chunkEntity: ChunkEntity, } else if (direction == Timeline.Direction.BACKWARDS && prevChunk != null) { return prevChunk?.loadMore(count, direction, fetchOnServerIfNeeded) ?: LoadMoreResult.FAILURE } - val loadFromStorage = loadFromStorage(count, direction).also{ - logLoadedFromStorage(it,direction) + val loadFromStorage = loadFromStorage(count, direction).also { + logLoadedFromStorage(it, direction) } val offsetCount = count - loadFromStorage.numberOfEvents diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt index 186c59a562..5115c852ca 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt @@ -50,7 +50,7 @@ import javax.inject.Inject internal class TokenChunkEventPersistor @Inject constructor( @SessionDatabase private val monarchy: Monarchy, @UserId private val userId: String, - private val liveEventManager: Lazy ) { + private val liveEventManager: Lazy) { enum class Result { SHOULD_FETCH_MORE, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 86e7a5f78d..dc5eb34e08 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -196,7 +196,6 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import kotlinx.parcelize.Parcelize import nl.dionsegijn.konfetti.models.Shape import nl.dionsegijn.konfetti.models.Size import org.billcarsonfr.jsonviewer.JSonViewerDialog diff --git a/vector/src/main/res/layout/view_room_detail_thread_toolbar.xml b/vector/src/main/res/layout/view_room_detail_thread_toolbar.xml index 389dab4936..5de8ec3efa 100644 --- a/vector/src/main/res/layout/view_room_detail_thread_toolbar.xml +++ b/vector/src/main/res/layout/view_room_detail_thread_toolbar.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" + tools:layout_height="?actionBarSize" tools:visibility="visible">