-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last Suggestion not Showing Correctly #315
Comments
also, I am noticing on first scroll, it doesn't scroll very smooth. It kind of shifts left and then back to the right. It's almost as if the left-most suggestion is left-aligned to the screen (see how "Gi" is aligned to the left of the screen) and it's not allowing it to be cut off a bit and fade off to the left. Hope that makes sense. |
I see nothing wrong here. The suggestion list could be wider than the screen, because there could be many possible matches of what you typed. Naturally, they can't match the screen width perfectly every time. The words are not aligned to either side of the screen. What you see is just a coincidence. Type something else that would cause a longer suggestion list (even "hide" should work in your case), scroll to both sides and you'll see it's all good. There is nothing to fix here. |
I don't think I explained my issue enough. "Hid" is the last suggestion in a long list of suggested words. To see for yourself, type 4-4 to get these suggestions. The first screenshot is me scrolling all the way to the right until "Hid" is highlighted. You can see that it is cut off and you can't read the entire word. |
Ah, I see. Sorry, for misinterpreting. However, scrolling works fine on both my phones. Selecting the previous/next word happens in There are two possible problems:
I doubt it is the second case, but could please help with confirming? In mView.scrollToPosition(selectedIndex); with this: new Handler().postDelayed(() -> mView.scrollToPosition(selectedIndex), 200); Supposingly, scrolling will become inadequately slow, but it will work. Of course, this is not a solution, it is just a test. |
Yes, this workaround is working, which is bringing us closer to the root of the problem. |
There may be a better solution in that Stackoverflow thread. Instead of waiting for 200 ms, this is supposed to wait for the view to become ready, then scroll:
Could you please replace the same line as above, but with the |
That did not work very well, the delay works better. I was even able to reduce the delay to 100 ms and I don't notice any slowness, but get to see the last suggestion correctly. |
This is probably happening on other low end phones too, so I would like to have it fixed. I have two ideas how to fix it, but before that, I need to know one more thing. But let's start with the original version of
Are you still able to see the last suggestion? Has the list automatically scrolled to the beginning? If yes, then Also, could you please validate one more alternative way of fixing the problem? Since your phone needs some time to update the highlighted word before scrolling, let's reverse the order of actions and first scroll, then let it draw on the screen as long as it wants. This could again fail, but we could give it a try. So, public void scrollToSuggestion(int increment) {
if (suggestions.size() <= 1) {
return;
}
int oldIndex = selectedIndex;
selectedIndex = selectedIndex + increment;
if (selectedIndex == suggestions.size()) {
selectedIndex = 0;
} else if (selectedIndex < 0) {
selectedIndex = suggestions.size() - 1;
}
mView.scrollToPosition(selectedIndex);
mSuggestionsAdapter.setSelection(selectedIndex);
mSuggestionsAdapter.notifyItemChanged(oldIndex);
mSuggestionsAdapter.notifyItemChanged(selectedIndex);
} The other idea is to add a configuration option "alternative scrolling" or similar, that when enabled will allow scrolling with delay, which definitely works for you. |
That's so sad... OK, I guess I'll add a setting for the alternative scrolling method using a delay. |
I have been seeing an issue on my Sonim XP5s (running Android 8.1) where the last item in the suggestions (the farthest right suggestion) is not completely showing (it is cut off on the end) when I first cycle through the suggestions. However, if I cycle through them a second time, by the second time it looks correct (see how "Hid" shows correctly the second time).
![image](https://private-user-images.githubusercontent.com/11878115/255353741-33596184-1114-46d1-b94e-34333bb2c7ac.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODc5MDMsIm5iZiI6MTczODg4NzYwMywicGF0aCI6Ii8xMTg3ODExNS8yNTUzNTM3NDEtMzM1OTYxODQtMTExNC00NmQxLWI5NGUtMzQzMzNiYjJjN2FjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDAwMjAwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM2OTFhNWZjY2EwMGQ1OTJlNmJmMzZjMzVlMjA2YTYxYmE4ZDMyM2ZlMWQzZDRhMjdmMmMzY2Y3NDM2OTU0ZGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.GZd0Maf04jsb0XwQNoUZ17FoV7MzpzpIHaGg4qwx6zE)
![image](https://private-user-images.githubusercontent.com/11878115/255353753-085f13df-8ee2-4780-868b-18835c9d0483.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODc5MDMsIm5iZiI6MTczODg4NzYwMywicGF0aCI6Ii8xMTg3ODExNS8yNTUzNTM3NTMtMDg1ZjEzZGYtOGVlMi00NzgwLTg2OGItMTg4MzVjOWQwNDgzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDAwMjAwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRhZWNlNmU1Njk1ZTE1OTNlMzg2OTliZDc3MDliMmFkODNmOThkOWIzOWI4YWY0YmE0MzIyNjdiZDBmMjgyODUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.iEAZa-FTZ3bodnE3x26kY-11kMGesCyS2EKu02DAQDA)
I have poked at the code a bit, learned about RecyclerView, etc. The xml/layout looks good, and possibly that isn't where the issue lies because it eventually looks good on the second try. I'm thinking it could be something with the functions for selecting left/right. I would be curious where you think the issue may lie and I am open to debugging that specific code area myself:
The text was updated successfully, but these errors were encountered: