Skip to content

Commit

Permalink
fix to be able to enter open conversation name
Browse files Browse the repository at this point in the history
without this change the continue button was broken (no room token -> response 404 for getRoom. But for creating an open conversation getRoom should not be executed at all) and the emoji button was missing

Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed Jul 7, 2023
1 parent 25908eb commit e3fd71d
Showing 1 changed file with 37 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ class EntryMenuController(args: Bundle) :
binding?.okButton?.alpha = OPACITY_BUTTON_DISABLED
}
}

emojiPopup = binding?.let {
EmojiPopup(
rootView = view,
editText = it.textEdit,
onEmojiPopupShownListener = {
viewThemeUtils.platform.colorImageView(it.smileyButton, ColorRole.PRIMARY)
},
onEmojiPopupDismissListener = {
it.smileyButton.imageTintList = ColorStateList.valueOf(
ResourcesCompat.getColor(
resources!!,
R.color.medium_emphasis_text,
context.theme
)
)
},
onEmojiClickListener = {
binding?.textEdit?.editableText?.append(" ")
}
)
}
}

override fun onViewBound(view: View) {
Expand All @@ -113,16 +135,28 @@ class EntryMenuController(args: Bundle) :
currentUser = userManager.currentUser.blockingGet()

if (operation == ConversationOperationEnum.OPS_CODE_GET_AND_JOIN_ROOM) {
var labelText = ""
labelText = resources!!.getString(R.string.nc_conversation_link)
binding?.textEdit?.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI

textEditAddChangedListener()

binding?.textInputLayout?.let { viewThemeUtils.material.colorTextInputLayout(it) }
binding?.okButton?.let { viewThemeUtils.material.colorMaterialButtonText(it) }

binding?.textInputLayout?.hint = labelText
binding?.textInputLayout?.hint = resources!!.getString(R.string.nc_conversation_link)

binding?.textInputLayout?.requestFocus()

binding?.smileyButton?.setOnClickListener { onSmileyClick() }
binding?.okButton?.setOnClickListener { onOkButtonClick() }
} else if (operation == ConversationOperationEnum.OPS_CODE_INVITE_USERS) {
binding?.textEdit?.inputType = InputType.TYPE_CLASS_TEXT

textEditAddChangedListener()
binding?.smileyButton?.visibility = View.VISIBLE

binding?.textInputLayout?.let { viewThemeUtils.material.colorTextInputLayout(it) }
binding?.okButton?.let { viewThemeUtils.material.colorMaterialButtonText(it) }

binding?.textInputLayout?.requestFocus()

binding?.smileyButton?.setOnClickListener { onSmileyClick() }
Expand Down Expand Up @@ -162,32 +196,10 @@ class EntryMenuController(args: Bundle) :

var labelText = ""
when (operation) {
ConversationOperationEnum.OPS_CODE_INVITE_USERS,
ConversationOperationEnum.OPS_CODE_RENAME_ROOM -> {
labelText = resources!!.getString(R.string.nc_call_name)
binding?.textEdit?.inputType = InputType.TYPE_CLASS_TEXT
binding?.smileyButton?.visibility = View.VISIBLE
emojiPopup = binding?.let {
EmojiPopup(
rootView = view,
editText = it.textEdit,
onEmojiPopupShownListener = {
viewThemeUtils.platform.colorImageView(it.smileyButton, ColorRole.PRIMARY)
},
onEmojiPopupDismissListener = {
it.smileyButton.imageTintList = ColorStateList.valueOf(
ResourcesCompat.getColor(
resources!!,
R.color.medium_emphasis_text,
context.theme
)
)
},
onEmojiClickListener = {
binding?.textEdit?.editableText?.append(" ")
}
)
}
}

ConversationOperationEnum.OPS_CODE_JOIN_ROOM -> {
Expand Down

0 comments on commit e3fd71d

Please sign in to comment.