summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/res/layout/primary_call_info.xml27
-rw-r--r--InCallUI/res/values/strings.xml5
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java98
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java52
4 files changed, 112 insertions, 70 deletions
diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml
index ef48a506f..ed0ae54ad 100644
--- a/InCallUI/res/layout/primary_call_info.xml
+++ b/InCallUI/res/layout/primary_call_info.xml
@@ -119,29 +119,48 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
- android:orientation="vertical"
+ android:orientation="horizontal"
android:background="@color/incall_secondary_info_background"
android:animateLayoutChanges="true">
+ <TextView android:id="@+id/callServiceLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/provider_info_top_bottom_padding"
+ android:paddingBottom="@dimen/provider_info_top_bottom_padding"
+ android:paddingStart="@dimen/call_banner_side_padding"
+ android:paddingEnd="@dimen/call_banner_side_padding"
+ android:gravity="start|center_vertical"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/incall_call_banner_text_color"
+ android:background="@android:color/transparent"
+ android:singleLine="true"
+ android:ellipsize="end" />
+
+ <View android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
<!-- The "call state label": In some states, this shows a special
indication like "Dialing" or "Incoming call" or "Call ended".
It's unused for the normal case of an active ongoing call. -->
<TextView android:id="@+id/callStateLabel"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/provider_info_top_bottom_padding"
android:paddingBottom="@dimen/provider_info_top_bottom_padding"
android:paddingStart="@dimen/call_banner_side_padding"
android:paddingEnd="@dimen/call_banner_side_padding"
- android:gravity="end"
+ android:gravity="end|center_vertical"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/incall_call_banner_text_color"
android:textAllCaps="true"
android:background="@android:color/transparent"
android:singleLine="true"
- android:ellipsize="end"/>
+ android:ellipsize="end" />
<Button android:id="@+id/connectionHandoffButton"
+ android:gravity="end|center_vertical"
android:text="@string/connection_handoff_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index 2ea1e757b..ba7442f80 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -312,7 +312,7 @@
<!-- Canned response for the "Respond via SMS" feature for incoming calls. [CHAR LIMIT=35] -->
<string name="respond_via_sms_canned_response_4">Can\'t talk now. Call me later?</string>
<!-- "Respond via SMS" option that lets you compose a custom response. [CHAR LIMIT=30] -->
- <string name="respond_via_sms_custom_message">Write your own...</string>
+ <string name="respond_via_sms_custom_message">Write your own&#8230;</string>
<!-- "Custom Message" Cancel alert dialog button -->
<string name="custom_message_cancel">Cancel</string>
<!-- "Custom Message" Send alert dialog button -->
@@ -518,7 +518,8 @@
<!-- This can be used in any application wanting to disable the text "Emergency number" -->
<string name="emergency_call_dialog_number_for_display">Emergency number</string>
- <string name="in_call_wifi_connected">Connected via <xliff:g id="wifi_ssid">%s</xliff:g></string>
+ <string name="in_call_wifi_connected">Connected via Wi-Fi</string>
+ <string name="handoff_status_pending">Handoff pending&#8230;</string>
<!-- The digit to be displayed on the 0 key of the dialpad [CHAR LIMIT=1]-->
<string name="dialpad_0_number">0</string>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 984b73a15..090820c47 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -47,6 +47,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private TextView mPhoneNumber;
private TextView mNumberLabel;
private TextView mPrimaryName;
+ private TextView mCallServiceLabel;
private TextView mCallStateLabel;
private TextView mCallTypeLabel;
private ImageView mPhoto;
@@ -107,6 +108,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mNumberLabel = (TextView) view.findViewById(R.id.label);
mSecondaryCallInfo = (ViewStub) view.findViewById(R.id.secondary_call_info);
mPhoto = (ImageView) view.findViewById(R.id.photo);
+ mCallServiceLabel = (TextView) view.findViewById(R.id.callServiceLabel);
mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
mCallTypeLabel = (TextView) view.findViewById(R.id.callTypeLabel);
mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime);
@@ -131,12 +133,6 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
@Override
- public void setShowConnectionHandoff(boolean showConnectionHandoff) {
- Log.v(this, "setShowConnectionHandoff: " + showConnectionHandoff);
- mConnectionHandoffButton.setVisibility(showConnectionHandoff ? View.VISIBLE : View.GONE);
- }
-
- @Override
public void setPrimaryName(String name, boolean nameIsNumber) {
if (TextUtils.isEmpty(name)) {
mPrimaryName.setText("");
@@ -241,18 +237,29 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
@Override
- public void setCallState(int state, int cause, boolean bluetoothOn,
- String gatewayLabel, String gatewayNumber, String wifiConnection) {
- String callStateLabel = null;
+ public void setCallState(int state, int cause, boolean bluetoothOn, String gatewayLabel,
+ String gatewayNumber, boolean isWiFi, boolean isHandoffCapable,
+ boolean isHandoffPending) {
+ String callStateText = null;
if (Call.State.isDialing(state) && !TextUtils.isEmpty(gatewayLabel)) {
// Provider info: (e.g. "Calling via <gatewayLabel>")
- callStateLabel = gatewayLabel;
+ callStateText = gatewayLabel;
} else {
- callStateLabel = getCallStateLabelFromState(state, cause);
+ callStateText = getCallStateLabelFromState(state, cause);
+ }
+
+ // Only show call service related text if call state is not being displayed.
+ String callServiceText = null;
+ if (TextUtils.isEmpty(callStateText)) {
+ if (isHandoffPending) {
+ callServiceText = getResources().getString(R.string.handoff_status_pending);
+ } else if (isWiFi) {
+ callServiceText = getResources().getString(R.string.in_call_wifi_connected);
+ }
}
- Log.v(this, "setCallState " + callStateLabel);
+ Log.v(this, "setCallState " + callStateText);
Log.v(this, "DisconnectCause " + DisconnectCause.toString(cause));
Log.v(this, "bluetooth on " + bluetoothOn);
Log.v(this, "gateway " + gatewayLabel + gatewayNumber);
@@ -267,31 +274,57 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mSupplementaryInfoContainer.setLayoutTransition(null);
}
- // Update the call state label.
- if (!TextUtils.isEmpty(wifiConnection)) {
- mCallStateLabel.setText(getResources().getString(R.string.in_call_wifi_connected,
- wifiConnection));
- mCallStateLabel.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
- mCallStateLabel.setBackgroundResource(R.color.wifi_connected_background);
- mCallStateLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(
- R.drawable.ic_in_call_wifi, 0, 0, 0);
- mCallStateLabel.setCompoundDrawablePadding(5);
- mCallStateLabel.setAllCaps(false);
- mCallStateLabel.setVisibility(View.VISIBLE);
+ updateCallServiceLabel(isWiFi, callServiceText);
+ updateCallStateLabel(state, bluetoothOn, callStateText);
+
+ // Only show the handoff button if call state is not being displayed.
+ boolean showHandoffButton = isHandoffCapable && TextUtils.isEmpty(callStateText);
+ mConnectionHandoffButton.setVisibility(showHandoffButton ? View.VISIBLE : View.GONE);
+ mConnectionHandoffButton.setEnabled(!isHandoffPending);
- } else if (!TextUtils.isEmpty(callStateLabel)) {
- mCallStateLabel.setGravity(Gravity.END);
- mCallStateLabel.setAllCaps(true);
+ // Background color.
+ if (isWiFi) {
+ mSupplementaryInfoContainer.setBackgroundResource(R.color.wifi_connected_background);
+ } else {
+ mSupplementaryInfoContainer.setBackgroundResource(
+ R.color.incall_secondary_info_background);
+ }
+
+ // Restore the animation.
+ if (skipAnimation) {
+ mSupplementaryInfoContainer.setLayoutTransition(transition);
+ }
+ }
+
+ private void updateCallServiceLabel(boolean isWiFi, String text) {
+ if (!TextUtils.isEmpty(text)) {
+ mCallServiceLabel.setText(text);
+ if (isWiFi) {
+ mCallServiceLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ R.drawable.ic_in_call_wifi, 0, 0, 0);
+ mCallServiceLabel.setCompoundDrawablePadding(5);
+ mCallServiceLabel.setCompoundDrawablePadding((int) (mDensity * 5));
+ } else {
+ mCallServiceLabel.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
+ }
+ mCallServiceLabel.setVisibility(View.VISIBLE);
+ } else {
+ mCallServiceLabel.setText("");
+ mCallServiceLabel.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
+ mCallServiceLabel.setVisibility(View.GONE);
+ }
+ }
+
+ private void updateCallStateLabel(int state, boolean bluetoothOn, String text) {
+ if (!TextUtils.isEmpty(text)) {
mCallStateLabel.setVisibility(View.VISIBLE);
- mCallStateLabel.setText(callStateLabel);
- mCallStateLabel.setCompoundDrawables(null, null, null, null);
+ mCallStateLabel.setText(text);
+
if (Call.State.INCOMING == state) {
setBluetoothOn(bluetoothOn);
}
} else {
mCallStateLabel.setVisibility(View.GONE);
- mCallStateLabel.setCompoundDrawables(null, null, null, null);
-
// Gravity is aligned left when receiving an incoming call in landscape.
// In that rare case, the gravity needs to be reset to the right.
// Also, setText("") is used since there is a delay in making the view GONE,
@@ -301,11 +334,6 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mCallStateLabel.setGravity(Gravity.END);
}
}
-
- // Restore the animation.
- if (skipAnimation) {
- mSupplementaryInfoContainer.setLayoutTransition(transition);
- }
}
private void showInternetCallLabel(boolean show) {
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index a63c426b6..30639751c 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -21,8 +21,6 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.graphics.Bitmap;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
import android.telecomm.CallCapabilities;
import android.telecomm.CallServiceDescriptor;
import android.telephony.DisconnectCause;
@@ -56,6 +54,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
private ContactCacheEntry mSecondaryContactInfo;
private CallTimer mCallTimer;
private Context mContext;
+ private boolean mIsWiFiCachedValue;
public CallCardPresenter() {
// create the call timer
@@ -183,41 +182,36 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
ui.setPrimaryCallElapsedTime(false, null);
}
- // Set the call state
+ setUiCallState();
+ }
+
+ private void setUiCallState() {
if (mPrimary != null) {
- final boolean bluetoothOn =
+ boolean bluetoothOn =
(AudioModeProvider.getInstance().getAudioMode() == AudioMode.BLUETOOTH);
- ui.setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
- getGatewayLabel(), getGatewayNumber(), getWifiConnection());
+ boolean isHandoffCapable = mPrimary.can(CallCapabilities.CONNECTION_HANDOFF);
+ boolean isHandoffPending = mPrimary.getHandoffCallServiceDescriptor() != null;
+
+ CallServiceDescriptor descriptor = mPrimary.getCurrentCallServiceDescriptor();
+ boolean isWiFi = descriptor != null &&
+ descriptor.getNetworkType() == CallServiceDescriptor.FLAG_WIFI;
+ // Cache the value so the UI doesn't change when the call ends.
+ mIsWiFiCachedValue = isWiFi;
+
+ getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
+ getGatewayLabel(), getGatewayNumber(), isWiFi, isHandoffCapable,
+ isHandoffPending);
} else {
- ui.setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null, null);
+ getUi().setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null,
+ mIsWiFiCachedValue, false, false);
}
-
- ui.setShowConnectionHandoff(mPrimary != null &&
- mPrimary.can(CallCapabilities.CONNECTION_HANDOFF));
}
@Override
public void onAudioMode(int mode) {
if (mPrimary != null && getUi() != null) {
- final boolean bluetoothOn = (AudioMode.BLUETOOTH == mode);
-
- getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
- getGatewayLabel(), getGatewayNumber(), getWifiConnection());
- }
- }
-
- private String getWifiConnection() {
- CallServiceDescriptor descriptor = mPrimary.getCurrentCallServiceDescriptor();
- if (descriptor != null && descriptor.getNetworkType() == CallServiceDescriptor.FLAG_WIFI) {
- final WifiManager wifiManager = (WifiManager) mContext.getSystemService(
- Context.WIFI_SERVICE);
- final WifiInfo info = wifiManager.getConnectionInfo();
- if (info != null) {
- return info.getSSID();
- }
+ setUiCallState();
}
- return null;
}
@Override
@@ -489,12 +483,12 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
Drawable photo, boolean isConference, boolean isGeneric);
void setSecondaryImage(Drawable image);
void setCallState(int state, int cause, boolean bluetoothOn,
- String gatewayLabel, String gatewayNumber, String wifiConnection);
+ String gatewayLabel, String gatewayNumber, boolean isWiFi,
+ boolean isHandoffCapable, boolean isHandoffPending);
void setPrimaryCallElapsedTime(boolean show, String duration);
void setPrimaryName(String name, boolean nameIsNumber);
void setPrimaryImage(Drawable image);
void setPrimaryPhoneNumber(String phoneNumber);
void setPrimaryLabel(String label);
- void setShowConnectionHandoff(boolean showConnectionHandoff);
}
}