binding.storyFullscreenFrameLayout.setOnGenericMotionListener(new View.OnGenericMotionListener() {
@Override
public boolean onGenericMotion(View v, MotionEvent event) {
Log.d(TAG, "onGenericMotion: " + event.toString());
if (event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
// Log.d(TAG, "鼠标左键");
// broadcastToast("左键");
if (event.getAction() == MotionEvent.ACTION_BUTTON_PRESS) {
microphoneDown();
// broadcastToast(event.toString());
}
if (event.getAction() == MotionEvent.ACTION_BUTTON_RELEASE) {
microphoneUp();
// broadcastToast(event.toString());
}
}
if (event.getButtonState() == MotionEvent.BUTTON_SECONDARY) {
Log.d(TAG, "鼠标右键");
// broadcastToast("右键");
}
if (event.getButtonState() == MotionEvent.BUTTON_TERTIARY) {
Log.d(TAG, "鼠标中间键");
// broadcastToast("中间键");
}
return false;
}
});