Change wording adding "..." because there is now confirmation dialog

And make the item red because it is destructive. Also use "redact" terminology
This commit is contained in:
Benoit Marty 2020-02-11 11:04:21 +01:00
parent b40da4ef0f
commit 6fce2a3066
5 changed files with 14 additions and 12 deletions

View file

@ -788,7 +788,7 @@ class RoomDetailFragment @Inject constructor(
.show()
}
private fun promptReasonToDeleteEvent(eventId: String) {
private fun promptReasonToRedactEvent(eventId: String) {
val layout = requireActivity().layoutInflater.inflate(R.layout.dialog_delete_event, null)
val reasonCheckBox = layout.findViewById<MaterialCheckBox>(R.id.deleteEventReasonCheck)
val reasonTextInputLayout = layout.findViewById<TextInputLayout>(R.id.deleteEventReasonTextInputLayout)
@ -797,8 +797,8 @@ class RoomDetailFragment @Inject constructor(
reasonCheckBox.setOnCheckedChangeListener { _, isChecked -> reasonTextInputLayout.isEnabled = isChecked }
AlertDialog.Builder(requireActivity())
.setView(layout)
.setTitle(R.string.delete_event_dialog_title)
.setView(layout)
.setPositiveButton(R.string.remove) { _, _ ->
val reason = reasonInput.text.toString()
.takeIf { reasonCheckBox.isChecked }
@ -1120,8 +1120,8 @@ class RoomDetailFragment @Inject constructor(
copyToClipboard(requireContext(), action.content, false)
showSnackWithMessage(getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT)
}
is EventSharedAction.Delete -> {
promptReasonToDeleteEvent(action.eventId)
is EventSharedAction.Redact -> {
promptReasonToRedactEvent(action.eventId)
}
is EventSharedAction.Share -> {
// TODO current data communication is too limited

View file

@ -22,7 +22,9 @@ import im.vector.riotx.R
import im.vector.riotx.core.platform.VectorSharedAction
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
sealed class EventSharedAction(@StringRes val titleRes: Int, @DrawableRes val iconResId: Int) : VectorSharedAction {
sealed class EventSharedAction(@StringRes val titleRes: Int,
@DrawableRes val iconResId: Int,
val destructive: Boolean = false) : VectorSharedAction {
object Separator :
EventSharedAction(0, 0)
@ -51,10 +53,10 @@ sealed class EventSharedAction(@StringRes val titleRes: Int, @DrawableRes val ic
EventSharedAction(R.string.global_retry, R.drawable.ic_refresh_cw)
data class Remove(val eventId: String) :
EventSharedAction(R.string.remove, R.drawable.ic_trash)
EventSharedAction(R.string.remove, R.drawable.ic_trash, true)
data class Delete(val eventId: String) :
EventSharedAction(R.string.delete, R.drawable.ic_delete)
data class Redact(val eventId: String) :
EventSharedAction(R.string.message_action_item_redact, R.drawable.ic_delete, true)
data class Cancel(val eventId: String) :
EventSharedAction(R.string.cancel, R.drawable.ic_close_round)
@ -81,7 +83,7 @@ sealed class EventSharedAction(@StringRes val titleRes: Int, @DrawableRes val ic
EventSharedAction(R.string.report_content_custom, R.drawable.ic_report_custom)
data class IgnoreUser(val senderId: String?) :
EventSharedAction(R.string.message_ignore_user, R.drawable.ic_alert_triangle)
EventSharedAction(R.string.message_ignore_user, R.drawable.ic_alert_triangle, true)
data class QuickReact(val eventId: String, val clickedOn: String, val add: Boolean) :
EventSharedAction(0, 0)

View file

@ -111,7 +111,7 @@ class MessageActionsEpoxyController @Inject constructor(
showExpand(action is EventSharedAction.ReportContent)
expanded(state.expendedReportContentMenu)
listener(View.OnClickListener { listener?.didSelectMenuAction(action) })
destructive(action is EventSharedAction.IgnoreUser)
destructive(action.destructive)
}
if (action is EventSharedAction.ReportContent && state.expendedReportContentMenu) {

View file

@ -227,7 +227,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
}
if (canRedact(timelineEvent, session.myUserId)) {
add(EventSharedAction.Delete(eventId))
add(EventSharedAction.Redact(eventId))
}
if (canCopy(msgType)) {

View file

@ -11,7 +11,7 @@
<!-- BEGIN Strings added by Benoit -->
<string name="message_action_item_redact">Remove…</string>
<!-- END Strings added by Benoit -->