I will start this question with a little bit of context
It’s an AAOS application, in the problematic screen let’s say, there are two lists (one that needs direct manipulation mode on, and the other off). Using the MFC I am trying to navigate between them, and switch the Direct Manipulation Mode using recommended way (Advanced mechanism) based on a focus listener for the first list (that needs DMM on).
Code is pretty straight forward, however once switched OFF I cannot call it back to set it ON (at least not on the same view from what I noticed)
private final OnFocusChangeListener mFocusChangeListener =
(view, hasFocus) -> {
Timber.v("%s OnFocusChangeListener %b", FocusUtils.FOCUS_TAG, hasFocus);
DirectManipulationHelper.enableDirectManipulationMode(view, hasFocus);
setOnGenericMotionListener(hasFocus ? mMotionEventListener : null);
setOnKeyListener(hasFocus ? mKeyListener : null);
};
I noticed a possible (partial) solution having another focus listener on another view and set the DMM in an opposite way (!hasFocus) but of course I run again into the same problem (works only for one switch). So I thoutght invalidating the view before setting DMM or using an AccessibilityEvent
(with same view set as source, and call recycle
), which didn’t work either.
Notes: This works fine for Android 12, from 13+ problem was noticed. I tried to search if there is any known reported issue, it seems not.
Another thing to mention is that each list is in a separate FocusArea. I ended up adding some logic when switch between the these areas, however I wonder why this doesn’t work ?