Getting some unexpected result on implementing #171 #5689
-
|
I was trying to implement #171 as per Ben's suggestion. But I got some unexpected result in TextnputInteractionView. Problem : - After submitting wrong answers, new TextInputInteractionView should be empty, but in this case, it was filled with previous submitted answer. Screen Record :- Problem.in.implementing.diffutil.mp4Log : - |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
So, I tried to check on develop branch . in the below logs, we can see when we input somthing (Let suppose "3"), the previous textviewmodel instances are triggering Textwatcher. I suspect that old used textwatchers are not removed properly when new TextInputInteractionView loads. Log : - |
Beta Was this translation helpful? Give feedback.
-
|
so, I tried to remove old textWatcher. 1. @BindingAdapter("textChangedListener")
public static void bindTextWatcher(@NonNull EditText editText, TextWatcher textWatcher) {
TextWatcher existingWatcher = (TextWatcher) editText.getTag(R.id.textWatcher);
if (existingWatcher != null && existingWatcher != textWatcher) {
editText.removeTextChangedListener(existingWatcher);
}
if (textWatcher != null) {
editText.addTextChangedListener(textWatcher);
editText.setTag(R.id.textWatcher, textWatcher);
}
}
2. To tackle this issue. Possible Reason to use maxLine Screen Record : used.modify.bindtextwatcher.without.one.way.binding.mp4Log : - Conclusion :
this problem was occurring on only for first edittext input. |
Beta Was this translation helpful? Give feedback.
-
|
@BenHenning , @adhiamboperes could you share your view on this solution? |
Beta Was this translation helpful? Give feedback.
-
|
@subhajitxyz, do you have updates on the attempted fixes for this discussion? |
Beta Was this translation helpful? Give feedback.
I think that if the experience can be made to work without two-way binding, it then makes sense to remove it. It's possible we have several different iterations on this code currently in place and they may not all be compatible perfectly with each other.