Clean files and update CHANGES

This commit is contained in:
ganfra 2020-09-24 17:48:42 +02:00 committed by Benoit Marty
parent 8bc0afa75e
commit 11a4704161
3 changed files with 15 additions and 4 deletions

View File

@ -6,6 +6,7 @@ Features ✨:
Improvements 🙌: Improvements 🙌:
- PIN code: request PIN code if phone has been locked - PIN code: request PIN code if phone has been locked
- Small optimisation of scrolling experience in timeline
Bugfix 🐛: Bugfix 🐛:
- Fix Splash layout on small screens - Fix Splash layout on small screens

View File

@ -81,7 +81,6 @@ import im.vector.app.core.glide.GlideRequests
import im.vector.app.core.intent.getMimeTypeFromUri import im.vector.app.core.intent.getMimeTypeFromUri
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.ui.model.Size
import im.vector.app.core.ui.views.ActiveCallView import im.vector.app.core.ui.views.ActiveCallView
import im.vector.app.core.ui.views.ActiveCallViewHolder import im.vector.app.core.ui.views.ActiveCallViewHolder
import im.vector.app.core.ui.views.ActiveConferenceView import im.vector.app.core.ui.views.ActiveConferenceView

View File

@ -56,6 +56,8 @@ import org.matrix.android.sdk.api.session.room.timeline.Timeline
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
import javax.inject.Inject import javax.inject.Inject
private const val DEFAULT_PREFETCH_THRESHOLD = 30
class TimelineEventController @Inject constructor(private val dateFormatter: VectorDateFormatter, class TimelineEventController @Inject constructor(private val dateFormatter: VectorDateFormatter,
private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder, private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder,
private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder, private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder,
@ -192,11 +194,11 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
models.add(position, readMarker) models.add(position, readMarker)
} }
} }
val shouldAdd = timeline?.hasMoreToLoad(Timeline.Direction.BACKWARDS) ?: false val shouldAddBackwardPrefetch = timeline?.hasMoreToLoad(Timeline.Direction.BACKWARDS) ?: false
if (shouldAdd) { if (shouldAddBackwardPrefetch) {
val indexOfPrefetchBackward = (previousModelsSize - 1) val indexOfPrefetchBackward = (previousModelsSize - 1)
.coerceAtMost(models.size - DEFAULT_PREFETCH_THRESHOLD)
.coerceAtLeast(0) .coerceAtLeast(0)
.coerceAtMost(models.size - 1)
val loadingItem = LoadingItem_() val loadingItem = LoadingItem_()
.id("prefetch_backward_loading${System.currentTimeMillis()}") .id("prefetch_backward_loading${System.currentTimeMillis()}")
@ -205,6 +207,15 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
models.add(indexOfPrefetchBackward, loadingItem) models.add(indexOfPrefetchBackward, loadingItem)
} }
val shouldAddForwardPrefetch = timeline?.hasMoreToLoad(Timeline.Direction.FORWARDS) ?: false
if (shouldAddForwardPrefetch) {
val indexOfPrefetchForward = DEFAULT_PREFETCH_THRESHOLD.coerceAtMost(models.size - 1)
val loadingItem = LoadingItem_()
.id("prefetch_forward_loading${System.currentTimeMillis()}")
.showLoader(false)
.setVisibilityStateChangedListener(Timeline.Direction.FORWARDS)
models.add(indexOfPrefetchForward, loadingItem)
}
previousModelsSize = models.size previousModelsSize = models.size
} }