Минимальный рабочий пример:
Код: Выделить всё
class MainActivity : ComponentActivity() {
@SuppressLint("RestrictedApi")
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
Log.d(TAG, "$event")
return super.dispatchKeyEvent(event)
}
}
Код: Выделить всё
App: ACTION_DOWN
App: ACTION_UP
Код: Выделить всё
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Text("Hello, world!")
}
}
/* rest is the same */
}
Код: Выделить всё
Compose Focus: Owner FocusChanged(true)
App: ACTION_UP
Код: Выделить всё
Compose Focus: Owner FocusChanged(true)
App: ACTION_UP
App: ACTION_DOWN
App: ACTION_UP
Подробнее здесь: https://stackoverflow.com/questions/793 ... setcontent