@@ -104,32 +104,32 @@ public void clear() {
104104
105105
106106 public void addGuesses (@ NonNull ArrayList <String > guesses ) {
107- setVisibility (settings , guesses , true );
107+ setVisibility (settings , isEmpty () && guesses . isEmpty () , true );
108108 if (suggestionBar != null ) {
109109 suggestionBar .prependGuesses (guesses );
110110 }
111111 }
112112
113113
114- public void set (ArrayList <String > suggestions ) {
114+ public void set (@ Nullable ArrayList <String > suggestions ) {
115115 set (suggestions , 0 , false );
116116 }
117117
118118
119- public void set (ArrayList <String > suggestions , boolean containsGenerated ) {
119+ public void set (@ Nullable ArrayList <String > suggestions , boolean containsGenerated ) {
120120 set (suggestions , 0 , containsGenerated );
121121 }
122122
123123
124- public void set (ArrayList <String > suggestions , int selectIndex , boolean containsGenerated ) {
125- setVisibility (settings , suggestions , false );
124+ public void set (@ Nullable ArrayList <String > suggestions , int selectIndex , boolean containsGenerated ) {
125+ setVisibility (settings , suggestions == null || suggestions . isEmpty () , false );
126126 if (suggestionBar != null ) {
127127 suggestionBar .setMany (suggestions , selectIndex , containsGenerated );
128128 }
129129 }
130130
131131
132- public void setClipboardItems (LinkedList <CharSequence > clips ) {
132+ public void setClipboardItems (@ NonNull LinkedList <CharSequence > clips ) {
133133 ArrayList <String > clipStrings = new ArrayList <>(clips .size ());
134134 for (int i = clips .size () - 1 ; i >= 0 ; i --) {
135135 String preview = Clipboard .getPreview (i , SuggestionsBar .CLIPBOARD_SUGGESTION_SUFFIX );
@@ -138,7 +138,7 @@ public void setClipboardItems(LinkedList<CharSequence> clips) {
138138 }
139139 }
140140
141- setVisibility (settings , clipStrings , true );
141+ setVisibility (settings , clipStrings . isEmpty () , true );
142142 if (suggestionBar != null ) {
143143 suggestionBar .setMany (clipStrings , 0 , false );
144144 }
@@ -296,15 +296,15 @@ public void setColorScheme() {
296296 }
297297
298298
299- private void setVisibility (@ Nullable SettingsStore settings , @ Nullable ArrayList < String > newSuggestions , boolean forceVisible ) {
299+ private void setVisibility (@ Nullable SettingsStore settings , boolean willBeEmpty , boolean forceVisible ) {
300300 final boolean areSuggestionsVisible = isInputLimited || forceVisible || (settings != null && settings .getShowSuggestions ());
301301
302302 if (suggestionBar != null ) {
303303 suggestionBar .setVisible (areSuggestionsVisible );
304304 }
305305
306306 if (statusBar != null ) {
307- statusBar .setShown (newSuggestions == null || newSuggestions . isEmpty () || !areSuggestionsVisible );
307+ statusBar .setShown (willBeEmpty || !areSuggestionsVisible );
308308 }
309309 }
310310}
0 commit comments