diff options
Diffstat (limited to 'InCallUI/src/com/android/incallui')
7 files changed, 89 insertions, 71 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 600689c84..bff48b448 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -617,7 +617,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private Drawable getConferencePhoto(boolean isGeneric) { Log.v(this, "isGenericPhoto: " + isGeneric); - final int resId = isGeneric ? R.drawable.picture_dialing : R.drawable.picture_conference; + final int resId = isGeneric ? R.drawable.picture_dialing : R.drawable.img_conference; return getView().getResources().getDrawable(resId); } @@ -694,6 +694,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr case Call.State.DISCONNECTED: callStateLabel = getCallFailedString(disconnectCause); break; + case Call.State.CONFERENCED: + callStateLabel = context.getString(R.string.card_title_conf_call); + break; default: Log.wtf(this, "updateCallStateWidgets: unexpected call: " + state); } diff --git a/InCallUI/src/com/android/incallui/ConferenceManagerFragment.java b/InCallUI/src/com/android/incallui/ConferenceManagerFragment.java index 75ff17698..f45d294a0 100644 --- a/InCallUI/src/com/android/incallui/ConferenceManagerFragment.java +++ b/InCallUI/src/com/android/incallui/ConferenceManagerFragment.java @@ -16,14 +16,20 @@ package com.android.incallui; +import android.app.ActionBar; +import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Chronometer; +import android.widget.ImageView; import android.widget.TextView; +import com.android.contacts.common.ContactPhotoManager; +import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; + /** * Fragment for call control buttons */ @@ -32,9 +38,9 @@ public class ConferenceManagerFragment ConferenceManagerPresenter.ConferenceManagerUi> implements ConferenceManagerPresenter.ConferenceManagerUi { - private View mButtonManageConferenceDone; private ViewGroup[] mConferenceCallList; - private Chronometer mConferenceTime; + private int mActionBarElevation; + private ContactPhotoManager mContactPhotoManager; @Override ConferenceManagerPresenter createPresenter() { @@ -58,27 +64,19 @@ public class ConferenceManagerFragment final View parent = inflater.inflate(R.layout.conference_manager_fragment, container, false); - // set up the Conference Call chronometer - mConferenceTime = (Chronometer) parent.findViewById(R.id.manageConferencePanelHeader); - mConferenceTime.setFormat(getActivity().getString(R.string.caller_manage_header)); - // Create list of conference call widgets mConferenceCallList = new ViewGroup[getPresenter().getMaxCallersInConference()]; - final int[] viewGroupIdList = { R.id.caller0, R.id.caller1, R.id.caller2, R.id.caller3, R.id.caller4 }; for (int i = 0; i < getPresenter().getMaxCallersInConference(); i++) { - mConferenceCallList[i] = - (ViewGroup) parent.findViewById(viewGroupIdList[i]); + mConferenceCallList[i] = (ViewGroup) parent.findViewById(viewGroupIdList[i]); } - mButtonManageConferenceDone = parent.findViewById(R.id.manage_done); - mButtonManageConferenceDone.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - getPresenter().manageConferenceDoneClicked(); - } - }); + mContactPhotoManager = + ContactPhotoManager.getInstance(getActivity().getApplicationContext()); + + mActionBarElevation = + (int) getResources().getDimension(R.dimen.incall_action_bar_elevation); return parent; } @@ -90,13 +88,22 @@ public class ConferenceManagerFragment @Override public void setVisible(boolean on) { + ActionBar actionBar = getActivity().getActionBar(); + if (on) { + actionBar.setTitle(R.string.manageConferenceLabel); + actionBar.setElevation(mActionBarElevation); + actionBar.setHideOffset(0); + actionBar.show(); + final CallList calls = CallList.getInstance(); getPresenter().init(getActivity(), calls); getView().setVisibility(View.VISIBLE); - } else { getView().setVisibility(View.GONE); + + actionBar.setElevation(0); + actionBar.setHideOffset(actionBar.getHeight()); } } @@ -120,8 +127,10 @@ public class ConferenceManagerFragment */ @Override public final void displayCallerInfoForConferenceRow(int rowId, String callerName, - String callerNumber, String callerNumberType) { + String callerNumber, String callerNumberType, String lookupKey, Uri photoUri) { + final ImageView photoView = (ImageView) mConferenceCallList[rowId].findViewById( + R.id.callerPhoto); final TextView nameTextView = (TextView) mConferenceCallList[rowId].findViewById( R.id.conferenceCallerName); final TextView numberTextView = (TextView) mConferenceCallList[rowId].findViewById( @@ -129,6 +138,10 @@ public class ConferenceManagerFragment final TextView numberTypeTextView = (TextView) mConferenceCallList[rowId].findViewById( R.id.conferenceCallerNumberType); + DefaultImageRequest imageRequest = (photoUri != null) ? null : + new DefaultImageRequest(callerName, lookupKey, true /* isCircularPhoto */); + mContactPhotoManager.loadDirectoryPhoto(photoView, photoUri, false, true, imageRequest); + // set the caller name nameTextView.setText(callerName); @@ -148,50 +161,28 @@ public class ConferenceManagerFragment public final void setupEndButtonForRow(final int rowId) { View endButton = mConferenceCallList[rowId].findViewById(R.id.conferenceCallerDisconnect); endButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - getPresenter().endConferenceConnection(rowId); - } + @Override + public void onClick(View v) { + getPresenter().endConferenceConnection(rowId); + } }); } @Override - public final void setCanSeparateButtonForRow(final int rowId, boolean canSeparate) { - final View separateButton = mConferenceCallList[rowId].findViewById( - R.id.conferenceCallerSeparate); + public final void setupSeparateButtonForRow(final int rowId, boolean canSeparate) { + final View separateButton = + mConferenceCallList[rowId].findViewById(R.id.conferenceCallerSeparate); if (canSeparate) { - final View.OnClickListener separateThisConnection = new View.OnClickListener() { - @Override - public void onClick(View v) { - getPresenter().separateConferenceConnection(rowId); - } - }; - separateButton.setOnClickListener(separateThisConnection); + separateButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getPresenter().separateConferenceConnection(rowId); + } + }); separateButton.setVisibility(View.VISIBLE); } else { separateButton.setVisibility(View.INVISIBLE); } } - - /** - * Starts the "conference time" chronometer. - */ - @Override - public void startConferenceTime(long base) { - if (mConferenceTime != null) { - mConferenceTime.setBase(base); - mConferenceTime.start(); - } - } - - /** - * Stops the "conference time" chronometer. - */ - @Override - public void stopConferenceTime() { - if (mConferenceTime != null) { - mConferenceTime.stop(); - } - } }
\ No newline at end of file diff --git a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java index 2b5e8eb90..f40415ccd 100644 --- a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java +++ b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java @@ -17,6 +17,9 @@ package com.android.incallui; import android.content.Context; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.text.TextUtils; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.InCallPresenter.InCallState; @@ -128,25 +131,28 @@ public class ConferenceManagerPresenter // Activate this row of the Manage conference panel: getUi().setRowVisible(i, true); - final String name = contactCacheEntry.name; - final String number = contactCacheEntry.number; + String name = contactCacheEntry.name; + String number = contactCacheEntry.number; + + if (TextUtils.isEmpty(name)) { + name = number; + number = null; + } if (canSeparate) { - getUi().setCanSeparateButtonForRow(i, canSeparate); + getUi().setupSeparateButtonForRow(i, canSeparate); } // display the CallerInfo. getUi().setupEndButtonForRow(i); - getUi().displayCallerInfoForConferenceRow(i, name, number, contactCacheEntry.label); + + getUi().displayCallerInfoForConferenceRow(i, name, number, contactCacheEntry.label, + contactCacheEntry.lookupKey, contactCacheEntry.displayPhotoUri); } else { // Disable this row of the Manage conference panel: getUi().setRowVisible(i, false); } } - public void manageConferenceDoneClicked() { - getUi().setVisible(false); - } - public int getMaxCallersInConference() { return MAX_CALLERS_IN_CONFERENCE; } @@ -168,10 +174,8 @@ public class ConferenceManagerPresenter boolean isFragmentVisible(); void setRowVisible(int rowId, boolean on); void displayCallerInfoForConferenceRow(int rowId, String callerName, String callerNumber, - String callerNumberType); - void setCanSeparateButtonForRow(int rowId, boolean canSeparate); + String callerNumberType, String lookupKey, Uri photoUri); + void setupSeparateButtonForRow(int rowId, boolean canSeparate); void setupEndButtonForRow(int rowId); - void startConferenceTime(long base); - void stopConferenceTime(); } } diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index ccf5b794b..488e55bfc 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -328,6 +328,8 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } cce.photo = photo; + cce.lookupKey = info.lookupKeyOrNull; + return cce; } @@ -503,6 +505,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete /** Either a display photo or a thumbnail URI. */ public Uri displayPhotoUri; public Uri lookupUri; // Sent to NotificationMananger + public String lookupKey; @Override public String toString() { diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java index e15f1bccb..6cb5d1f8f 100644 --- a/InCallUI/src/com/android/incallui/DialpadFragment.java +++ b/InCallUI/src/com/android/incallui/DialpadFragment.java @@ -46,8 +46,6 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese implements DialpadPresenter.DialpadUi, View.OnTouchListener, View.OnKeyListener, View.OnHoverListener, View.OnClickListener { - private static final float DIALPAD_SLIDE_FRACTION = 1.0f; - private static final int ACCESSIBILITY_DTMF_STOP_DELAY_MILLIS = 50; /** diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index f09203369..95cc0d7db 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; import android.app.FragmentManager; @@ -29,6 +30,7 @@ import android.graphics.Point; import android.os.Bundle; import android.telephony.DisconnectCause; import android.text.TextUtils; +import android.view.MenuItem; import android.view.ViewTreeObserver; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -110,7 +112,14 @@ public class InCallActivity extends Activity { getWindow().addFlags(flags); - requestWindowFeature(Window.FEATURE_NO_TITLE); + // Setup action bar for the conference call manager. + requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); + ActionBar actionBar = getActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.hide(); + } // TODO(klp): Do we need to add this back when prox sensor is not available? // lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY; @@ -317,6 +326,16 @@ public class InCallActivity extends Activity { } @Override + public boolean onOptionsItemSelected(MenuItem item) { + final int itemId = item.getItemId(); + if (itemId == android.R.id.home) { + onBackPressed(); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { // push input to the dialer. if (mDialpadFragment != null && (mDialpadFragment.isVisible()) && diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 637ac16ed..20cc695ce 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -406,7 +406,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { Bitmap largeIcon = null; if (isConference) { largeIcon = BitmapFactory.decodeResource(mContext.getResources(), - R.drawable.picture_conference); + R.drawable.img_conference); } if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) { largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap(); |