File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
app/src/main/java/de/markusfisch/android/pielauncher/content Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -170,27 +170,26 @@ public List<AppIcon> filterAppsBy(Context context, String query) {
170170 String subject = getSubject (item , appIcon , defaultLocale );
171171 boolean add = false ;
172172 switch (strategy ) {
173- case Preferences .SEARCH_STRICTNESS_STARTS_WITH :
174- add = subject .startsWith (query );
175- break ;
173+ // HAMMING includes CONTAINS for historical reasons.
176174 case Preferences .SEARCH_STRICTNESS_HAMMING :
177- if (hammingDistance (subject , query ) < 2 ) {
178- hamming .add (appIcon );
179- }
180- // Fall through because HAMMING includes CONTAINS
181- // for historical reasons.
182175 case Preferences .SEARCH_STRICTNESS_CONTAINS :
183176 add = subject .contains (query );
184177 break ;
178+ case Preferences .SEARCH_STRICTNESS_STARTS_WITH :
179+ add = subject .startsWith (query );
180+ break ;
185181 }
186182 if (add ) {
187183 list .add (appIcon );
184+ } else if (strategy == Preferences .SEARCH_STRICTNESS_HAMMING &&
185+ hammingDistance (subject , query ) < 2 ) {
186+ hamming .add (appIcon );
188187 }
189188 }
190189 }
191190
192191 Collections .sort (list , appLabelComparator );
193- if (strategy == Preferences . SEARCH_STRICTNESS_HAMMING ) {
192+ if (! hamming . isEmpty () ) {
194193 // Only append hamming matches as they're less likely
195194 // as good as exact matches.
196195 Collections .sort (hamming , appLabelComparator );
You can’t perform that action at this time.
0 commit comments