forked from upstream-mirrors/quik
#1075 - Rewrite message layout and adapter
This addresses the following issues - Message layout doesn't use ConstraintLayout - Images don't have individual bubbles - Image bubbles don't have the correct bubble grouping
This commit is contained in:
@@ -97,8 +97,7 @@ open class Message : RealmObject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the text that should be displayed in the messagelist view
|
* Returns the text that should be copied to the clipboard
|
||||||
* The returned text may be an empty string
|
|
||||||
*/
|
*/
|
||||||
fun getText(): String {
|
fun getText(): String {
|
||||||
return when {
|
return when {
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of QKSMS.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package common.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Canvas
|
||||||
|
import android.graphics.Path
|
||||||
|
import android.graphics.RectF
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.widget.ImageView
|
||||||
|
import common.util.extensions.dpToPx
|
||||||
|
|
||||||
|
class BubbleImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ImageView(context, attrs) {
|
||||||
|
|
||||||
|
enum class Style(val topLeft: Boolean, val topRight: Boolean, val bottomRight: Boolean, val bottomLeft: Boolean) {
|
||||||
|
|
||||||
|
ONLY(true, true, true, true),
|
||||||
|
IN_FIRST(true, true, true, false),
|
||||||
|
IN_MIDDLE(false, true, true, false),
|
||||||
|
IN_LAST(false, true, true, true),
|
||||||
|
OUT_FIRST(true, true, false, true),
|
||||||
|
OUT_MIDDLE(true, false, false, true),
|
||||||
|
OUT_LAST(true, false, true, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
var bubbleStyle = Style.ONLY
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
setPath()
|
||||||
|
invalidate()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val path = Path()
|
||||||
|
private val radiusSmall = 4.dpToPx(context).toFloat()
|
||||||
|
private val radiusLarge = 18.dpToPx(context).toFloat()
|
||||||
|
|
||||||
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||||
|
super.onSizeChanged(w, h, oldw, oldh)
|
||||||
|
setPath()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDraw(canvas: Canvas) {
|
||||||
|
if (!path.isEmpty) {
|
||||||
|
canvas.clipPath(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onDraw(canvas)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setPath() {
|
||||||
|
path.rewind()
|
||||||
|
|
||||||
|
val width = width.toFloat()
|
||||||
|
val height = height.toFloat()
|
||||||
|
|
||||||
|
val cornerRectSmall = RectF().apply { set(-radiusSmall, -radiusSmall, radiusSmall, radiusSmall) }
|
||||||
|
val cornerRectLarge = RectF().apply { set(-radiusLarge, -radiusLarge, radiusLarge, radiusLarge) }
|
||||||
|
|
||||||
|
if (bubbleStyle.topLeft) {
|
||||||
|
cornerRectLarge.offsetTo(0f, 0f)
|
||||||
|
path.arcTo(cornerRectLarge, 180f, 90f)
|
||||||
|
} else {
|
||||||
|
cornerRectSmall.offsetTo(0f, 0f)
|
||||||
|
path.arcTo(cornerRectSmall, 180f, 90f)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bubbleStyle.topRight) {
|
||||||
|
cornerRectLarge.offsetTo(width - radiusLarge * 2, 0f)
|
||||||
|
path.arcTo(cornerRectLarge, 270f, 90f)
|
||||||
|
} else {
|
||||||
|
cornerRectSmall.offsetTo(width - radiusSmall * 2, 0f)
|
||||||
|
path.arcTo(cornerRectSmall, 270f, 90f)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bubbleStyle.bottomRight) {
|
||||||
|
cornerRectLarge.offsetTo(width - radiusLarge * 2, height - radiusLarge * 2)
|
||||||
|
path.arcTo(cornerRectLarge, 0f, 90f)
|
||||||
|
} else {
|
||||||
|
cornerRectSmall.offsetTo(width - radiusSmall * 2, height - radiusSmall * 2)
|
||||||
|
path.arcTo(cornerRectSmall, 0f, 90f)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bubbleStyle.bottomLeft) {
|
||||||
|
cornerRectLarge.offsetTo(0f, height - radiusLarge * 2)
|
||||||
|
path.arcTo(cornerRectLarge, 90f, 90f)
|
||||||
|
} else {
|
||||||
|
cornerRectSmall.offsetTo(0f, height - radiusSmall * 2)
|
||||||
|
path.arcTo(cornerRectSmall, 90f, 90f)
|
||||||
|
}
|
||||||
|
|
||||||
|
path.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of QKSMS.
|
|
||||||
*
|
|
||||||
* QKSMS is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* QKSMS is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package common.widget
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import com.moez.QKSMS.R
|
|
||||||
import common.Navigator
|
|
||||||
import common.util.GlideApp
|
|
||||||
import common.util.extensions.setVisible
|
|
||||||
import injection.appComponent
|
|
||||||
import kotlinx.android.synthetic.main.mms_preview_list_item.view.*
|
|
||||||
import model.MmsPart
|
|
||||||
import util.extensions.hasThumbnails
|
|
||||||
import util.extensions.isImage
|
|
||||||
import util.extensions.isVideo
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class MmsPreviewView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout(context, attrs) {
|
|
||||||
|
|
||||||
@Inject lateinit var navigator: Navigator
|
|
||||||
|
|
||||||
private val layoutInflater = LayoutInflater.from(context)
|
|
||||||
|
|
||||||
var parts: List<MmsPart> = ArrayList()
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
updateView()
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
if (!isInEditMode) {
|
|
||||||
appComponent.inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
orientation = LinearLayout.VERTICAL
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateView() {
|
|
||||||
val media = parts.filter { it.hasThumbnails() }
|
|
||||||
setVisible(media.isNotEmpty())
|
|
||||||
|
|
||||||
if (childCount > 0) {
|
|
||||||
removeAllViews()
|
|
||||||
}
|
|
||||||
|
|
||||||
media.forEach { part ->
|
|
||||||
val view = layoutInflater.inflate(R.layout.mms_preview_list_item, this, false)
|
|
||||||
view.video.setVisible(part.isVideo())
|
|
||||||
|
|
||||||
GlideApp.with(context).load(part.getUri()).fitCenter().into(view.thumbnail)
|
|
||||||
|
|
||||||
setOnClickListener {
|
|
||||||
when {
|
|
||||||
part.isImage() -> navigator.showImage(part.id)
|
|
||||||
part.isVideo() -> navigator.showVideo(part.getUri(), part.type)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addView(view)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,39 +19,52 @@
|
|||||||
package feature.compose
|
package feature.compose
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Typeface
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.RecyclerView
|
||||||
import android.telephony.PhoneNumberUtils
|
import android.telephony.PhoneNumberUtils
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.text.style.StyleSpan
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.jakewharton.rxbinding2.view.RxView
|
import com.jakewharton.rxbinding2.view.RxView
|
||||||
|
import com.jakewharton.rxbinding2.view.clicks
|
||||||
|
import com.jakewharton.rxbinding2.view.longClicks
|
||||||
import com.moez.QKSMS.R
|
import com.moez.QKSMS.R
|
||||||
|
import common.Navigator
|
||||||
import common.base.QkRealmAdapter
|
import common.base.QkRealmAdapter
|
||||||
import common.base.QkViewHolder
|
import common.base.QkViewHolder
|
||||||
import common.util.Colors
|
import common.util.Colors
|
||||||
import common.util.DateFormatter
|
import common.util.DateFormatter
|
||||||
|
import common.util.GlideApp
|
||||||
import common.util.extensions.dpToPx
|
import common.util.extensions.dpToPx
|
||||||
import common.util.extensions.setBackgroundTint
|
import common.util.extensions.setBackgroundTint
|
||||||
import common.util.extensions.setPadding
|
import common.util.extensions.setPadding
|
||||||
import common.util.extensions.setVisible
|
import common.util.extensions.setVisible
|
||||||
|
import common.widget.BubbleImageView.Style.*
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxkotlin.plusAssign
|
import io.reactivex.rxkotlin.plusAssign
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.PublishSubject
|
||||||
import io.reactivex.subjects.Subject
|
import io.reactivex.subjects.Subject
|
||||||
import io.realm.RealmResults
|
import io.realm.RealmResults
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.view.*
|
import kotlinx.android.synthetic.main.message_list_item_in.view.*
|
||||||
|
import kotlinx.android.synthetic.main.mms_preview_list_item.view.*
|
||||||
import model.Conversation
|
import model.Conversation
|
||||||
import model.Message
|
import model.Message
|
||||||
import model.Recipient
|
import model.Recipient
|
||||||
import util.extensions.hasThumbnails
|
import util.extensions.hasThumbnails
|
||||||
|
import util.extensions.isImage
|
||||||
|
import util.extensions.isVideo
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class MessagesAdapter @Inject constructor(
|
class MessagesAdapter @Inject constructor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val colors: Colors,
|
private val colors: Colors,
|
||||||
private val dateFormatter: DateFormatter
|
private val dateFormatter: DateFormatter,
|
||||||
|
private val navigator: Navigator
|
||||||
) : QkRealmAdapter<Message>() {
|
) : QkRealmAdapter<Message>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -84,6 +97,7 @@ class MessagesAdapter @Inject constructor(
|
|||||||
private val conversation: Conversation?
|
private val conversation: Conversation?
|
||||||
get() = data?.first?.takeIf { it.isValid }
|
get() = data?.first?.takeIf { it.isValid }
|
||||||
|
|
||||||
|
private val layoutInflater = LayoutInflater.from(context)
|
||||||
private val contactCache = ContactCache()
|
private val contactCache = ContactCache()
|
||||||
private val selected = HashMap<Long, Boolean>()
|
private val selected = HashMap<Long, Boolean>()
|
||||||
private val disposables = CompositeDisposable()
|
private val disposables = CompositeDisposable()
|
||||||
@@ -98,20 +112,20 @@ class MessagesAdapter @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
||||||
|
|
||||||
|
// Use the parent's context to inflate the layout, otherwise link clicks will crash the app
|
||||||
val layoutInflater = LayoutInflater.from(parent.context)
|
val layoutInflater = LayoutInflater.from(parent.context)
|
||||||
val view: View
|
val view: View
|
||||||
|
|
||||||
if (viewType == VIEW_TYPE_MESSAGE_OUT) {
|
if (viewType == VIEW_TYPE_MESSAGE_OUT) {
|
||||||
view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false)
|
view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false)
|
||||||
disposables += colors.bubble
|
disposables += colors.bubble
|
||||||
.subscribe { color -> view.messageBackground.setBackgroundTint(color) }
|
.subscribe { color -> view.body.setBackgroundTint(color) }
|
||||||
} else {
|
} else {
|
||||||
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
||||||
view.avatar.threadId = conversation?.id ?: 0
|
view.avatar.threadId = conversation?.id ?: 0
|
||||||
view.subject.textColorObservable = textPrimaryOnTheme
|
|
||||||
view.body.textColorObservable = textPrimaryOnTheme
|
view.body.textColorObservable = textPrimaryOnTheme
|
||||||
disposables += theme
|
disposables += theme
|
||||||
.subscribe { color -> view.messageBackground.setBackgroundTint(color) }
|
.subscribe { color -> view.body.setBackgroundTint(color) }
|
||||||
}
|
}
|
||||||
|
|
||||||
return QkViewHolder(view)
|
return QkViewHolder(view)
|
||||||
@@ -124,41 +138,111 @@ class MessagesAdapter @Inject constructor(
|
|||||||
|
|
||||||
override fun onBindViewHolder(viewHolder: QkViewHolder, position: Int) {
|
override fun onBindViewHolder(viewHolder: QkViewHolder, position: Int) {
|
||||||
val message = getItem(position)!!
|
val message = getItem(position)!!
|
||||||
|
val previous = if (position == 0) null else getItem(position - 1)
|
||||||
|
val next = if (position == itemCount - 1) null else getItem(position + 1)
|
||||||
val view = viewHolder.itemView
|
val view = viewHolder.itemView
|
||||||
|
|
||||||
RxView.clicks(view).subscribe {
|
RxView.clicks(view).subscribe {
|
||||||
clicks.onNext(message)
|
clicks.onNext(message)
|
||||||
selected[message.id] = view.status.visibility != View.VISIBLE
|
selected[message.id] = view.status.visibility != View.VISIBLE
|
||||||
notifyItemChanged(position)
|
bindStatus(viewHolder, position)
|
||||||
}
|
}
|
||||||
RxView.longClicks(view).subscribe { longClicks.onNext(message) }
|
RxView.longClicks(view).subscribe { longClicks.onNext(message) }
|
||||||
|
|
||||||
view.mmsPreview.parts = message.parts
|
bindStatus(viewHolder, position)
|
||||||
|
|
||||||
view.subject.text = message.getCleansedSubject()
|
|
||||||
view.subject.setVisible(view.subject.text.isNotBlank())
|
|
||||||
|
|
||||||
view.body.text = message.getText()
|
|
||||||
view.body.setVisible(message.isSms() || view.body.text.isNotEmpty() || message.parts.all { !it.hasThumbnails() })
|
|
||||||
|
|
||||||
|
// Bind the timestamp
|
||||||
|
val timeSincePrevious = TimeUnit.MILLISECONDS.toMinutes(message.date - (previous?.date ?: 0))
|
||||||
view.timestamp.text = dateFormatter.getMessageTimestamp(message.date)
|
view.timestamp.text = dateFormatter.getMessageTimestamp(message.date)
|
||||||
|
view.timestamp.visibility = if (timeSincePrevious < TIMESTAMP_THRESHOLD) View.GONE else View.VISIBLE
|
||||||
|
|
||||||
bindAvatar(view, position)
|
|
||||||
bindStatus(view, position)
|
// Bind the grouping
|
||||||
bindGrouping(view, position)
|
val media = message.parts.filter { it.hasThumbnails() }
|
||||||
|
view.setPadding(bottom = if (canGroup(message, next)) 0 else 16.dpToPx(context))
|
||||||
|
|
||||||
|
|
||||||
|
// Bind the avatar
|
||||||
|
if (!message.isMe()) {
|
||||||
|
view.avatar.threadId = conversation?.id ?: 0
|
||||||
|
view.avatar.setContact(contactCache[message.address])
|
||||||
|
view.avatar.setVisible(!canGroup(message, next), View.INVISIBLE)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Bind the body text
|
||||||
|
view.body.text = when (message.isSms()) {
|
||||||
|
true -> message.body
|
||||||
|
false -> {
|
||||||
|
val subject = message.getCleansedSubject()
|
||||||
|
val sb = SpannableStringBuilder(message.parts
|
||||||
|
.mapNotNull { it.text }
|
||||||
|
.apply { subject + this }
|
||||||
|
.filter { it.isNotBlank() }
|
||||||
|
.joinToString("\n") { text -> text })
|
||||||
|
|
||||||
|
val bss = StyleSpan(Typeface.BOLD)
|
||||||
|
sb.setSpan(bss, 0, subject.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
|
||||||
|
sb.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view.body.setVisible(message.isSms() || view.body.text.isNotBlank())
|
||||||
|
|
||||||
|
val canBodyGroupWithPrevious = canGroup(message, previous) || media.isNotEmpty()
|
||||||
|
val canBodyGroupWithNext = canGroup(message, next)
|
||||||
|
view.body.setBackgroundResource(when {
|
||||||
|
!canBodyGroupWithPrevious && canBodyGroupWithNext -> if (message.isMe()) R.drawable.message_out_first else R.drawable.message_in_first
|
||||||
|
canBodyGroupWithPrevious && canBodyGroupWithNext -> if (message.isMe()) R.drawable.message_out_middle else R.drawable.message_in_middle
|
||||||
|
canBodyGroupWithPrevious && !canBodyGroupWithNext -> if (message.isMe()) R.drawable.message_out_last else R.drawable.message_in_last
|
||||||
|
else -> R.drawable.message_only
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Bind the attachments
|
||||||
|
view.attachments.setVisible(media.isNotEmpty())
|
||||||
|
if (view.attachments.childCount > 0) {
|
||||||
|
view.attachments.removeAllViews()
|
||||||
|
}
|
||||||
|
|
||||||
|
media.forEachIndexed { index, part ->
|
||||||
|
val mediaView = layoutInflater.inflate(R.layout.mms_preview_list_item, view.attachments, false)
|
||||||
|
mediaView.video.setVisible(part.isVideo())
|
||||||
|
mediaView.longClicks().subscribe { longClicks.onNext(message) }
|
||||||
|
mediaView.clicks().subscribe {
|
||||||
|
when {
|
||||||
|
part.isImage() -> navigator.showImage(part.id)
|
||||||
|
part.isVideo() -> navigator.showVideo(part.getUri(), part.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val canMediaGroupWithPrevious = canGroup(message, previous) || index > 0
|
||||||
|
val canMediaGroupWithNext = canGroup(message, next) || index < media.size && view.body.visibility == View.VISIBLE
|
||||||
|
mediaView.thumbnail.bubbleStyle = when {
|
||||||
|
!canMediaGroupWithPrevious && canMediaGroupWithNext -> if (message.isMe()) OUT_FIRST else IN_FIRST
|
||||||
|
canMediaGroupWithPrevious && canMediaGroupWithNext -> if (message.isMe()) OUT_MIDDLE else IN_MIDDLE
|
||||||
|
canMediaGroupWithPrevious && !canMediaGroupWithNext -> if (message.isMe()) OUT_LAST else IN_LAST
|
||||||
|
else -> ONLY
|
||||||
|
}
|
||||||
|
|
||||||
|
GlideApp.with(context).load(part.getUri()).fitCenter().into(mediaView.thumbnail)
|
||||||
|
view.attachments.addView(mediaView)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If we're on API 21, we need to re-tint the background
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
|
view.body.setBackgroundTint(when (message.isMe()) {
|
||||||
|
true -> colors.bubble
|
||||||
|
false -> theme
|
||||||
|
}.blockingFirst())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindAvatar(view: View, position: Int) {
|
private fun bindStatus(viewHolder: QkViewHolder, position: Int) {
|
||||||
val message = getItem(position)!!
|
|
||||||
if (message.isMe()) return
|
|
||||||
|
|
||||||
view.avatar.threadId = conversation?.id ?: 0
|
|
||||||
view.avatar.setContact(contactCache[message.address])
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun bindStatus(view: View, position: Int) {
|
|
||||||
val message = getItem(position)!!
|
val message = getItem(position)!!
|
||||||
val next = if (position == itemCount - 1) null else getItem(position + 1)
|
val next = if (position == itemCount - 1) null else getItem(position + 1)
|
||||||
|
val view = viewHolder.itemView
|
||||||
|
|
||||||
val age = TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - message.date)
|
val age = TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - message.date)
|
||||||
val timestamp = dateFormatter.getTimestamp(message.date)
|
val timestamp = dateFormatter.getTimestamp(message.date)
|
||||||
@@ -182,59 +266,6 @@ class MessagesAdapter @Inject constructor(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindGrouping(view: View, position: Int) {
|
|
||||||
val message = getItem(position)!!
|
|
||||||
val previous = if (position == 0) null else getItem(position - 1)
|
|
||||||
val next = if (position == itemCount - 1) null else getItem(position + 1)
|
|
||||||
|
|
||||||
val diff = TimeUnit.MILLISECONDS.toMinutes(message.date - (previous?.date ?: 0))
|
|
||||||
|
|
||||||
val sent = message.isMe()
|
|
||||||
val canGroupWithPrevious = canGroup(message, previous)
|
|
||||||
val canGroupWithNext = canGroup(message, next)
|
|
||||||
|
|
||||||
view.timestamp.visibility = if (diff < TIMESTAMP_THRESHOLD) View.GONE else View.VISIBLE
|
|
||||||
|
|
||||||
when {
|
|
||||||
!canGroupWithPrevious && canGroupWithNext -> {
|
|
||||||
view.setPadding(bottom = 2.dpToPx(context))
|
|
||||||
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_first else R.drawable.message_in_first)
|
|
||||||
view.avatar?.visibility = View.INVISIBLE
|
|
||||||
}
|
|
||||||
canGroupWithPrevious && canGroupWithNext -> {
|
|
||||||
view.setPadding(bottom = 2.dpToPx(context))
|
|
||||||
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_middle else R.drawable.message_in_middle)
|
|
||||||
view.avatar?.visibility = View.INVISIBLE
|
|
||||||
}
|
|
||||||
canGroupWithPrevious && !canGroupWithNext -> {
|
|
||||||
view.setPadding(bottom = 16.dpToPx(context))
|
|
||||||
view.messageBackground.setBackgroundResource(if (sent) R.drawable.message_out_last else R.drawable.message_in_last)
|
|
||||||
view.avatar?.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
view.setPadding(bottom = 16.dpToPx(context))
|
|
||||||
view.messageBackground.setBackgroundResource(R.drawable.message_only)
|
|
||||||
view.avatar?.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're showing any thumbnails, set clipToOutline to true
|
|
||||||
val hasImages = message.parts.filter { it.hasThumbnails() }.any()
|
|
||||||
view.messageBackground.clipToOutline = hasImages
|
|
||||||
|
|
||||||
// setClipToOutline doesn't work unless all of the corners have the same radius, so we have
|
|
||||||
// to use the message_only bubble
|
|
||||||
if (hasImages) view.messageBackground.setBackgroundResource(R.drawable.message_only)
|
|
||||||
|
|
||||||
// If we're on API 21, we need to re-tint the background
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
|
|
||||||
view.messageBackground.setBackgroundTint(when (message.isMe()) {
|
|
||||||
true -> colors.bubble
|
|
||||||
false -> theme
|
|
||||||
}.blockingFirst())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun canGroup(message: Message, other: Message?): Boolean {
|
private fun canGroup(message: Message, other: Message?): Boolean {
|
||||||
if (other == null) return false
|
if (other == null) return false
|
||||||
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import common.QKApplication
|
|||||||
import common.QkDialog
|
import common.QkDialog
|
||||||
import common.util.ContactImageLoader
|
import common.util.ContactImageLoader
|
||||||
import common.widget.AvatarView
|
import common.widget.AvatarView
|
||||||
import common.widget.MmsPreviewView
|
|
||||||
import common.widget.PagerTitleView
|
import common.widget.PagerTitleView
|
||||||
import common.widget.PreferenceView
|
import common.widget.PreferenceView
|
||||||
import common.widget.QkEditText
|
import common.widget.QkEditText
|
||||||
@@ -112,7 +111,6 @@ interface AppComponent {
|
|||||||
|
|
||||||
fun inject(view: AvatarView)
|
fun inject(view: AvatarView)
|
||||||
fun inject(view: DetailedChipView)
|
fun inject(view: DetailedChipView)
|
||||||
fun inject(view: MmsPreviewView)
|
|
||||||
fun inject(view: PagerTitleView)
|
fun inject(view: PagerTitleView)
|
||||||
fun inject(view: PreferenceView)
|
fun inject(view: PreferenceView)
|
||||||
fun inject(view: QkEditText)
|
fun inject(view: QkEditText)
|
||||||
|
|||||||
@@ -17,111 +17,83 @@
|
|||||||
~ You should have received a copy of the GNU General Public License
|
~ You should have received a copy of the GNU General Public License
|
||||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/ripple"
|
android:background="@drawable/ripple">
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="16dp">
|
|
||||||
|
|
||||||
<common.widget.QkTextView
|
<common.widget.QkTextView
|
||||||
android:id="@+id/timestamp"
|
android:id="@+id/timestamp"
|
||||||
style="@style/TextSecondary"
|
style="@style/TextSecondary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Tue at 11:39pm" />
|
tools:text="Tue at 11:39pm" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/message"
|
android:id="@+id/attachments"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="start|bottom"
|
android:layout_marginEnd="12dp"
|
||||||
android:orientation="horizontal"
|
android:layout_marginStart="12dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/timestamp" />
|
||||||
|
|
||||||
|
<common.widget.AvatarView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/body"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<common.widget.TightTextView
|
||||||
|
android:id="@+id/body"
|
||||||
|
style="@style/TextPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:background="@drawable/message_only"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:minHeight="36dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
android:paddingEnd="12dp"
|
android:paddingEnd="12dp"
|
||||||
android:paddingStart="12dp">
|
android:paddingStart="12dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
<common.widget.AvatarView
|
app:layout_constrainedWidth="true"
|
||||||
android:id="@+id/avatar"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="36dp"
|
app:layout_constraintHorizontal_bias="0"
|
||||||
android:layout_height="36dp"
|
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||||
android:layout_marginEnd="12dp" />
|
app:layout_constraintTop_toBottomOf="@id/attachments"
|
||||||
|
tools:backgroundTint="@color/tools_theme"
|
||||||
<android.support.constraint.ConstraintLayout
|
tools:text="@tools:sample/lorem" />
|
||||||
android:id="@+id/messageBackground"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/message_only"
|
|
||||||
android:minHeight="36dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:backgroundTint="@color/tools_theme">
|
|
||||||
|
|
||||||
<common.widget.MmsPreviewView
|
|
||||||
android:id="@+id/mmsPreview"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/subject"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_chainStyle="packed"
|
|
||||||
app:layout_constraintWidth_min="192dp" />
|
|
||||||
|
|
||||||
<common.widget.TightTextView
|
|
||||||
android:id="@+id/subject"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/body"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/mmsPreview"
|
|
||||||
app:layout_goneMarginBottom="8dp"
|
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
<common.widget.TightTextView
|
|
||||||
android:id="@+id/body"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:autoLink="all"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/subject"
|
|
||||||
app:layout_goneMarginTop="8dp"
|
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<common.widget.QkTextView
|
<common.widget.QkTextView
|
||||||
android:id="@+id/status"
|
android:id="@+id/status"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_marginStart="72dp"
|
android:layout_marginStart="72dp"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/body"
|
||||||
app:textColor="secondary"
|
app:textColor="secondary"
|
||||||
app:textSize="tertiary"
|
app:textSize="tertiary"
|
||||||
tools:text="Sending..." />
|
tools:text="Sending..." />
|
||||||
|
|
||||||
</LinearLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
@@ -17,105 +17,77 @@
|
|||||||
~ You should have received a copy of the GNU General Public License
|
~ You should have received a copy of the GNU General Public License
|
||||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/ripple"
|
android:background="@drawable/ripple">
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="16dp">
|
|
||||||
|
|
||||||
<common.widget.QkTextView
|
<common.widget.QkTextView
|
||||||
android:id="@+id/timestamp"
|
android:id="@+id/timestamp"
|
||||||
style="@style/TextSecondary"
|
style="@style/TextSecondary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Tue at 11:39pm" />
|
tools:text="Tue at 11:39pm" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/message"
|
android:id="@+id/attachments"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end|bottom"
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginStart="60dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constrainedWidth="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/timestamp" />
|
||||||
|
|
||||||
|
<common.widget.TightTextView
|
||||||
|
android:id="@+id/body"
|
||||||
|
style="@style/TextPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginStart="60dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:background="@drawable/message_only"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:minHeight="36dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
android:paddingEnd="12dp"
|
android:paddingEnd="12dp"
|
||||||
android:paddingStart="60dp">
|
android:paddingStart="12dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
<android.support.constraint.ConstraintLayout
|
app:layout_constrainedWidth="true"
|
||||||
android:id="@+id/messageBackground"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintHorizontal_bias="1"
|
||||||
android:layout_height="wrap_content"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:background="@drawable/message_only"
|
app:layout_constraintTop_toBottomOf="@id/attachments"
|
||||||
android:gravity="start"
|
tools:backgroundTint="@color/white"
|
||||||
android:minHeight="36dp"
|
tools:text="Hey! How's it going?" />
|
||||||
android:orientation="vertical"
|
|
||||||
tools:backgroundTint="@color/white">
|
|
||||||
|
|
||||||
<common.widget.MmsPreviewView
|
|
||||||
android:id="@+id/mmsPreview"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/subject"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_chainStyle="packed"
|
|
||||||
app:layout_constraintWidth_min="192dp" />
|
|
||||||
|
|
||||||
<common.widget.TightTextView
|
|
||||||
android:id="@+id/subject"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/body"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/mmsPreview"
|
|
||||||
app:layout_goneMarginBottom="8dp"
|
|
||||||
tools:text="Subject" />
|
|
||||||
|
|
||||||
<common.widget.TightTextView
|
|
||||||
android:id="@+id/body"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:autoLink="all"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
app:layout_constrainedWidth="true"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/subject"
|
|
||||||
app:layout_goneMarginTop="8dp"
|
|
||||||
tools:text="Hey! How's it going?" />
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<common.widget.QkTextView
|
<common.widget.QkTextView
|
||||||
android:id="@+id/status"
|
android:id="@+id/status"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/body"
|
||||||
app:textColor="secondary"
|
app:textColor="secondary"
|
||||||
app:textSize="tertiary"
|
app:textSize="tertiary"
|
||||||
tools:text="Sending..." />
|
tools:text="Sending..." />
|
||||||
|
|
||||||
</LinearLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
@@ -19,13 +19,18 @@
|
|||||||
-->
|
-->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="2dp">
|
||||||
|
|
||||||
<ImageView
|
<common.widget.BubbleImageView
|
||||||
android:id="@+id/thumbnail"
|
android:id="@+id/thumbnail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:maxHeight="320dp"
|
||||||
|
android:maxWidth="280dp"
|
||||||
|
android:scaleType="fitStart"
|
||||||
tools:src="@tools:sample/backgrounds/scenic" />
|
tools:src="@tools:sample/backgrounds/scenic" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
Reference in New Issue
Block a user