mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +01:00
Added date to editor details and changes related to design.
Signed-off-by: Sowjanya Kota<sowjanya.kch@gmail.com>
This commit is contained in:
parent
8d4c0fb57c
commit
861b565c01
@ -114,10 +114,10 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
binding.messageText.text = processedMessageText
|
binding.messageText.text = processedMessageText
|
||||||
|
|
||||||
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
||||||
binding.messageType.visibility = View.VISIBLE
|
binding.messageEditIndicator.visibility = View.VISIBLE
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp)
|
||||||
} else {
|
} else {
|
||||||
binding.messageType.visibility = View.GONE
|
binding.messageEditIndicator.visibility = View.GONE
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,10 +105,10 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
binding.messageText.text = processedMessageText
|
binding.messageText.text = processedMessageText
|
||||||
|
|
||||||
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
|
||||||
binding.messageType.visibility = View.VISIBLE
|
binding.messageEditIndicator.visibility = View.VISIBLE
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp)
|
||||||
} else {
|
} else {
|
||||||
binding.messageType.visibility = View.GONE
|
binding.messageEditIndicator.visibility = View.GONE
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,8 +531,6 @@ class ChatActivity :
|
|||||||
context.getSharedPreferences(localClassName, MODE_PRIVATE).apply {
|
context.getSharedPreferences(localClassName, MODE_PRIVATE).apply {
|
||||||
val text = getString(roomToken, "")
|
val text = getString(roomToken, "")
|
||||||
val cursor = getInt(roomToken + CURSOR_KEY, 0)
|
val cursor = getInt(roomToken + CURSOR_KEY, 0)
|
||||||
// val editFlag = getBoolean(EDIT_FLAG, false)
|
|
||||||
// editableBehaviorSubject.onNext(editFlag)
|
|
||||||
binding.messageInputView.messageInput.setText(text)
|
binding.messageInputView.messageInput.setText(text)
|
||||||
binding.messageInputView.messageInput.setSelection(cursor)
|
binding.messageInputView.messageInput.setSelection(cursor)
|
||||||
}
|
}
|
||||||
@ -559,7 +557,6 @@ class ChatActivity :
|
|||||||
context.getSharedPreferences(localClassName, MODE_PRIVATE).edit().apply {
|
context.getSharedPreferences(localClassName, MODE_PRIVATE).edit().apply {
|
||||||
putString(roomToken, text)
|
putString(roomToken, text)
|
||||||
putInt(roomToken + CURSOR_KEY, cursor)
|
putInt(roomToken + CURSOR_KEY, cursor)
|
||||||
// putBoolean(EDIT_FLAG, editableBehaviorSubject.value!!)
|
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,13 +760,13 @@ class ChatActivity :
|
|||||||
val filters = arrayOfNulls<InputFilter>(1)
|
val filters = arrayOfNulls<InputFilter>(1)
|
||||||
val lengthFilter = CapabilitiesUtilNew.getMessageMaxLength(conversationUser)
|
val lengthFilter = CapabilitiesUtilNew.getMessageMaxLength(conversationUser)
|
||||||
|
|
||||||
|
binding.editView.editMessageView.visibility = View.GONE
|
||||||
|
|
||||||
if (editableBehaviorSubject.value!!) {
|
if (editableBehaviorSubject.value!!) {
|
||||||
val editableText = Editable.Factory.getInstance().newEditable(editMessage.message)
|
val editableText = Editable.Factory.getInstance().newEditable(editMessage.message)
|
||||||
binding.messageInputView.inputEditText.text = editableText
|
binding.messageInputView.inputEditText.text = editableText
|
||||||
binding.messageInputView.inputEditText.setSelection(editableText.length)
|
binding.messageInputView.inputEditText.setSelection(editableText.length)
|
||||||
binding.editView.editMessage.setText(editMessage.message)
|
binding.editView.editMessage.setText(editMessage.message)
|
||||||
} else {
|
|
||||||
binding.editView.editMessageView.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filters[0] = InputFilter.LengthFilter(lengthFilter)
|
filters[0] = InputFilter.LengthFilter(lengthFilter)
|
||||||
@ -918,14 +915,12 @@ class ChatActivity :
|
|||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message.message = messageEdited.ocs?.data?.parentMessage?.text
|
|
||||||
message.lastEditTimestamp = messageEdited.ocs?.data?.lastEditTimestamp!!
|
|
||||||
adapter?.update(message)
|
|
||||||
adapter?.notifyDataSetChanged()
|
|
||||||
clearEditUI()
|
clearEditUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
|
Log.e(TAG, "failed to edit message", e)
|
||||||
|
Snackbar.make(binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
@ -990,6 +985,9 @@ class ChatActivity :
|
|||||||
binding.messageInputView.findViewById<ImageView>(R.id.editMessageButton)?.let {
|
binding.messageInputView.findViewById<ImageView>(R.id.editMessageButton)?.let {
|
||||||
viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY)
|
viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY)
|
||||||
}
|
}
|
||||||
|
binding.editView.clearEdit.let {
|
||||||
|
viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupActionBar() {
|
private fun setupActionBar() {
|
||||||
@ -4837,6 +4835,5 @@ class ChatActivity :
|
|||||||
private const val MILISEC_15: Long = 15
|
private const val MILISEC_15: Long = 15
|
||||||
private const val LINEBREAK = "\n"
|
private const val LINEBREAK = "\n"
|
||||||
private const val CURSOR_KEY = "_cursor"
|
private const val CURSOR_KEY = "_cursor"
|
||||||
private const val EDIT_FLAG = "_editFlag"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ import com.nextcloud.talk.repositories.reactions.ReactionsRepository
|
|||||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
import com.nextcloud.talk.utils.ConversationUtils
|
import com.nextcloud.talk.utils.ConversationUtils
|
||||||
|
import com.nextcloud.talk.utils.DateConstants
|
||||||
import com.nextcloud.talk.utils.DateUtils
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
||||||
import com.vanniktech.emoji.EmojiPopup
|
import com.vanniktech.emoji.EmojiPopup
|
||||||
@ -93,12 +94,9 @@ class MessageActionsDialog(
|
|||||||
private val messageHasRegularText = ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message
|
private val messageHasRegularText = ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message
|
||||||
.getCalculateMessageType() && !message.isDeleted
|
.getCalculateMessageType() && !message.isDeleted
|
||||||
|
|
||||||
private val isOlderThanTwentyFourHours = message.createdAt.before(
|
private val isOlderThanTwentyFourHours = message
|
||||||
Date(
|
.createdAt
|
||||||
System.currentTimeMillis() -
|
.before(Date(System.currentTimeMillis() - AGE_THRESHOLD_FOR_EDIT_MESSAGE))
|
||||||
AGE_THRESHOLD_FOR_EDIT_MESSAGE
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val isUserAllowedToEdit = chatActivity.userAllowedByPrivilages(message)
|
private val isUserAllowedToEdit = chatActivity.userAllowedByPrivilages(message)
|
||||||
|
|
||||||
@ -375,7 +373,11 @@ class MessageActionsDialog(
|
|||||||
|
|
||||||
private fun initMenuEditorDetails(showEditorDetails: Boolean) {
|
private fun initMenuEditorDetails(showEditorDetails: Boolean) {
|
||||||
if (showEditorDetails) {
|
if (showEditorDetails) {
|
||||||
val editedTime = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp)
|
val editedTime = dateUtils.getLocalDateTimeStringFromTimestamp(
|
||||||
|
message.lastEditTimestamp *
|
||||||
|
DateConstants.SECOND_DIVIDER
|
||||||
|
)
|
||||||
|
|
||||||
val editorName = context.getString(R.string.nc_edited_by) + message.lastEditActorDisplayName
|
val editorName = context.getString(R.string.nc_edited_by) + message.lastEditActorDisplayName
|
||||||
dialogMessageActionsBinding.editorName.setText(editorName)
|
dialogMessageActionsBinding.editorName.setText(editorName)
|
||||||
dialogMessageActionsBinding.editedTime.setText(editedTime)
|
dialogMessageActionsBinding.editedTime.setText(editedTime)
|
||||||
|
@ -263,7 +263,9 @@
|
|||||||
android:id="@+id/editView"
|
android:id="@+id/editView"
|
||||||
layout="@layout/edit_message_view"
|
layout="@layout/edit_message_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"></include>
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="6dp" >
|
||||||
|
</include>
|
||||||
|
|
||||||
<com.nextcloud.talk.ui.MessageInput
|
<com.nextcloud.talk.ui.MessageInput
|
||||||
android:id="@+id/messageInputView"
|
android:id="@+id/messageInputView"
|
||||||
|
@ -141,26 +141,26 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start|center_vertical"
|
android:layout_gravity="start|center_vertical"
|
||||||
android:paddingStart="@dimen/standard_double_padding"
|
android:paddingStart="16dp"
|
||||||
android:paddingEnd="@dimen/standard_padding"
|
android:paddingEnd="@dimen/standard_padding"
|
||||||
tools:text="@string/nc_edited_by_admin"
|
tools:text="@string/nc_edited_by_admin"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textColor="@color/high_emphasis_text"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
android:textSize="15sp"
|
||||||
|
android:textColor = "@color/grey_600"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/edited_time"
|
android:id="@+id/edited_time"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start|center_vertical"
|
android:layout_gravity="start|center_vertical"
|
||||||
android:paddingStart="@dimen/standard_double_padding"
|
android:paddingStart="16dp"
|
||||||
android:paddingEnd="@dimen/standard_padding"
|
android:paddingEnd="@dimen/standard_padding"
|
||||||
tools:text="12:30 AM"
|
tools:text="12:30 AM"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textColor="@color/high_emphasis_text"
|
android:textSize="15sp"
|
||||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
android:textColor ="@color/grey_600"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id = "@+id/edit_message_view"
|
android:id = "@+id/editMessageView"
|
||||||
android:orientation = "horizontal">
|
android:orientation = "horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -52,8 +52,7 @@
|
|||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:padding = "12dp"
|
android:padding = "12dp"
|
||||||
android:src = "@drawable/ic_clear_24"
|
android:src = "@drawable/ic_clear_24"
|
||||||
android:gravity = "top|end"
|
android:gravity = "top|end">
|
||||||
app:tint="@color/colorPrimaryDark">
|
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
|
||||||
|
@ -95,11 +95,14 @@
|
|||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/messageType"
|
android:id="@+id/messageEditIndicator"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/messageText"
|
android:layout_below="@id/messageText"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textColor="@color/no_emphasis_text"
|
||||||
|
android:textIsSelectable="false"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="center"
|
||||||
android:text = "@string/hint_edited_message"
|
android:text = "@string/hint_edited_message"
|
||||||
android:textSize="12sp">
|
android:textSize="12sp">
|
||||||
|
@ -73,6 +73,20 @@
|
|||||||
app:layout_wrapBefore="false"
|
app:layout_wrapBefore="false"
|
||||||
tools:text="10:35" />
|
tools:text="10:35" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/messageEditIndicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/messageText"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textColor="@color/no_emphasis_text"
|
||||||
|
android:textIsSelectable="false"
|
||||||
|
app:layout_alignSelf="center"
|
||||||
|
android:text = "@string/hint_edited_message"
|
||||||
|
android:textSize="12sp">
|
||||||
|
|
||||||
|
</TextView>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/checkMark"
|
android:id="@+id/checkMark"
|
||||||
@ -84,20 +98,6 @@
|
|||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="center"
|
||||||
app:tint="@color/high_emphasis_text" />
|
app:tint="@color/high_emphasis_text" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/messageType"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/messageText"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
app:layout_alignSelf="center"
|
|
||||||
android:text = "@string/hint_edited_message"
|
|
||||||
android:textSize="12sp">
|
|
||||||
|
|
||||||
</TextView>
|
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/reactions"
|
android:id="@+id/reactions"
|
||||||
layout="@layout/reactions_inside_message" />
|
layout="@layout/reactions_inside_message" />
|
||||||
|
Loading…
Reference in New Issue
Block a user