Export to GitHub

k9mail - issue #2098

keyboard-filter in ChooseFolder should match in any place


Posted on Aug 5, 2010 by Happy Wombat

What steps will reproduce the problem? 1. chose "move to folder" 2. long press MENU to activate the keyboard 3. start typing to restrict the list

What is the expected output?

List all folders that contain the typed text in any place of their name/path.

What do you see instead?

List all folders that start with the typed text. (Makes little sense for deep nested folders.)

What version of K-9 are you using?

current market relase.

Is your email account a POP account, Exchange Account or an IMAP account?

IMAP

Please provide any additional information that might help us debug the issue below.

ChooseFolder should override the getFilter()-method of the ArrayAdapter used. http://developer.android.com/reference/android/widget/Filterable.html

e.g. adapter = new ArrayAdapter<String>(...) { public Filter getFilter() { if (myMailFolderFilter == null) { myMailFolderFilter = new MailFolderNameFilter(); } return myMailFolderFilter; } };

private class MailFolderNameFilter extends android.widget.Filter { .... }

Comment #1

Posted on Aug 5, 2010 by Helpful Monkey

(No comment was entered for this change.)

Comment #2

Posted on Aug 5, 2010 by Happy Wombat

Here is an untested patch to do this. (I don't want to uninstall the market-version of K9 from my phone and thus loose my mail-storage for testing.)

Comment #3

Posted on Aug 5, 2010 by Happy Wombat

Patch tested, debugged and working.

Attachments

Comment #4

Posted on Aug 5, 2010 by Happy Wombat

Patch on ticket http://code.google.com/p/k9mail/issues/detail?id=2099 solved this too.

Comment #5

Posted on Aug 8, 2010 by Helpful Monkey

Why do you synchronize access to mOriginalValues?

Comment #6

Posted on Aug 8, 2010 by Helpful Monkey

Also: Did you mean for the search string "some thing" to match folders that either contain "some" or "thing"? Because you split the folder name and try to match it to the search string again (which of course always fails). Or do you want to show only folders containing all search terms?

Comment #7

Posted on Aug 8, 2010 by Helpful Monkey

Here is my version of your patch (ignore the additional changes in ChooseFolder.java).

Attachments

Comment #8

Posted on Aug 8, 2010 by Happy Wombat

I tried to match all folders that contained the complete search-term or (if there are multiple search terms) one of them. I left the synchronized{} in there when I took the original matcher as a blueprint. (In the original one mOriginalValues is a private field in the list-widget. That's why we need to reset it when the original list changes due to #20099 .)

Comment #9

Posted on Aug 8, 2010 by Helpful Monkey

Okay, I will change the code to return all items that contain at least one search term.

I had a look at the source code of the original implementation in ArrayAdapter. It looks like they have problems of their own (e.g. https://code.google.com/p/android/issues/detail?id=9666). I believe this class isn't thread-safe at all. So I don't know why they decided to synchronize access to mOriginalValues (but not mObjects).

Comment #10

Posted on Aug 8, 2010 by Helpful Monkey

This issue was closed by revision r2143.

Comment #11

Posted on Aug 8, 2010 by Helpful Monkey

Thanks for the patch!

Comment #12

Posted on Aug 16, 2010 by Happy Wombat

We should do this in the folder-list too.

Status: Fixed

Labels:
Type-Enhancement Priority-Medium Product-k9mail