Max 3 search suggestions

This commit is contained in:
M66B 2021-06-07 21:23:56 +02:00
parent 4035e66772
commit cebc18794f
2 changed files with 6 additions and 3 deletions

View File

@ -593,8 +593,8 @@ public interface DaoMessage {
" GROUP BY sender" +
" ORDER BY sender, subject" +
" LIMIT 5")
Cursor getSuggestions(Long account, Long folder, String query);
" LIMIT :limit")
Cursor getSuggestions(Long account, Long folder, String query, int limit);
@Query("SELECT language FROM message" +
" WHERE (:account IS NULL OR message.account = :account)" +

View File

@ -57,6 +57,8 @@ import java.util.Calendar;
import java.util.List;
public class FragmentDialogSearch extends FragmentDialogBase {
private static final int MAX_SUGGESTIONS = 3;
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
@ -141,7 +143,8 @@ public class FragmentDialogSearch extends FragmentDialogBase {
return db.message().getSuggestions(
account < 0 ? null : account,
folder < 0 ? null : folder,
"%" + query + "%");
"%" + query + "%",
MAX_SUGGESTIONS);
}
});