You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now if you create an entry and try to unfocus by clicking somewhere else it will not work and the same entry will be focused, even if you hide the keyboard...
I found the problem and fixed bug with some bugs.
All I did was add a focus observer and touch observer on the MainActivity simple as that
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Window.DecorView.ViewTreeObserver.GlobalFocusChange += FocusChanged;
}
private void FocusChanged(object sender, ViewTreeObserver.GlobalFocusChangeEventArgs e)
{
if (e.NewFocus is null && e.OldFocus is not null)
{
InputMethodManager imm = InputMethodManager.FromContext(this);
IBinder wt = e.OldFocus.WindowToken;
if (imm is null || wt is null)
return;
imm.HideSoftInputFromWindow(wt, HideSoftInputFlags.None);
}
}
public override bool OnTouchEvent(MotionEvent e)
{
if (CurrentFocus is not null)
CurrentFocus.ClearFocus();
return base.OnTouchEvent(e);
}
but even so some views refuse to talk to OnTouchEvent, such as ScrollView or CollectionView somewhere on the code they are consuming the touch event and wont let it get to the unfocus happen
Also, this focus will remove the keyboard if has no more focus
Steps to Reproduce
Create a list of views/entries/any focusable views and put it on the scrollView
focus one
try to unfocus without focusing on others focusables 🐞
Expected: Fire the OnTouchEvent in the MainActivity so could use the logic above
Outcome: Doesnt Fire the OnTouchEvent, not even on the ScrollView
Description
Right now if you create an entry and try to unfocus by clicking somewhere else it will not work and the same entry will be focused, even if you hide the keyboard...
I found the problem and fixed bug with some bugs.
All I did was add a focus observer and touch observer on the MainActivity simple as that
but even so some views refuse to talk to OnTouchEvent, such as ScrollView or CollectionView somewhere on the code they are consuming the touch event and wont let it get to the unfocus happen
Also, this focus will remove the keyboard if has no more focus
Steps to Reproduce
Expected: Fire the OnTouchEvent in the MainActivity so could use the logic above
Outcome: Doesnt Fire the OnTouchEvent, not even on the ScrollView
Link to public reproduction project repository
https://github.com/taz4270/ScrollNFocus-Example
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 13
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: