fix toot sending twice when using a hardware keyboard (#1758)

main
Konrad Pozniak 5 years ago committed by Alibek Omarov
parent 8a23f3b84c
commit 3e8b8f1f88
  1. 3
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt

@ -1126,6 +1126,7 @@ class ComposeActivity : BaseActivity(),
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
Log.d(TAG, event.toString()) Log.d(TAG, event.toString())
if(event.action == KeyEvent.ACTION_DOWN) {
if (event.isCtrlPressed) { if (event.isCtrlPressed) {
if (keyCode == KeyEvent.KEYCODE_ENTER) { if (keyCode == KeyEvent.KEYCODE_ENTER) {
// send toot by pressing CTRL + ENTER // send toot by pressing CTRL + ENTER
@ -1138,7 +1139,7 @@ class ComposeActivity : BaseActivity(),
onBackPressed() onBackPressed()
return true return true
} }
}
return super.onKeyDown(keyCode, event) return super.onKeyDown(keyCode, event)
} }

Loading…
Cancel
Save