-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AND-320] Swipe to reply (XML artifact) #5626
base: develop
Are you sure you want to change the base?
Changes from all commits
f390136
ebf161e
2ec8244
1b2e56a
4accc5b
ed16557
925d69d
5471010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package io.getstream.chat.android.ui.feature.messages.list | |
import android.content.Context | ||
import android.content.res.TypedArray | ||
import android.graphics.Typeface | ||
import android.graphics.drawable.Drawable | ||
import android.util.AttributeSet | ||
import android.view.Gravity | ||
import androidx.annotation.ColorInt | ||
|
@@ -163,28 +164,29 @@ public data class MessageListViewStyle( | |
public val optionsOverlayMessageOptionsMarginEnd: Int, | ||
public val showReactionsForUnsentMessages: Boolean, | ||
public val readCountEnabled: Boolean, | ||
public val swipeToReplyIcon: Drawable?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a big deal, but the other icons in this theme are defined as |
||
) : ViewStyle { | ||
public companion object { | ||
private val DEFAULT_BACKGROUND_COLOR = R.color.stream_ui_white_snow | ||
private val DEFAULT_SCROLL_BUTTON_ELEVATION = 3.dpToPx().toFloat() | ||
private val DEFAULT_SCROLL_BUTTON_MARGIN = 6.dpToPx() | ||
private val DEFAULT_SCROLL_BUTTON_INTERNAL_MARGIN = 2.dpToPx() | ||
private val DEFAULT_SCROLL_BUTTON_BADGE_ELEVATION = DEFAULT_SCROLL_BUTTON_ELEVATION | ||
|
||
private val DEFAULT_EDIT_REACTIONS_MARGIN_TOP = 0.dpToPx() | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_BOTTOM = 0.dpToPx() | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_START = 50.dpToPx() | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_END = 8.dpToPx() | ||
|
||
private val DEFAULT_USER_REACTIONS_MARGIN_TOP = 8.dpToPx() | ||
private val DEFAULT_USER_REACTIONS_MARGIN_BOTTOM = 0.dpToPx() | ||
private val DEFAULT_USER_REACTIONS_MARGIN_START = 8.dpToPx() | ||
private val DEFAULT_USER_REACTIONS_MARGIN_END = 8.dpToPx() | ||
|
||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_TOP = 24.dpToPx() | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_BOTTOM = 0.dpToPx() | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_START = 50.dpToPx() | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_END = 8.dpToPx() | ||
private val DEFAULT_SCROLL_BUTTON_ELEVATION by lazy { 3.dpToPx().toFloat() } | ||
private val DEFAULT_SCROLL_BUTTON_MARGIN by lazy { 6.dpToPx() } | ||
private val DEFAULT_SCROLL_BUTTON_INTERNAL_MARGIN by lazy { 2.dpToPx() } | ||
private val DEFAULT_SCROLL_BUTTON_BADGE_ELEVATION by lazy { DEFAULT_SCROLL_BUTTON_ELEVATION } | ||
|
||
private val DEFAULT_EDIT_REACTIONS_MARGIN_TOP by lazy { 0.dpToPx() } | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_BOTTOM by lazy { 0.dpToPx() } | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_START by lazy { 50.dpToPx() } | ||
private val DEFAULT_EDIT_REACTIONS_MARGIN_END by lazy { 8.dpToPx() } | ||
|
||
private val DEFAULT_USER_REACTIONS_MARGIN_TOP by lazy { 8.dpToPx() } | ||
private val DEFAULT_USER_REACTIONS_MARGIN_BOTTOM by lazy { 0.dpToPx() } | ||
private val DEFAULT_USER_REACTIONS_MARGIN_START by lazy { 8.dpToPx() } | ||
private val DEFAULT_USER_REACTIONS_MARGIN_END by lazy { 8.dpToPx() } | ||
|
||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_TOP by lazy { 24.dpToPx() } | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_BOTTOM by lazy { 0.dpToPx() } | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_START by lazy { 50.dpToPx() } | ||
private val DEFAULT_MESSAGE_OPTIONS_MARGIN_END by lazy { 8.dpToPx() } | ||
|
||
/** | ||
* Creates an [MessageListViewStyle] instance with the default values. | ||
|
@@ -339,6 +341,13 @@ public data class MessageListViewStyle( | |
R.drawable.stream_ui_ic_arrow_curve_left_grey, | ||
) | ||
|
||
val replyToSwipeIcon: Drawable? = context.getDrawableCompat( | ||
attributes.getResourceId( | ||
R.styleable.MessageListView_streamUiSwipeToReplyIcon, | ||
R.drawable.stream_ui_ic_arrow_curve_left_grey, | ||
), | ||
) | ||
|
||
val replyEnabled = attributes.getBoolean(R.styleable.MessageListView_streamUiReplyEnabled, true) | ||
|
||
val threadReplyIcon = attributes.getResourceId( | ||
|
@@ -673,6 +682,7 @@ public data class MessageListViewStyle( | |
optionsOverlayMessageOptionsMarginEnd = optionsOverlayMessageOptionsMarginEnd, | ||
showReactionsForUnsentMessages = showReactionsForUnsentMessages, | ||
readCountEnabled = readCountEnabled, | ||
swipeToReplyIcon = replyToSwipeIcon, | ||
).let(TransformStyle.messageListStyleTransformer::transform) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ public abstract class BaseMessageItemViewHolder<T : MessageListItem>( | |
* Can be used for listeners that need to pass along the currently | ||
* bound data as a parameter. | ||
*/ | ||
protected lateinit var data: T | ||
internal lateinit var data: T | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this make the |
||
private set | ||
|
||
private var highlightAnimation: ValueAnimator? = null | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is it OK to always have the
swipe-to-reply
action enabled by default? Show it maybe be configurable via theMessageListViewStyle
?