I am implementing the stylus button with MotionEvent.
So when I drag over the screen without pressing the stylus button, I will get the following values from getActionMasked(): 0 (ACTION_DOWN), 2 (ACTION_MOVE), and 3 (ACTION_UP)
However, while I hold the stylus button, these motion events give me the getActionMasked() values: 211 (ACTION_DOWN), 213 (ACTION_MOVE), and 212 (ACTION_UP).
The Android documentation says the value for BUTTON_STYLUS_PRIMARY is 32, and that it is not specified as a possible part of the masked value. So why I am getting the masked value of 211, 213, and 212?
I would like to be able to detect regular stylus movement and stylus movement with the button pressed. But I don't want to do something like the following if statement
if (event.getActionMasked() == 213)
I would like to avoid using a constant value like 213 because it might change to a different value in the Android source code. Rather, I would like to do it regularly:
if (event.getActionMasked() == MotionEvent.ACTION_MOVE)
But I need to determine how to unmask 212 to get the actual value of 2. I do not need that extra information because I can simply separately check the button pressed state with:
if (event.getButtonState() == MotionEvent.BUTTON_STYLUS_PRIMARY)
So what is going on here? Why is the button press altering the ACTION_MOVE value?