From 2a39cd52067e635c66839d888cbe829c5ee7f105 Mon Sep 17 00:00:00 2001 From: Koji Arai Date: Sun, 26 Sep 2010 14:39:52 +0000 Subject: [PATCH] Fixes issue 2282 Added an option whether the registered name color is change or not Avoid "Connection error" when MessageView is opened. The contacts.getName() might return null. --- res/values/strings.xml | 4 +++ res/xml/global_preferences.xml | 5 +++ src/com/fsck/k9/K9.java | 24 +++++++++++++ src/com/fsck/k9/activity/setup/Prefs.java | 37 +++++++++++++++++++ src/com/fsck/k9/mail/Address.java | 44 ++++++++++++++--------- 5 files changed, 98 insertions(+), 16 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4e805fb01..67aa68630 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -314,6 +314,10 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Touch-friendly view Roomier list items with message previews + Choose registered name color + Default theme color + Choosed color + Fixed-width fonts Use a fixed-width font when showing plain-text messages Return to list after delete diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index 71e7ea1a7..40f0353cf 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -125,6 +125,11 @@ + + 0) { cursor.moveToFirst(); - name = contacts.getName(cursor); - sContactsName.put(mAddress, name); + name = contacts.getName(cursor); // name might return null + if (name != null) { + sContactsName.put(mAddress, name); - SpannableString sname = new SpannableString(name); - sname.setSpan(new ForegroundColorSpan(Color.BLUE), - 0, - sname.length(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE - ); - return sname; + if (K9.changeRegisteredNameColor()) { + SpannableString sname = new SpannableString(name); + sname.setSpan(new ForegroundColorSpan(K9.getRegisteredNameColor()), + 0, + sname.length(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + ); + return sname; + } + else { + return name; + } + } } else {