summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-09-16 07:57:06 -0700
committerYorke Lee <yorkelee@google.com>2013-09-16 12:34:38 -0700
commit93877c24c64ceb5ad5611593227da0ff6a41a235 (patch)
treee92535c05883a22f4f4648cfd38273dabad75329 /InCallUI
parent9378ba4a2efd891f1862f363aebdef66e14900be (diff)
Add internet call type label
Bug: 10764487 Change-Id: I87e48063b14629c19a58b9ddb2acb736af6f37e0
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/res/layout/primary_call_info.xml2
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java17
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java7
-rw-r--r--InCallUI/src/com/android/incallui/ContactInfoCache.java13
4 files changed, 31 insertions, 8 deletions
diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml
index fd8b83a14..f67c04aa6 100644
--- a/InCallUI/res/layout/primary_call_info.xml
+++ b/InCallUI/res/layout/primary_call_info.xml
@@ -88,7 +88,7 @@
for certain kinds of calls (like "Internet call" for a SIP call.) -->
<TextView android:id="@+id/callTypeLabel"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/incall_call_banner_text_color"
+ android:textColor="@color/incall_callTypeSip"
android:maxLines="1"
android:layout_column="0"
android:layout_row="2"
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 8fb2eb4b4..af3705a06 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -45,6 +45,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private TextView mNumberLabel;
private TextView mPrimaryName;
private TextView mCallStateLabel;
+ private TextView mCallTypeLabel;
private ImageView mPhoto;
private TextView mElapsedTime;
private View mProviderInfo;
@@ -100,6 +101,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mSecondaryCallInfo = (ViewStub) view.findViewById(R.id.secondary_call_info);
mPhoto = (ImageView) view.findViewById(R.id.photo);
mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
+ mCallTypeLabel = (TextView) view.findViewById(R.id.callTypeLabel);
mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime);
mProviderInfo = view.findViewById(R.id.providerInfo);
mProviderLabel = (TextView) view.findViewById(R.id.providerLabel);
@@ -166,7 +168,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
@Override
public void setPrimary(String number, String name, boolean nameIsNumber, String label,
- Drawable photo, boolean isConference) {
+ Drawable photo, boolean isConference, boolean isSipCall) {
Log.d(this, "Setting primary call");
if (isConference) {
@@ -183,6 +185,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
// Set the label (Mobile, Work, etc)
setPrimaryLabel(label);
+ showInternetCallLabel(isSipCall);
+
setDrawableToImageView(mPhoto, photo);
}
@@ -277,6 +281,17 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
}
+ private void showInternetCallLabel(boolean show) {
+ if (show) {
+ final String label = getView().getContext().getString(
+ R.string.incall_call_type_label_sip);
+ mCallTypeLabel.setVisibility(View.VISIBLE);
+ mCallTypeLabel.setText(label);
+ } else {
+ mCallTypeLabel.setVisibility(View.GONE);
+ }
+ }
+
@Override
public void setPrimaryCallElapsedTime(boolean show, String callTimeElapsed) {
if (show) {
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index b055a58a1..01042dd98 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -327,12 +327,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
final String name = getNameForCall(entry);
final String number = getNumberForCall(entry);
final boolean nameIsNumber = name != null && name.equals(entry.number);
-
ui.setPrimary(number, name, nameIsNumber, entry.label,
- entry.photo, isConference);
+ entry.photo, isConference, entry.isSipCall);
} else {
// reset to nothing (like at end of call)
- ui.setPrimary(null, null, false, null, null, false);
+ ui.setPrimary(null, null, false, null, null, false, false);
}
}
@@ -428,7 +427,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
public interface CallCardUi extends Ui {
void setVisible(boolean on);
void setPrimary(String number, String name, boolean nameIsNumber, String label,
- Drawable photo, boolean isConference);
+ Drawable photo, boolean isConference, boolean isSipCall);
void setSecondary(boolean show, String name, boolean nameIsNumber, String label,
Drawable photo, boolean isConference);
void setSecondaryImage(Drawable image);
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java
index 2c033e98b..e005942b2 100644
--- a/InCallUI/src/com/android/incallui/ContactInfoCache.java
+++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java
@@ -25,6 +25,7 @@ import android.net.Uri;
import android.os.Looper;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.incallui.service.PhoneNumberService;
@@ -354,6 +355,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
String displayNumber = null;
String displayLocation = null;
String label = null;
+ boolean isSipCall = false;
// It appears that there is a small change in behaviour with the
// PhoneUtils' startGetCallerInfo whereby if we query with an
@@ -378,8 +380,12 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
// Then we could remove this hack, and instead ask the CallerInfo
// for a "user visible" form of the SIP address.
String number = info.phoneNumber;
- if (number != null && number.startsWith("sip:")) {
- number = number.substring(4);
+
+ if (!TextUtils.isEmpty(number)) {
+ isSipCall = PhoneNumberUtils.isUriNumber(number);
+ if (number.startsWith("sip:")) {
+ number = number.substring(4);
+ }
}
if (TextUtils.isEmpty(info.name)) {
@@ -450,6 +456,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
cce.number = displayNumber;
cce.location = displayLocation;
cce.label = label;
+ cce.isSipCall = isSipCall;
}
/**
@@ -504,6 +511,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
public String location;
public String label;
public Drawable photo;
+ public boolean isSipCall;
public Uri personUri; // Used for local photo load
@Override
@@ -514,6 +522,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
.add("location", MoreStrings.toSafeString(location))
.add("label", label)
.add("photo", photo)
+ .add("isSipCall", isSipCall)
.toString();
}
}