From fc49de080c0dae3cccabb31a4777776b34125496 Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 7 Oct 2019 16:00:11 +0200 Subject: [PATCH] Clean after benoit's review --- .../java/im/vector/matrix/rx/OptionalRx.kt | 20 ++++++-- .../src/main/assets/open_source_licenses.html | 7 ++- .../timeline/factory/MessageItemFactory.kt | 2 - .../detail/timeline/item/AbsMessageItem.kt | 17 +++---- .../home/room/list/RoomSummaryController.kt | 2 + .../res/layout/item_timeline_event_base.xml | 3 +- .../item_timeline_event_base_noinfo.xml | 49 +++++++++---------- 7 files changed, 55 insertions(+), 45 deletions(-) diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt index ea6f5b1791..74ec10b0db 100644 --- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt +++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt @@ -1,10 +1,24 @@ +/* + * Copyright 2019 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package im.vector.matrix.rx import im.vector.matrix.android.api.util.Optional import io.reactivex.Observable fun Observable>.unwrap(): Observable { - return this - .filter { it.hasValue() } - .map { it.get() } + return filter { it.hasValue() }.map { it.get() } } \ No newline at end of file diff --git a/vector/src/main/assets/open_source_licenses.html b/vector/src/main/assets/open_source_licenses.html index 1195d38b90..837f63efe9 100755 --- a/vector/src/main/assets/open_source_licenses.html +++ b/vector/src/main/assets/open_source_licenses.html @@ -354,8 +354,11 @@ SOFTWARE.
Copyright (C) 2012-2017 Markus Junginger, greenrobot (http://greenrobot.org) - - +
  • + LazyThreeTenBp +
    + Copyright 2017 Gabriel Ittner. +
  •  Apache License
    diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt
    index 7b749ec5b7..34df00cac5 100644
    --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt
    +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt
    @@ -320,7 +320,6 @@ class MessageItemFactory @Inject constructor(
                 linkifyBody(formattedBody, callback)
             }
             return MessageTextItem_()
    -                .searchForPills(false)
                     .leftGuideline(avatarSizeProvider.leftGuideline)
                     .attributes(attributes)
                     .message(message)
    @@ -347,7 +346,6 @@ class MessageItemFactory @Inject constructor(
                             message(message)
                         }
                     }
    -                .searchForPills(false)
                     .leftGuideline(avatarSizeProvider.leftGuideline)
                     .attributes(attributes)
                     .highlighted(highlight)
    diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt
    index 9fcb95e9df..be44026166 100644
    --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt
    +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt
    @@ -17,16 +17,11 @@
     package im.vector.riotx.features.home.room.detail.timeline.item
     
     import android.graphics.Typeface
    -import android.os.Build
     import android.view.View
     import android.view.ViewGroup
    -import android.view.ViewStub
     import android.widget.ImageView
     import android.widget.TextView
     import androidx.annotation.IdRes
    -import androidx.constraintlayout.helper.widget.Flow
    -import androidx.core.view.children
    -import androidx.core.view.isGone
     import androidx.core.view.isVisible
     import com.airbnb.epoxy.EpoxyAttribute
     import im.vector.matrix.android.api.session.room.send.SendState
    @@ -124,10 +119,10 @@ abstract class AbsMessageItem : BaseEventItem() {
     
             val reactions = attributes.informationData.orderedReactionList
             if (!shouldShowReactionAtBottom() || reactions.isNullOrEmpty()) {
    -            holder.reactionWrapper.isVisible = false
    +            holder.reactionsContainer.isVisible = false
             } else {
    -            holder.reactionWrapper.isVisible = true
    -            holder.reactionWrapper.removeAllViews()
    +            holder.reactionsContainer.isVisible = true
    +            holder.reactionsContainer.removeAllViews()
                 reactions.take(8).forEach { reaction ->
                     val reactionButton = ReactionButton(holder.view.context)
                     reactionButton.reactedListener = reactionClickListener
    @@ -136,9 +131,9 @@ abstract class AbsMessageItem : BaseEventItem() {
                     reactionButton.reactionCount = reaction.count
                     reactionButton.setChecked(reaction.addedByMe)
                     reactionButton.isEnabled = reaction.synced
    -                holder.reactionWrapper.addView(reactionButton)
    +                holder.reactionsContainer.addView(reactionButton)
                 }
    -            holder.reactionWrapper.setOnLongClickListener(attributes.itemLongClickListener)
    +            holder.reactionsContainer.setOnLongClickListener(attributes.itemLongClickListener)
             }
         }
     
    @@ -166,7 +161,7 @@ abstract class AbsMessageItem : BaseEventItem() {
             val avatarImageView by bind(R.id.messageAvatarImageView)
             val memberNameView by bind(R.id.messageMemberNameView)
             val timeView by bind(R.id.messageTimeView)
    -        val reactionWrapper by bind(R.id.reactionsContainer)
    +        val reactionsContainer by bind(R.id.reactionsContainer)
         }
     
         /**
    diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomSummaryController.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomSummaryController.kt
    index f2e9fbc947..daee3876aa 100644
    --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomSummaryController.kt
    +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomSummaryController.kt
    @@ -37,6 +37,8 @@ class RoomSummaryController @Inject constructor(private val stringProvider: Stri
         private var viewState: RoomListViewState? = null
     
         init {
    +        // We are requesting a model build directly as the first build of epoxy is on the main thread.
    +        // It avoids to build the the whole list of rooms on the main thread.
             requestModelBuild()
         }
     
    diff --git a/vector/src/main/res/layout/item_timeline_event_base.xml b/vector/src/main/res/layout/item_timeline_event_base.xml
    index 853c01b426..ec5cac245d 100644
    --- a/vector/src/main/res/layout/item_timeline_event_base.xml
    +++ b/vector/src/main/res/layout/item_timeline_event_base.xml
    @@ -60,7 +60,6 @@
             android:id="@+id/messageStartGuideline"
             android:layout_width="0dp"
             android:layout_height="0dp"
    -        android:orientation="vertical"
             tools:layout_marginStart="52dp" />
     
         
     
             
     
         
    +        android:layout_marginStart="52dp" />
     
         
    +        android:layout_toEndOf="@id/messageStartGuideline">
     
    -    
    +        
     
    -    
    +        
     
    -    
    +        
     
    -    
    +