ContactsAutoCompleteTextView icon indicating copy to clipboard operation
ContactsAutoCompleteTextView copied to clipboard

Find contacts by searching 01... when their number is saved with a country code

Open mammuth opened this issue 9 years ago • 7 comments

When searching for a phone number like 0150 123456 the contact should show up, even if its saved as eg. +49 150 123456.

mammuth avatar Jul 20 '15 18:07 mammuth

Hehe, my EIST Tutor is perfectly right!

I need to refractor the code one of these days and to fix the issue you're explaining. It'll be in 0.2 ! :+1: :smile:

lolobosse avatar Jul 20 '15 18:07 lolobosse

I need your review on this commit, it solves 75% of the use cases but some are not properly handled like if I type +4916... I won't get 016, but cannot say if many people look for number with country code included. :anguished: :confused:

lolobosse avatar Jul 27 '15 15:07 lolobosse

Why not pattern match it with +XX 1234 / 00XX 1234 / 01234?

Your solution doesn't seem reliable :smirk:

mammuth avatar Jul 27 '15 15:07 mammuth

It isn't (I'd have closed the issue if it was...).

How do you handle difference between USA (+1) and Bahamas (+1242) ? Not only european out there :stuck_out_tongue_winking_eye: :wink: :warning:

To have a proper overview of the complexity of the problem: https://en.wikipedia.org/wiki/List_of_country_calling_codes

lolobosse avatar Jul 27 '15 15:07 lolobosse

Hm, difficult one^^

In this case you're right, probably no one will enter a number with country code. You might even limit the input field to numbers only to prevent the user from making this "mistake" :stuck_out_tongue_winking_eye:

mammuth avatar Jul 28 '15 16:07 mammuth

OK, I think I found a reliable solution: what do you think of a view which splits itself at runtime in two views (one for the country code and one for the rest) if the user types a + or a 00 (and if a letter comes after the 00, it'll be reassembled because it's then a name or a email).

I need a bit of time to make it properly but I think it is the best not-complex solution.

What is your opinion on that?

lolobosse avatar Jul 28 '15 22:07 lolobosse

Hi lolobosse,

How to get phone number, I try to use textview.getName() but it return null. I also try to use textview.getText().toString() after pick a contact, but it just return a name, not return a phone number. Please help, thanks.

nguyencongbinh avatar Dec 17 '15 16:12 nguyencongbinh