and make (semi-)related code more concise
This commit is contained in:
Helium314 2024-01-05 08:02:11 +01:00
parent 2fffe31a3b
commit b98a208b69
2 changed files with 5 additions and 14 deletions

View file

@ -1347,11 +1347,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final View inlineSuggestionView = InlineAutofillUtils.createView(inlineSuggestions, mDisplayContext);
// "normal" suggestions might be determined in parallel when processing MSG_UPDATE_SUGGESTION_STRIP
// so we add a delay to make sure inline suggestions are set only after normal suggestions
mHandler.postDelayed(() -> {
mSuggestionStripView.clear();
mSuggestionStripView.hideToolbarKeys();
mSuggestionStripView.addSuggestionView(inlineSuggestionView);
}, 200);
mHandler.postDelayed(() -> mSuggestionStripView.setInlineSuggestionsView(inlineSuggestionView), 200);
return true;
}

View file

@ -269,13 +269,11 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
getContext(), mSuggestedWords, mSuggestionsStrip, this);
}
public void addSuggestionView(final View view) {
mSuggestionsStrip.addView(view);
}
public void hideToolbarKeys() {
public void setInlineSuggestionsView(final View view) {
clear();
mToolbarExpandKey.setVisibility(GONE);
mPinnedKeys.setVisibility(GONE);
mSuggestionsStrip.addView(view);
}
public void setMoreSuggestionsHeight(final int remainingHeight) {
@ -283,7 +281,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
}
@SuppressLint("ClickableViewAccessibility") // why would "null" need to call View#performClick?
public void clear() {
private void clear() {
mSuggestionsStrip.removeAllViews();
if (DEBUG_SUGGESTIONS)
removeAllDebugInfoViews();
@ -293,9 +291,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
for (final TextView word : mWordViews) {
word.setOnTouchListener(null);
}
mToolbarExpandKey.setVisibility(VISIBLE);
mPinnedKeys.setVisibility(VISIBLE);
}
private void removeAllDebugInfoViews() {