diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/incallui/CallCardFragment.java | 12 | ||||
-rw-r--r-- | src/com/android/incallui/CallCardPresenter.java | 28 |
2 files changed, 40 insertions, 0 deletions
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); } } |