diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/tray/SuggestionsAdapter.java b/app/src/main/java/io/github/sspanak/tt9/ui/tray/SuggestionsAdapter.java index 5432a7c4..9aec3af6 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/tray/SuggestionsAdapter.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/tray/SuggestionsAdapter.java @@ -1,5 +1,6 @@ package io.github.sspanak.tt9.ui.tray; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; @@ -57,8 +58,16 @@ public class SuggestionsAdapter extends RecyclerView.Adapter 0) { alternativeScrollingHandler.removeCallbacksAndMessages(null); - alternativeScrollingHandler.postDelayed(this::scrollToSelectedIndex, settings.getSuggestionScrollingDelay()); + alternativeScrollingHandler.postDelayed(this::scrollView, settings.getSuggestionScrollingDelay()); } else { - scrollToSelectedIndex(); + scrollView(); } } /** - * Tells the adapter to scroll. Always call scrollToSuggestionOnScreen() first, + * Tells the adapter to scroll. Always call scrollToIndex() first, * to set the selected index in the adapter. */ - private void scrollToSelectedIndex() { - if (containsStem() && selectedIndex == 1 && getSuggestion(1).length() < getSuggestion(suggestions.size() - 1).length()) { + private void scrollView() { + if (containsStem() && selectedIndex == 1) { mView.scrollToPosition(0); } else { mView.scrollToPosition(selectedIndex);