summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/PhoneCallDetailsHelper.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-02-03 08:31:10 -0800
committerTyler Gunn <tgunn@google.com>2014-02-03 08:31:10 -0800
commit45ed3b5932ed590b45235d7b2befa736a95e7f75 (patch)
tree472471be0b07bc9becba8270dc4d0e183c4cd49f /src/com/android/dialer/PhoneCallDetailsHelper.java
parent964222de32bfb2ca0ff06b445bcb25c0bb936d2f (diff)
downloadandroid_packages_apps_Dialer-45ed3b5932ed590b45235d7b2befa736a95e7f75.tar.gz
android_packages_apps_Dialer-45ed3b5932ed590b45235d7b2befa736a95e7f75.tar.bz2
android_packages_apps_Dialer-45ed3b5932ed590b45235d7b2befa736a95e7f75.zip
Call History Affordances Swap
1. Swapped the intents for the primary view 2. Changed the icon for the secondary action button 3. Added a vertical divider line to separate the secondary action button from the primary view 4. Cleaned up the accessibility text Change-Id: Ifd4ceff0d67b1587c4378e29be7344de50057a7d
Diffstat (limited to 'src/com/android/dialer/PhoneCallDetailsHelper.java')
-rw-r--r--src/com/android/dialer/PhoneCallDetailsHelper.java54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index 2a4a1425c..4424fcb0b 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -91,26 +91,13 @@ public class PhoneCallDetailsHelper {
isHighlighted ? mCallTypeHelper.getHighlightedColor(details.callTypes[0]) : null;
// The date of this call, relative to the current time.
- CharSequence dateText =
- DateUtils.getRelativeTimeSpanString(details.date,
- getCurrentTimeMillis(),
- DateUtils.MINUTE_IN_MILLIS,
- DateUtils.FORMAT_ABBREV_RELATIVE);
+ CharSequence dateText = getCallDate(details);
// Set the call count and date.
setCallCountAndDate(views, callCount, dateText, highlightColor);
- CharSequence numberFormattedLabel = null;
- // Only show a label if the number is shown and it is not a SIP address.
- if (!TextUtils.isEmpty(details.number)
- && !PhoneNumberHelper.isUriNumber(details.number.toString())) {
- if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
- numberFormattedLabel = details.geocode;
- } else {
- numberFormattedLabel = Phone.getTypeLabel(mResources, details.numberType,
- details.numberLabel);
- }
- }
+ // Get type of call (ie mobile, home, etc) if known, or the caller's
+ CharSequence numberFormattedLabel = getCallTypeOrLocation(details);
final CharSequence nameText;
final CharSequence numberText;
@@ -141,6 +128,41 @@ public class PhoneCallDetailsHelper {
views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE);
}
+ /**
+ * For a call, if there is an associated contact for the caller, return the known call type
+ * (e.g. mobile, home, work). If there is no associated contact, attempt to use the caller's
+ * location if known.
+ * @param details Call details to use.
+ * @return Type of call (mobile/home) if known, or the location of the caller (if known).
+ */
+ public CharSequence getCallTypeOrLocation(PhoneCallDetails details) {
+ CharSequence numberFormattedLabel = null;
+ // Only show a label if the number is shown and it is not a SIP address.
+ if (!TextUtils.isEmpty(details.number)
+ && !PhoneNumberHelper.isUriNumber(details.number.toString())) {
+ if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
+ numberFormattedLabel = details.geocode;
+ } else {
+ numberFormattedLabel = Phone.getTypeLabel(mResources, details.numberType,
+ details.numberLabel);
+ }
+ }
+ return numberFormattedLabel;
+ }
+
+ /**
+ * Get the call date/time of the call, relative to the current time.
+ * e.g. 3 minutes ago
+ * @param details Call details to use.
+ * @return String representing when the call occurred.
+ */
+ public CharSequence getCallDate(PhoneCallDetails details) {
+ return DateUtils.getRelativeTimeSpanString(details.date,
+ getCurrentTimeMillis(),
+ DateUtils.MINUTE_IN_MILLIS,
+ DateUtils.FORMAT_ABBREV_RELATIVE);
+ }
+
/** Sets the text of the header view for the details page of a phone call. */
public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) {
final CharSequence nameText;