diff options
author | Makoto Onuki <omakoto@google.com> | 2013-09-13 00:44:08 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-13 00:44:08 +0000 |
commit | ac29dcf0c836e1e47fb0e47617444d38724fecdd (patch) | |
tree | a27d4b4fd85533c1849d79a88588b69cb129052a | |
parent | 06c60d8dab3ab7f533a50b4fdede1418a1e21486 (diff) | |
parent | ad4f3ea753b6dc43b1a82110c9fdf505966e74fb (diff) |
Merge "Show "Calling via google voice" only in the DIALING state." into klp-dev
-rw-r--r-- | InCallUI/res/layout/primary_call_info.xml | 2 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 61 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 21 |
3 files changed, 41 insertions, 43 deletions
diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml index 681519b76..fd8b83a14 100644 --- a/InCallUI/res/layout/primary_call_info.xml +++ b/InCallUI/res/layout/primary_call_info.xml @@ -167,7 +167,7 @@ android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="@color/incall_call_banner_text_color" android:textAllCaps="true" - android:background="@color/incall_secondary_info_background" + android:background="@android:color/transparent" android:singleLine="true" android:ellipsize="end"/> </LinearLayout> diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 9c772cb05..d96e41124 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -167,20 +167,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } @Override - public void setPrimaryGateway(String gatewayLabel, String gatewayNumber) { - if (!TextUtils.isEmpty(gatewayLabel) && !TextUtils.isEmpty(gatewayNumber)) { - mProviderLabel.setText(gatewayLabel); - mProviderNumber.setText(gatewayNumber); - mProviderInfo.setVisibility(View.VISIBLE); - } else { - mProviderInfo.setVisibility(View.GONE); - } - } - - @Override public void setPrimary(String number, String name, boolean nameIsNumber, String label, - Drawable photo, boolean isConference, String gatewayLabel, String gatewayNumber) { - Log.d(this, "Setting primary call [" + gatewayLabel + "][" + gatewayNumber + "]"); + Drawable photo, boolean isConference) { + Log.d(this, "Setting primary call"); if (isConference) { name = getView().getResources().getString(R.string.card_title_conf_call); @@ -190,9 +179,6 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr setPrimaryPhoneNumber(number); - // Set any gateway information - setPrimaryGateway(gatewayLabel, gatewayNumber); - // set the name field. setPrimaryName(name, nameIsNumber); @@ -236,7 +222,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } @Override - public void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn) { + public void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn, + String gatewayLabel, String gatewayNumber) { String callStateLabel = null; // States other than disconnected not yet supported @@ -245,25 +232,23 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr Log.v(this, "setCallState ", callStateLabel); Log.v(this, "DisconnectCause ", cause); Log.v(this, "bluetooth on ", bluetoothOn); + Log.v(this, "gateway " + gatewayLabel + gatewayNumber); + + // There are cases where we totally skip the animation, in which case remove the transition + // animation here and restore it afterwards. + final boolean skipAnimation = (state == Call.State.DIALING + || state == Call.State.DISCONNECTED); + LayoutTransition transition = null; + if (skipAnimation) { + transition = mSupplementaryInfoContainer.getLayoutTransition(); + mSupplementaryInfoContainer.setLayoutTransition(null); + } + // Update the call state label. if (!TextUtils.isEmpty(callStateLabel)) { - // There are cases where we totally skip the animation - final boolean skipAnimation = (state == Call.State.DIALING - || state == Call.State.DISCONNECTED); - - LayoutTransition transition = null; - if (skipAnimation) { - transition = mSupplementaryInfoContainer.getLayoutTransition(); - mSupplementaryInfoContainer.setLayoutTransition(null); - } - mCallStateLabel.setVisibility(View.VISIBLE); mCallStateLabel.setText(callStateLabel); - if (skipAnimation) { - mSupplementaryInfoContainer.setLayoutTransition(transition); - } - if (Call.State.INCOMING == state) { setBluetoothOn(bluetoothOn); } @@ -278,6 +263,20 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mCallStateLabel.setGravity(Gravity.END); } } + + // Provider info: (e.g. "Calling via <gatewayLabel>") + if (!TextUtils.isEmpty(gatewayLabel) && !TextUtils.isEmpty(gatewayNumber)) { + mProviderLabel.setText(gatewayLabel); + mProviderNumber.setText(gatewayNumber); + mProviderInfo.setVisibility(View.VISIBLE); + } else { + mProviderInfo.setVisibility(View.GONE); + } + + // Restore the animation. + if (skipAnimation) { + mSupplementaryInfoContainer.setLayoutTransition(transition); + } } @Override diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 6c8056bd6..f56d4e1e0 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -188,9 +188,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> if (mPrimary != null) { final boolean bluetoothOn = (AudioModeProvider.getInstance().getAudioMode() == AudioMode.BLUETOOTH); - ui.setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn); + ui.setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn, + getGatewayLabel(), getGatewayNumber()); } else { - ui.setCallState(Call.State.IDLE, Call.DisconnectCause.UNKNOWN, false); + ui.setCallState(Call.State.IDLE, Call.DisconnectCause.UNKNOWN, false, null, null); } } @@ -199,7 +200,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> if (mPrimary != null && getUi() != null) { final boolean bluetoothOn = (AudioMode.BLUETOOTH == mode); - getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn); + getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn, + getGatewayLabel(), getGatewayNumber()); } } @@ -350,15 +352,12 @@ 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); - final String gatewayLabel = getGatewayLabel(); - final String gatewayNumber = getGatewayNumber(); ui.setPrimary(number, name, nameIsNumber, entry.label, - entry.photo, isConference, gatewayLabel, - gatewayNumber); + entry.photo, isConference); } else { // reset to nothing (like at end of call) - ui.setPrimary(null, null, false, null, null, false, null, null); + ui.setPrimary(null, null, false, null, null, false); } } @@ -506,16 +505,16 @@ 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, String gatewayLabel, String gatewayNumber); + Drawable photo, boolean isConference); void setSecondary(boolean show, String name, boolean nameIsNumber, String label, Drawable photo, boolean isConference); void setSecondaryImage(Bitmap bitmap); - void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn); + void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn, + String gatewayLabel, String gatewayNumber); void setPrimaryCallElapsedTime(boolean show, String duration); void setPrimaryName(String name, boolean nameIsNumber); void setPrimaryImage(Bitmap bitmap); void setPrimaryPhoneNumber(String phoneNumber); void setPrimaryLabel(String label); - void setPrimaryGateway(String label, String number); } } |