Skip to content

Instantly share code, notes, and snippets.

@fevziomurtekin
Created January 25, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fevziomurtekin/7a1aea6c45e4db5f6229a76b0fdde11a to your computer and use it in GitHub Desktop.
Save fevziomurtekin/7a1aea6c45e4db5f6229a76b0fdde11a to your computer and use it in GitHub Desktop.
private fun appendText(message: String, type: Int) {
val layout: FrameLayout
when (type) {
USER -> layout = appendUserText()
BOT -> layout = appendBotText()
else -> layout = appendBotText()
}
layout.isFocusableInTouchMode = true
linear_chat.addView(layout)
val tv = layout.findViewById<TextView>(R.id.chatMsg)
tv.setText(message)
Util.hideKeyboard(this)
layout.requestFocus()
edittext.requestFocus() // change focus back to edit text to continue typing
if(type!= USER) asistan_voice?.speak(message,TextToSpeech.QUEUE_FLUSH,null)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment