From be8060acf5ecbb916c161d3249813098c0611ed5 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 7 Aug 2013 13:49:32 -0700 Subject: Display primary call info in call card * CallerInfo, CallerInfoAsyncQuery are copied verbatim from existing Phone code. * Added logging methods to Logger to support logging via TAG in static methods * Only primary caller information (name, phone number and label) are displayed for now. Secondary caller information and photos are not displayed. Change-Id: Id4cfdef78f10f7b32255f4892cd51161f37c8be5 --- .../src/com/android/incallui/CallCardFragment.java | 44 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'InCallUI/src/com/android/incallui/CallCardFragment.java') diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 76bdd1157..9819f15f7 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -16,7 +16,9 @@ package com.android.incallui; +import android.app.Activity; import android.os.Bundle; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -30,6 +32,9 @@ public class CallCardFragment extends BaseFragment implements CallCardPresenter.CallCardUi { private TextView mPhoneNumber; + private TextView mNumberLabel; + private TextView mName; + private ViewStub mSecondaryCallInfo; private TextView mSecondaryCallName; @@ -48,6 +53,8 @@ public class CallCardFragment extends BaseFragment @Override public void onViewCreated(View view, Bundle savedInstanceState) { mPhoneNumber = (TextView) view.findViewById(R.id.phoneNumber); + mName = (TextView) view.findViewById(R.id.name); + mNumberLabel = (TextView) view.findViewById(R.id.label); mSecondaryCallInfo = (ViewStub) view.findViewById(R.id.secondary_call_info); // This method call will begin the callbacks on CallCardUi. We need to ensure @@ -64,6 +71,12 @@ public class CallCardFragment extends BaseFragment } } + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + getPresenter().setContext(activity); + } + @Override public void setSecondaryCallInfo(boolean show, String number) { if (show) { @@ -78,11 +91,40 @@ public class CallCardFragment extends BaseFragment @Override public void setNumber(String number) { - mPhoneNumber.setText(number); + if (!TextUtils.isEmpty(number)) { + mPhoneNumber.setText(number); + mPhoneNumber.setVisibility(View.VISIBLE); + // We have a real phone number as "mPhoneNumber" so make it always LTR + mPhoneNumber.setTextDirection(View.TEXT_DIRECTION_LTR); + } else { + mPhoneNumber.setVisibility(View.GONE); + } + } + + @Override + public void setName(String name, boolean isNumber) { + mName.setText(name); + mName.setVisibility(View.VISIBLE); + if (isNumber) { + mName.setTextDirection(View.TEXT_DIRECTION_LTR); + } else { + mName.setTextDirection(View.TEXT_DIRECTION_INHERIT); + } } @Override public void setName(String name) { + setName(name, false); + } + + @Override + public void setNumberLabel(String label) { + if (!TextUtils.isEmpty(label)) { + mNumberLabel.setText(label); + mNumberLabel.setVisibility(View.VISIBLE); + } else { + mNumberLabel.setVisibility(View.GONE); + } } private void showAndInitializeSecondaryCallInfo() { -- cgit v1.2.3