Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong calculation of suggestions list height #264

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

eduardbosch
Copy link

Hi again 馃帀

I've fixed another issue that causes the suggestions list to be positioned not in the first item when suggestions are swapped.

The problem

The problem was that sometimes the suggestions RecyclerView create fewer items than the number of swapped suggestions, but it says that the items do not fill all the height suggestions. This is impossible because suggestions could not fill all the suggestions list view only if he can draw all swapped suggestions. So, when some suggestions are not drawn, is a signal that there are more suggestions than what suggestions list could fit, and this means that the suggestions list height fill all the view height.


Test

To test this, I've used an emulator with 4,5'' and 480x854 resolution. Also, I've tested this on an LG x220ds.

Then, I've changed the DataHelper color suggestions to this values. This caused the suggestions RecyclerView to draw fewer children than using shorter names.

            sColorSuggestions= new ArrayList<>(Arrays.asList(
                    new ColorSuggestion("GREEN multi line text in tiny screens"),
                    new ColorSuggestion("BLUE multi line text in tiny screens"),
                    new ColorSuggestion("pink"),
                    new ColorSuggestion("purple"),
                    new ColorSuggestion("brown"),
                    new ColorSuggestion("gray"),
                    new ColorSuggestion("Granny Smith Apple"),
                    new ColorSuggestion("Indigo"),
                    new ColorSuggestion("Periwinkle"),
                    new ColorSuggestion("Mahogany"),
                    new ColorSuggestion("Maize"),
                    new ColorSuggestion("Mahogany"),
                    new ColorSuggestion("Outer Space"),
                    new ColorSuggestion("Melon"),
                    new ColorSuggestion("Yellow"),
                    new ColorSuggestion("Orange"),
                    new ColorSuggestion("Red"),
                    new ColorSuggestion("Orchid")));

I've also forced to show 10 suggestions every time I type a work by changing the listener to this in SlidingSearchResultsExampleFragment:

        mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {

            @Override
            public void onSearchTextChanged(String oldQuery, final String newQuery) {
                mSearchView.swapSuggestions(DataHelper.getHistory(getActivity(), 10));

                Log.d(TAG, "onSearchTextChanged()");
            }
        });

Before the fix

incorrect_height_calculation

After the fix

correct_height_calculation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant