summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamaljeet Maini <kmaini@cyngn.com>2016-03-14 15:14:42 -0700
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-08 10:29:35 -0700
commit7ae53c9c288486880976cf8e09d2941ada0e77f2 (patch)
tree5dc25226dbf4fd2d65cd625d978598a6a755b2b0
parent25cd7bfe66534ee3dbf1aad7ca646bec3b6c702a (diff)
downloadandroid_packages_apps_InCallUI-7ae53c9c288486880976cf8e09d2941ada0e77f2.tar.gz
android_packages_apps_InCallUI-7ae53c9c288486880976cf8e09d2941ada0e77f2.tar.bz2
android_packages_apps_InCallUI-7ae53c9c288486880976cf8e09d2941ada0e77f2.zip
Port VoLTE support from InCallUINext to InCallUI
Modified call card fragment to show VoLTE label when call is made using VoLTE Change-Id: I14621c43608afa99e2737d887ab0d7154863f74b Issue-Id: DIALER-720
-rw-r--r--res/layout/call_card_fragment.xml22
-rw-r--r--res/values/dimens.xml4
-rw-r--r--src/com/android/incallui/CallCardFragment.java12
-rw-r--r--src/com/android/incallui/CallCardPresenter.java28
4 files changed, 66 insertions, 0 deletions
diff --git a/res/layout/call_card_fragment.xml b/res/layout/call_card_fragment.xml
index c9b1bbb3..ef40b1f4 100644
--- a/res/layout/call_card_fragment.xml
+++ b/res/layout/call_card_fragment.xml
@@ -43,6 +43,28 @@
android:clipChildren="false"
android:clipToPadding="false">
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:clipChildren="false"
+ android:gravity="right"
+ android:paddingEnd="@dimen/call_banner_side_padding"
+ android:paddingTop="@dimen/incall_volte_label_top_padding"
+ android:clipToPadding="false">
+
+ <!-- VoLTE annunciator. Visible or gone depending on whether
+ VoLTE is in use. Carriers may customize this annunciator
+ by overlaying the ic_volte.xml drawable. -->
+ <ImageView android:id="@+id/volte_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAlignment="viewEnd"
+ android:tint="@color/incall_accent_color"
+ android:src="@drawable/ic_volte"
+ android:visibility="gone" />
+
+ </LinearLayout>
+
<include layout="@layout/primary_call_info" />
<fragment android:name="com.android.incallui.CallButtonFragment"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d99f2ed4..96af0e53 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -126,4 +126,8 @@
<dimen name="conference_call_manager_padding_top">64dp</dimen>
<dimen name="conference_call_manager_button_dimension">46dp</dimen>
+
+ <!-- Padding at the top of VoLTE label" -->
+ <dimen name="incall_volte_label_top_padding">5dp</dimen>
+
</resources>
diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java
index 78d18534..498d13aa 100644
--- a/src/com/android/incallui/CallCardFragment.java
+++ b/src/com/android/incallui/CallCardFragment.java
@@ -125,6 +125,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private TextView mElapsedTime;
private Drawable mPrimaryPhotoDrawable;
private TextView mCallSubject;
+ private ImageView mVolteCallLabel;
// Container view that houses the entire primary call card, including the call buttons
private View mPrimaryCallCardContainer;
@@ -334,6 +335,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mSpamInfoView = (TextView) view.findViewById(R.id.spamInfo);
mPhotoContainer = view.findViewById(R.id.call_card_content);
+ mVolteCallLabel = (ImageView) view.findViewById(R.id.volte_label);
+
mRecordingTimeLabel = (TextView) view.findViewById(R.id.recordingTime);
mRecordingIcon = (TextView) view.findViewById(R.id.recordingIcon);
@@ -407,6 +410,15 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
});
}
+ @Override
+ public void setVolteCallLabel(boolean show) {
+ if (show) {
+ mVolteCallLabel.setVisibility(View.VISIBLE);
+ } else {
+ mVolteCallLabel.setVisibility(View.GONE);
+ }
+ }
+
private void doActionOnPredraw(final boolean visible, final boolean isLayoutRtl,
final View videoView, final float spaceBesideCallCard) {
diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java
index 355b0b15..b0e83b7c 100644
--- a/src/com/android/incallui/CallCardPresenter.java
+++ b/src/com/android/incallui/CallCardPresenter.java
@@ -44,6 +44,7 @@ import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
import com.android.incallui.InCallPresenter.IncomingCallListener;
import com.android.incalluibind.ObjectFactory;
+import com.android.phone.common.util.VolteUtils;
import com.cyanogen.lookup.phonenumber.response.StatusCode;
import com.google.common.base.Preconditions;
@@ -302,6 +303,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
false /* isConference */,
false /* isWaitingForRemoteSide */);
getUi().showHdAudioIndicator(false);
+ getUi().setVolteCallLabel(false);
}
maybeShowManageConferenceCallButton();
@@ -405,6 +407,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
mPrimary.isWaitingForRemoteSide());
maybeShowHdAudioIcon();
+ maybeShowVolteLabel();
setCallbackNumber();
}
}
@@ -421,6 +424,16 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
/**
+ * Show VoLTE label if call is active and made over VoLTE
+ */
+ private void maybeShowVolteLabel() {
+ int subId = getSubscriptionId();
+ boolean showVolte = isPrimaryCallActive() && (subId > 0) &&
+ VolteUtils.isVolteInUse(mContext, subId);
+ getUi().setVolteCallLabel(showVolte);
+ }
+
+ /**
* Only show the conference call button if we can manage the conference.
*/
private void maybeShowManageConferenceCallButton() {
@@ -627,6 +640,20 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return retval;
}
+ private int getSubscriptionId() {
+ PhoneAccountHandle accountHandle = mPrimary.getAccountHandle();
+ if (accountHandle != null) {
+ try{
+ return Integer.parseInt(accountHandle.getId());
+ } catch (NumberFormatException ex) {
+ // handle id is not an int, device might not have sim in it
+ Log.w(TAG, "Unable to parse phone account handle " + accountHandle.getId() + " as" +
+ " an int");
+ }
+ }
+ return 0;
+ }
+
private void updatePrimaryDisplayInfo() {
final CallCardUi ui = getUi();
if (ui == null) {
@@ -1046,5 +1073,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
void animateForNewOutgoingCall();
void sendAccessibilityAnnouncement();
void showNoteSentToast();
+ void setVolteCallLabel(boolean show);
}
}