Skip to content

Commit 3440212

Browse files
committed
test
1 parent e5e830a commit 3440212

33 files changed

+416
-284
lines changed

app/src/main/java/com/xabber/presentation/application/fragments/chat/ChatFragment.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ class ChatFragment : DetailBaseFragment(R.layout.fragment_chat), MessageAdapter.
693693
viewModel.messages.observe(viewLifecycleOwner) {
694694
Log.d("iii", "observe")
695695
messageAdapter?.submitList(it) {
696-
messageAdapter?.notifyDataSetChanged()
696+
// messageAdapter?.notifyDataSetChanged()
697697
if (layoutManager != null && messageAdapter != null) {
698698
if (layoutManager!!.findLastVisibleItemPosition() >= messageAdapter!!.itemCount - 2 && !isSelectedMode) scrollDown()
699699
if (isNeedScrollDown) {
@@ -704,7 +704,7 @@ class ChatFragment : DetailBaseFragment(R.layout.fragment_chat), MessageAdapter.
704704
}
705705

706706
messageAdapter?.updateAdapter(it)
707-
messageAdapter?.notifyDataSetChanged()
707+
// messageAdapter?.notifyDataSetChanged()
708708
if (layoutManager != null && messageAdapter != null) {
709709
if (layoutManager!!.findLastVisibleItemPosition() >= messageAdapter!!.itemCount - 2 && !isSelectedMode) scrollDown()
710710
if (isNeedScrollDown) {
@@ -1032,8 +1032,8 @@ class ChatFragment : DetailBaseFragment(R.layout.fragment_chat), MessageAdapter.
10321032

10331033

10341034
private fun updateTopDateIfNeed() {
1035-
val layoutManager = binding.messageList.layoutManager as LinearLayoutManager
1036-
val position = layoutManager.findFirstVisibleItemPosition()
1035+
// val layoutManager = binding.messageList.layoutManager as LinearLayoutManager
1036+
// val position = layoutManager.findFirstVisibleItemPosition()
10371037
// val message : MessageDto = messageAdapter!!.getItem(position)
10381038
// if (message != null)
10391039
// binding.tvTopDate.setText(StringUtils.getDateStringForMessage(message.t)

app/src/main/java/com/xabber/presentation/application/fragments/chat/MessageChanger.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.xabber.presentation.application.fragments.chat
22

33
import com.xabber.R
4+
import com.xabber.utils.dp
45

56
object MessageChanger {
7+
var w = 90
8+
var h = 28
69

710
var cornerValue = 7
811
var typeValue = 7
@@ -48,7 +51,7 @@ object MessageChanger {
4851
6 -> R.drawable.bubble_bottom_6px
4952
7 -> R.drawable.bubble_bottom_7px
5053
8 -> R.drawable.bubble_bottom_8px
51-
9 -> R.drawable.bubble_bottom_9px
54+
9 -> R.drawable.bubble_bottom_9pxtest
5255
10 -> R.drawable.bubble_bottom_10px
5356
11 -> R.drawable.bubble_bottom_11px
5457
12 -> R.drawable.bubble_bottom_12px

app/src/main/java/com/xabber/presentation/application/fragments/chat/message/OutgoingMessageVH.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ class OutgoingMessageVH(
9191
ViewGroup.LayoutParams.WRAP_CONTENT
9292
)
9393

94-
params.setMargins(24.dp, 0, if (isNeedTail) 2.dp else 10.dp, 0)
94+
// params.setMargins(24.dp, 0, if (isNeedTail) 2.dp else 10.dp, 0)
9595

9696
params.gravity = Gravity.END
9797
binding.balloon.layoutParams = params
98-
if (messageDto.references == null && messageDto.messageBody!!.isNotEmpty()) {
99-
binding.balloon.setPadding(16.dp, 8.dp, if (isNeedTail) 16.dp else 8.dp, 10.dp)
100-
} else if (messageDto.references != null && messageDto.messageBody!!.isNotEmpty()) {
101-
binding.balloon.setPadding(4.dp, 4.dp, if (isNeedTail) 12.dp else 8.dp, 10.dp)
102-
} else {
103-
binding.balloon.setPadding(4.dp, 4.dp, 4.dp, -17.dp)
104-
}
98+
// if (messageDto.references == null && messageDto.messageBody!!.isNotEmpty()) {
99+
// binding.balloon.setPadding(16.dp, 8.dp, if (isNeedTail) 16.dp else 8.dp, 10.dp)
100+
// } else if (messageDto.references != null && messageDto.messageBody!!.isNotEmpty()) {
101+
// binding.balloon.setPadding(4.dp, 4.dp, if (isNeedTail) 12.dp else 8.dp, 10.dp)
102+
// } else {
103+
// binding.balloon.setPadding(4.dp, 4.dp, 4.dp, -17.dp)
104+
// }
105105

106106

107107
val typedValue = TypedValue()

app/src/main/java/com/xabber/presentation/application/fragments/chat/message/XMessageVH.kt

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ open class XMessageVH(
4949
// private val subscriptions = CompositeSubscription()
5050

5151
protected val messageTime: TextView = itemView.findViewById(R.id.message_time)
52-
protected val messageHeader: TextView = itemView.findViewById(R.id.message_sender_tv)
52+
// protected val messageHeader: TextView = itemView.findViewById(R.id.message_sender_tv)
5353
protected val messageBalloon: View = itemView.findViewById(R.id.message_balloon)
5454
// protected val messageShadow: View = itemView.findViewById(R.id.message_shadow)
5555
protected val statusIcon: ImageView = itemView.findViewById(R.id.message_status_icon)
5656
protected val messageInfo: View = itemView.findViewById(R.id.message_info)
57-
private val flexboxLayout: CustomFlexboxLayout = itemView.findViewById(R.id.message_flex_layout)
58-
protected val forwardedMessagesRV: RecyclerView = itemView.findViewById(R.id.forwardedRecyclerView)
59-
protected val messageFileInfo: TextView = itemView.findViewById(R.id.message_file_info)
60-
protected val progressBar: ProgressBar = itemView.findViewById(R.id.message_progress_bar)
61-
protected val rvFileList: RecyclerView = itemView.findViewById(R.id.file_list_rv)
62-
protected val imageGridContainer: FrameLayout = itemView.findViewById(R.id.image_grid_container_fl)
57+
val flexboxLayout: CustomFlexboxLayout = itemView.findViewById(R.id.message_flex_layout)
58+
// protected val forwardedMessagesRV: RecyclerView = itemView.findViewById(R.id.forwardedRecyclerView)
59+
// protected val messageFileInfo: TextView = itemView.findViewById(R.id.message_file_info)
60+
// protected val progressBar: ProgressBar = itemView.findViewById(R.id.message_progress_bar)
61+
// protected val rvFileList: RecyclerView = itemView.findViewById(R.id.file_list_rv)
62+
// protected val imageGridContainer: FrameLayout = itemView.findViewById(R.id.image_grid_container_fl)
6363

6464
//todo there are duplicated views! (or else triplicated!)
65-
private val messageStatusLayout: LinearLayoutCompat = itemView.findViewById(R.id.message_bottom_status)
66-
protected val bottomMessageTime: TextView = messageStatusLayout.findViewById(R.id.message_time)
67-
protected var bottomStatusIcon: ImageView = messageStatusLayout.findViewById(R.id.message_status_icon)
65+
// private val messageStatusLayout: LinearLayoutCompat = itemView.findViewById(R.id.message_bottom_status)
66+
// protected val bottomMessageTime: TextView = messageStatusLayout.findViewById(R.id.message_time)
67+
// protected var bottomStatusIcon: ImageView = messageStatusLayout.findViewById(R.id.message_status_icon)
6868

69-
private val uploadProgressBar: ProgressBar? = itemView.findViewById(R.id.uploadProgressBar)
69+
// private val uploadProgressBar: ProgressBar? = itemView.findViewById(R.id.uploadProgressBar)
7070
// private val ivCancelUpload: ImageButton? = itemView.findViewById(R.id.ivCancelUpload)
7171

7272
private var imageCount = 0
@@ -173,17 +173,17 @@ open class XMessageVH(
173173
//
174174

175175
if (messageTextTv.text.isNotEmpty()) {
176-
messageStatusLayout.visibility = View.GONE
176+
// messageStatusLayout.visibility = View.GONE
177177
}
178178

179179
// if (messageRealmObject.hasReferences() || messageRealmObject.hasForwardedMessages()) {
180180
// flexboxLayout.layoutParams = LinearLayout.LayoutParams(
181181
// ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT
182182
// )
183183
// } else {
184-
flexboxLayout.layoutParams = LinearLayout.LayoutParams(
185-
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT
186-
)
184+
// flexboxLayout.layoutParams = LinearLayout.LayoutParams(
185+
// ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT
186+
// )
187187
// }
188188

189189
messageTextTv.movementMethod = CorrectlyTouchEventTextView.LocalLinkMovementMethod
@@ -195,7 +195,7 @@ open class XMessageVH(
195195
needDate = vhExtraData.isNeedDate
196196
date = getDateStringForMessage(messageDto.sentTimestamp)
197197
if (!vhExtraData.isNeedName) {
198-
messageHeader.visibility = View.GONE
198+
// messageHeader.visibility = View.GONE
199199
}
200200

201201
// if (messageRealmObject.text.isNullOrEmpty()
@@ -235,14 +235,12 @@ open class XMessageVH(
235235
// getTimeText(Date(it))
236236
// )
237237
// }
238-
messageTime.text = time
239-
bottomMessageTime.text = time
240238
}
241239

242240
private fun setupReferences(messageDto: MessageDto, vhExtraData: MessageVhExtraData) {
243-
rvFileList.visibility = View.GONE
244-
imageGridContainer.removeAllViews()
245-
imageGridContainer.visibility = View.GONE
241+
// rvFileList.visibility = View.GONE
242+
// imageGridContainer.removeAllViews()
243+
// imageGridContainer.visibility = View.GONE
246244
// if (messageRealmObject.hasReferences()) {
247245
// setUpImage(messageRealmObject, vhExtraData)
248246
// setUpFile(messageRealmObject.referencesRealmObjects, vhExtraData)
@@ -451,9 +449,9 @@ open class XMessageVH(
451449
}
452450

453451
private fun showProgress(show: Boolean) {
454-
messageFileInfo.visibility = if (show) View.VISIBLE else View.GONE
452+
// messageFileInfo.visibility = if (show) View.VISIBLE else View.GONE
455453
messageTime.visibility = if (show) View.GONE else View.VISIBLE
456-
bottomMessageTime.visibility = if (show) View.GONE else View.VISIBLE
454+
// bottomMessageTime.visibility = if (show) View.GONE else View.VISIBLE
457455
}
458456

459457
private fun showFileProgressModified(view: RecyclerView, startAt: Int, endAt: Int) {

app/src/main/java/com/xabber/presentation/application/fragments/discover/DiscoverFragment.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class DiscoverFragment : BaseFragment(R.layout.fragment_discover) {
3030
val drawable = BitmapDrawable(resources, bitmap).apply { setColorFilter(filter) }
3131
// binding.tvDiscover.setColorFilter(Color., PorterDuff.Mode.MULTIPLY)
3232
// val list = ColorStateList
33-
Glide.with(binding.tvDiscover).load("content://media/external/images/media/411797").into(binding.tvDiscover)
3433
}
3534

3635
}

app/src/main/java/com/xabber/presentation/application/fragments/test/MessageAdapter.kt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.xabber.presentation.application.fragments.chat.MessageChanger
1919
import com.xabber.presentation.application.fragments.chat.ReferenceRealmObject
2020
import com.xabber.presentation.application.fragments.chat.message.XBasicMessageVH
2121
import com.xabber.presentation.application.fragments.chat.message.XMessageVH
22+
import com.xabber.presentation.application.fragments.test.MessageAdapter.Companion.VIEW_TYPE_INCOMING_MESSAGE
2223
import com.xabber.presentation.application.util.isSameDayWith
2324

2425
class MessageAdapter(
@@ -116,7 +117,9 @@ class MessageAdapter(
116117
}
117118

118119
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): XBasicMessageVH {
120+
Log.d("uuu", "onCreate")
119121
return when (viewType) {
122+
120123
// VIEW_TYPE_SYSTEM_MESSAGE -> SystemMessageVH(
121124
// LayoutInflater.from(parent.context).inflate(
122125
// R.layout.item_system_message, parent, false
@@ -141,7 +144,7 @@ class MessageAdapter(
141144
VIEW_TYPE_OUTGOING_MESSAGE -> XOutgoingMessageVH(
142145
listener,
143146
LayoutInflater.from(parent.context).inflate(
144-
R.layout.item_message_outgoing_dev, parent, false
147+
R.layout.item_message_outgoing_test, parent, false
145148
),
146149
this, this, this, R.style.ThemeApplication
147150
)
@@ -230,13 +233,13 @@ class MessageAdapter(
230233
val isNeedDate = isMessageNeedDate(position)
231234

232235
val outgoingRegularTypedValue = TypedValue()
233-
context.theme.resolveAttribute(R.attr.message_background, outgoingRegularTypedValue, true)
234-
val outgoingForwardedTypedValue = TypedValue()
235-
context.theme.resolveAttribute(
236-
R.attr.forwarded_outgoing_message_background,
237-
outgoingForwardedTypedValue,
238-
true
239-
)
236+
// context.theme.resolveAttribute(R.attr.message_background, outgoingRegularTypedValue, true)
237+
// val outgoingForwardedTypedValue = TypedValue()
238+
// context.theme.resolveAttribute(
239+
// R.attr.forwarded_outgoing_message_background,
240+
// outgoingForwardedTypedValue,
241+
// true
242+
// )
240243

241244
// val isAuthorMe = groupMember?.isMe ?: !message.isIncoming
242245
val states = arrayOf(

app/src/main/java/com/xabber/presentation/application/fragments/test/XIncomingMessageVH.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.appcompat.widget.PopupMenu
1515
import androidx.constraintlayout.widget.ConstraintLayout
1616
import androidx.core.content.ContextCompat
1717
import androidx.core.view.isVisible
18+
import by.kirich1409.viewbindingdelegate.viewBinding
1819
import com.xabber.R
1920
import com.xabber.dto.MessageDto
2021
import com.xabber.models.dto.MessageVhExtraData
@@ -53,7 +54,7 @@ class XIncomingMessageVH internal constructor(
5354
R.color.transparent
5455
)
5556
statusIcon.isVisible = false
56-
bottomStatusIcon.isVisible = false
57+
// bottomStatusIcon.isVisible = false
5758
// val avatar = itemView.findViewById<ImageView>(R.id.avatar)
5859
// avatar.isVisible = false
5960
// text & appearance
@@ -84,15 +85,15 @@ class XIncomingMessageVH internal constructor(
8485
// messageShadow.background = shadowDrawable
8586

8687
// setup BALLOON margins
87-
val im = itemView.findViewById<ImageView>(R.id.im)
88+
// val im = itemView.findViewById<ImageView>(R.id.im)
8889

8990
val shadowDrawable = ContextCompat.getDrawable(
9091
context,
9192
if (needTail) MessageChanger.tail else MessageChanger.simple
9293
)
93-
im.background = shadowDrawable
94+
// im.background = shadowDrawable
9495
// im.scaleX = -1f
95-
im.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(im.context, R.color.blue_100))
96+
// im.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(im.context, R.color.blue_100))
9697

9798
// val layoutParams = messageBalloon.layoutParams as ConstraintLayout.LayoutParams
9899
// layoutParams.setMargins(
@@ -102,7 +103,15 @@ class XIncomingMessageVH internal constructor(
102103
// 2.dp
103104
//
104105
// )
105-
// messageBalloon.layoutParams = layoutParams
106+
shadowDrawable?.setColorFilter(
107+
itemView.resources.getColor(
108+
R.color.blue_100,
109+
itemView.context.theme
110+
), PorterDuff.Mode.MULTIPLY
111+
)
112+
113+
messageBalloon.background = shadowDrawable
114+
// im.scaleX = -1f
106115

107116

108117
// setup MESSAGE padding

0 commit comments

Comments
 (0)