mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Clean after benoit's review
This commit is contained in:
parent
ef2af14529
commit
fc49de080c
7 changed files with 55 additions and 45 deletions
|
@ -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 <T : Any> Observable<Optional<T>>.unwrap(): Observable<T> {
|
||||
return this
|
||||
.filter { it.hasValue() }
|
||||
.map { it.get() }
|
||||
return filter { it.hasValue() }.map { it.get() }
|
||||
}
|
|
@ -354,8 +354,11 @@ SOFTWARE.
|
|||
<br/>
|
||||
Copyright (C) 2012-2017 Markus Junginger, greenrobot (http://greenrobot.org)
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<b>LazyThreeTenBp</b>
|
||||
<br/>
|
||||
Copyright 2017 Gabriel Ittner.
|
||||
</li>
|
||||
</ul>
|
||||
<pre>
|
||||
Apache License
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<H : AbsMessageItem.Holder> : BaseEventItem<H>() {
|
|||
|
||||
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<H : AbsMessageItem.Holder> : BaseEventItem<H>() {
|
|||
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<H : AbsMessageItem.Holder> : BaseEventItem<H>() {
|
|||
val avatarImageView by bind<ImageView>(R.id.messageAvatarImageView)
|
||||
val memberNameView by bind<TextView>(R.id.messageMemberNameView)
|
||||
val timeView by bind<TextView>(R.id.messageTimeView)
|
||||
val reactionWrapper by bind<ViewGroup>(R.id.reactionsContainer)
|
||||
val reactionsContainer by bind<ViewGroup>(R.id.reactionsContainer)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
android:id="@+id/messageStartGuideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
tools:layout_marginStart="52dp" />
|
||||
|
||||
<FrameLayout
|
||||
|
@ -104,10 +103,10 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/informationBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:addStatesFromChildren="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/viewStubContainer"
|
||||
android:layout_toEndOf="@+id/messageStartGuideline"
|
||||
android:addStatesFromChildren="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
|
|
|
@ -10,47 +10,46 @@
|
|||
android:id="@+id/messageSelectedBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignBottom="@+id/informationBottom"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="?riotx_highlighted_message_background" />
|
||||
|
||||
<View
|
||||
android:id="@+id/messageStartGuideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="52dp"
|
||||
android:orientation="vertical" />
|
||||
android:layout_marginStart="52dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/viewStubContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_toEndOf="@id/messageStartGuideline"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_toEndOf="@id/messageStartGuideline">
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentNoticeStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout="@layout/item_timeline_event_notice_stub"
|
||||
tools:visibility="visible" />
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentNoticeStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout="@layout/item_timeline_event_notice_stub"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentDefaultStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:inflatedId="@+id/stateMessageView"
|
||||
android:layout="@layout/item_timeline_event_default_stub" />
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentDefaultStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:inflatedId="@+id/stateMessageView"
|
||||
android:layout="@layout/item_timeline_event_default_stub" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentBlankStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout="@layout/item_timeline_event_blank_stub" />
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentBlankStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout="@layout/item_timeline_event_blank_stub" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentMergedheaderStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout="@layout/item_timeline_event_merged_header_stub" />
|
||||
<ViewStub
|
||||
android:id="@+id/messageContentMergedheaderStub"
|
||||
style="@style/TimelineContentStubBaseParams"
|
||||
android:layout="@layout/item_timeline_event_merged_header_stub" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue