From 288fa28143d859119a69ac1cb90151a4722df32c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 8 Nov 2011 12:15:42 +0100 Subject: [PATCH] Customization to display only username in history activity. --- res/values/non_localizable_custom.xml | 1 + src/org/linphone/HistoryActivity.java | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index 2f7d968bf..293c83420 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -14,6 +14,7 @@ true false true + false true diff --git a/src/org/linphone/HistoryActivity.java b/src/org/linphone/HistoryActivity.java index 390a5034b..26425456c 100644 --- a/src/org/linphone/HistoryActivity.java +++ b/src/org/linphone/HistoryActivity.java @@ -153,23 +153,21 @@ public class HistoryActivity extends ListActivity { lDirectionImageIn.setVisibility(View.GONE); lDirectionImageOut.setVisibility(View.VISIBLE); } - + Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver()); LinphoneUtils.setImagePictureFromUri(lView.getContext(), lContactPicture, uri, R.drawable.unknown_person); - + LinphoneCore lc = LinphoneManager.getLc(); LinphoneProxyConfig lProxyConfig = lc.getDefaultProxyConfig(); + boolean showOnlyUsername = getResources().getBoolean(R.bool.show_only_username_in_history); String lDetailedName=null; - String lDisplayName = lAddress.getDisplayName(); - if (lDisplayName == null) - lDisplayName = LinphoneUtils.findDisplayNameOfContact(lAddress, getContentResolver()); - - if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) { + String lDisplayName = !showOnlyUsername ? lAddress.getDisplayName() : null; + if (showOnlyUsername || (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain()))) { lDetailedName = lAddress.getUserName(); } else { lDetailedName = lAddress.asStringUriOnly(); } - + if (lDisplayName == null) { lFirstLineView.setText(lDetailedName); lSecondLineView.setVisibility(View.GONE); @@ -178,7 +176,7 @@ public class HistoryActivity extends ListActivity { lSecondLineView.setText(lDetailedName); lSecondLineView.setVisibility(View.VISIBLE); } - + return lView; }