From d2adce7eb2c37e188626c9001075adf233a65d94 Mon Sep 17 00:00:00 2001 From: Scorillo Date: Thu, 22 Jun 2017 12:32:37 +0300 Subject: [PATCH] Fix spaces in contact names to better match voice input --- app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java index c60c9d8..79c8243 100644 --- a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java +++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java @@ -48,9 +48,10 @@ protected void onServiceConnected() { private void buildPhoneBook(List phoneBookRecords) { for(String phoneBookRecord : phoneBookRecords) { String[] parsedRecord = phoneBookRecord.split("\\^"); + String contactName = parsedRecord[0].replaceAll("\\s+", " ").replaceAll("\\s+$", ""); String phoneNumber = parsedRecord[1].replaceAll("[^\\d\\+]", ""); - mPhoneBookRecords.put(parsedRecord[0], phoneNumber); + mPhoneBookRecords.put(contactName, phoneNumber); } }