diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-03-10 02:23:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-10 02:23:46 +0000 |
commit | d5514615336a16a83b885c4c18bcbcddccdf9407 (patch) | |
tree | fb855d25b3e7ea777beaa7de19ab729c977ef0e5 /java/com/android/incallui | |
parent | 4093c4fcbb9fb519c90eac618ed6d6fe0fdd4cec (diff) | |
parent | 48f93f40f66f5695cdb370af679db4580cebb641 (diff) |
Merge changes Ieab3ee3f,I4b917d8a
* changes:
Remove bubble "new" prefix.
Dismiss keyboard when opening overflow menu in RTT call.
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r-- | java/com/android/incallui/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | java/com/android/incallui/InCallServiceImpl.java | 14 | ||||
-rw-r--r-- | java/com/android/incallui/ReturnToCallActionReceiver.java (renamed from java/com/android/incallui/NewReturnToCallActionReceiver.java) | 2 | ||||
-rw-r--r-- | java/com/android/incallui/ReturnToCallController.java (renamed from java/com/android/incallui/NewReturnToCallController.java) | 69 | ||||
-rw-r--r-- | java/com/android/incallui/StatusBarNotifier.java | 4 | ||||
-rw-r--r-- | java/com/android/incallui/rtt/impl/RttChatFragment.java | 20 |
6 files changed, 53 insertions, 58 deletions
diff --git a/java/com/android/incallui/AndroidManifest.xml b/java/com/android/incallui/AndroidManifest.xml index a45330b73..1b5f09973 100644 --- a/java/com/android/incallui/AndroidManifest.xml +++ b/java/com/android/incallui/AndroidManifest.xml @@ -115,7 +115,7 @@ <receiver android:exported="false" - android:name=".NewReturnToCallActionReceiver"/> + android:name=".ReturnToCallActionReceiver"/> </application> diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java index a7095f818..959f13f2e 100644 --- a/java/com/android/incallui/InCallServiceImpl.java +++ b/java/com/android/incallui/InCallServiceImpl.java @@ -40,7 +40,7 @@ import com.android.incallui.speakeasy.SpeakEasyComponent; */ public class InCallServiceImpl extends InCallService { - private NewReturnToCallController newReturnToCallController; + private ReturnToCallController returnToCallController; private CallList.Listener feedbackListener; // We only expect there to be one speakEasyCallManager to be instantiated at a time. // We did not use a singleton SpeakEasyCallManager to avoid holding on to state beyond the @@ -111,9 +111,9 @@ public class InCallServiceImpl extends InCallService { InCallPresenter.getInstance().onServiceBind(); InCallPresenter.getInstance().maybeStartRevealAnimation(intent); TelecomAdapter.getInstance().setInCallService(this); - if (NewReturnToCallController.isEnabled(this)) { - newReturnToCallController = - new NewReturnToCallController(this, ContactInfoCache.getInstance(context)); + if (ReturnToCallController.isEnabled(this)) { + returnToCallController = + new ReturnToCallController(this, ContactInfoCache.getInstance(context)); } feedbackListener = FeedbackComponent.get(context).getCallFeedbackListener(); CallList.getInstance().addListener(feedbackListener); @@ -141,9 +141,9 @@ public class InCallServiceImpl extends InCallService { // Tear down the InCall system InCallPresenter.getInstance().tearDown(); TelecomAdapter.getInstance().clearInCallService(); - if (newReturnToCallController != null) { - newReturnToCallController.tearDown(); - newReturnToCallController = null; + if (returnToCallController != null) { + returnToCallController.tearDown(); + returnToCallController = null; } if (feedbackListener != null) { CallList.getInstance().removeListener(feedbackListener); diff --git a/java/com/android/incallui/NewReturnToCallActionReceiver.java b/java/com/android/incallui/ReturnToCallActionReceiver.java index 527a79b51..d6014aac6 100644 --- a/java/com/android/incallui/NewReturnToCallActionReceiver.java +++ b/java/com/android/incallui/ReturnToCallActionReceiver.java @@ -30,7 +30,7 @@ import com.android.incallui.call.DialerCall; import com.android.incallui.call.TelecomAdapter; /** Handles clicks on the return-to-call bubble */ -public class NewReturnToCallActionReceiver extends BroadcastReceiver { +public class ReturnToCallActionReceiver extends BroadcastReceiver { public static final String ACTION_RETURN_TO_CALL = "returnToCallV2"; public static final String ACTION_TOGGLE_SPEAKER = "toggleSpeakerV2"; diff --git a/java/com/android/incallui/NewReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java index e77920524..6227c77bd 100644 --- a/java/com/android/incallui/NewReturnToCallController.java +++ b/java/com/android/incallui/ReturnToCallController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,10 @@ import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import android.telecom.CallAudioState; import android.text.TextUtils; +import com.android.bubble.Bubble; +import com.android.bubble.BubbleComponent; +import com.android.bubble.BubbleInfo; +import com.android.bubble.BubbleInfo.Action; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; @@ -41,10 +45,6 @@ import com.android.incallui.call.CallList.Listener; import com.android.incallui.call.DialerCall; import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo; import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo.IconSize; -import com.android.newbubble.NewBubble; -import com.android.newbubble.NewBubbleComponent; -import com.android.newbubble.NewBubbleInfo; -import com.android.newbubble.NewBubbleInfo.Action; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @@ -59,12 +59,12 @@ import java.util.List; * <p>Bubble hides when one of following happens: 1. a call disconnect and there is no more * outgoing/ongoing call 2. show in-call UI */ -public class NewReturnToCallController implements InCallUiListener, Listener, AudioModeListener { +public class ReturnToCallController implements InCallUiListener, Listener, AudioModeListener { private final Context context; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - NewBubble bubble; + Bubble bubble; private static Boolean canShowBubblesForTesting = null; @@ -82,16 +82,16 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au return ConfigProviderBindings.get(context).getBoolean("enable_return_to_call_bubble_v2", false); } - public NewReturnToCallController(Context context, ContactInfoCache contactInfoCache) { + public ReturnToCallController(Context context, ContactInfoCache contactInfoCache) { this.context = context; this.contactInfoCache = contactInfoCache; - toggleSpeaker = createActionIntent(NewReturnToCallActionReceiver.ACTION_TOGGLE_SPEAKER); + toggleSpeaker = createActionIntent(ReturnToCallActionReceiver.ACTION_TOGGLE_SPEAKER); showSpeakerSelect = - createActionIntent(NewReturnToCallActionReceiver.ACTION_SHOW_AUDIO_ROUTE_SELECTOR); - toggleMute = createActionIntent(NewReturnToCallActionReceiver.ACTION_TOGGLE_MUTE); - endCall = createActionIntent(NewReturnToCallActionReceiver.ACTION_END_CALL); - fullScreen = createActionIntent(NewReturnToCallActionReceiver.ACTION_RETURN_TO_CALL); + createActionIntent(ReturnToCallActionReceiver.ACTION_SHOW_AUDIO_ROUTE_SELECTOR); + toggleMute = createActionIntent(ReturnToCallActionReceiver.ACTION_TOGGLE_MUTE); + endCall = createActionIntent(ReturnToCallActionReceiver.ACTION_END_CALL); + fullScreen = createActionIntent(ReturnToCallActionReceiver.ACTION_RETURN_TO_CALL); InCallPresenter.getInstance().addInCallUiListener(this); CallList.getInstance().addListener(this); @@ -156,12 +156,12 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au } @VisibleForTesting - public NewBubble startBubble() { + public Bubble startBubble() { if (!canShowBubbles(context)) { - LogUtil.i("ReturnToCallController.startNewBubble", "can't show bubble, no permission"); + LogUtil.i("ReturnToCallController.startBubble", "can't show bubble, no permission"); return null; } - NewBubble returnToCallBubble = NewBubbleComponent.get(context).getNewBubble(); + Bubble returnToCallBubble = BubbleComponent.get(context).getBubble(); returnToCallBubble.setBubbleInfo(generateBubbleInfo()); returnToCallBubble.show(); return returnToCallBubble; @@ -181,7 +181,7 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au if ((bubble == null || !bubble.isVisible()) && getCall() != null && !InCallPresenter.getInstance().isShowingInCallUi()) { - LogUtil.i("NewReturnToCallController.onCallListChange", "going to show bubble"); + LogUtil.i("ReturnToCallController.onCallListChange", "going to show bubble"); show(); } } @@ -248,8 +248,8 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au } } - private NewBubbleInfo generateBubbleInfo() { - return NewBubbleInfo.builder() + private BubbleInfo generateBubbleInfo() { + return BubbleInfo.builder() .setPrimaryColor(context.getResources().getColor(R.color.dialer_theme_color, null)) .setPrimaryIcon(Icon.createWithResource(context, R.drawable.on_going_call)) .setStartingYPosition( @@ -306,7 +306,7 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au @NonNull private PendingIntent createActionIntent(String action) { - Intent intent = new Intent(context, NewReturnToCallActionReceiver.class); + Intent intent = new Intent(context, ReturnToCallActionReceiver.class); intent.setAction(action); return PendingIntent.getBroadcast(context, 0, intent, 0); } @@ -339,45 +339,42 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au private static class ReturnToCallContactInfoCacheCallback implements ContactInfoCacheCallback { - private final WeakReference<NewReturnToCallController> newReturnToCallControllerWeakReference; + private final WeakReference<ReturnToCallController> returnToCallControllerWeakReference; - private ReturnToCallContactInfoCacheCallback( - NewReturnToCallController newReturnToCallController) { - newReturnToCallControllerWeakReference = new WeakReference<>(newReturnToCallController); + private ReturnToCallContactInfoCacheCallback(ReturnToCallController returnToCallController) { + returnToCallControllerWeakReference = new WeakReference<>(returnToCallController); } @Override public void onContactInfoComplete(String callId, ContactCacheEntry entry) { - NewReturnToCallController newReturnToCallController = - newReturnToCallControllerWeakReference.get(); - if (newReturnToCallController == null) { + ReturnToCallController returnToCallController = returnToCallControllerWeakReference.get(); + if (returnToCallController == null) { return; } if (entry.photo != null) { - newReturnToCallController.onPhotoAvatarReceived(entry.photo); + returnToCallController.onPhotoAvatarReceived(entry.photo); } else { DialerCall dialerCall = CallList.getInstance().getCallById(callId); if (dialerCall != null) { - newReturnToCallController.onLetterTileAvatarReceived( - newReturnToCallController.createLettleTileDrawable(dialerCall, entry)); + returnToCallController.onLetterTileAvatarReceived( + returnToCallController.createLettleTileDrawable(dialerCall, entry)); } } } @Override public void onImageLoadComplete(String callId, ContactCacheEntry entry) { - NewReturnToCallController newReturnToCallController = - newReturnToCallControllerWeakReference.get(); - if (newReturnToCallController == null) { + ReturnToCallController returnToCallController = returnToCallControllerWeakReference.get(); + if (returnToCallController == null) { return; } if (entry.photo != null) { - newReturnToCallController.onPhotoAvatarReceived(entry.photo); + returnToCallController.onPhotoAvatarReceived(entry.photo); } else { DialerCall dialerCall = CallList.getInstance().getCallById(callId); if (dialerCall != null) { - newReturnToCallController.onLetterTileAvatarReceived( - newReturnToCallController.createLettleTileDrawable(dialerCall, entry)); + returnToCallController.onLetterTileAvatarReceived( + returnToCallController.createLettleTileDrawable(dialerCall, entry)); } } } diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 87f332a1d..e2340b5e7 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -657,8 +657,8 @@ public class StatusBarNotifier } else if (call.hasProperty(Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY)) { return R.drawable.quantum_ic_phone_locked_vd_theme_24; } - // If NewReturnToCall is enabled, use the static icon. The animated one will show in the bubble. - if (NewReturnToCallController.isEnabled(context)) { + // If ReturnToCall is enabled, use the static icon. The animated one will show in the bubble. + if (ReturnToCallController.isEnabled(context)) { return R.drawable.quantum_ic_call_vd_theme_24; } else { return R.drawable.on_going_call; diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java index 9e8a24a48..e35ff4d73 100644 --- a/java/com/android/incallui/rtt/impl/RttChatFragment.java +++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java @@ -37,7 +37,6 @@ import android.view.ViewGroup; import android.view.Window; import android.view.accessibility.AccessibilityEvent; import android.view.inputmethod.EditorInfo; -import android.view.inputmethod.InputMethodManager; import android.widget.Chronometer; import android.widget.EditText; import android.widget.ImageButton; @@ -46,6 +45,7 @@ import android.widget.TextView.OnEditorActionListener; import com.android.dialer.common.Assert; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.common.UiUtil; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; import com.android.incallui.call.DialerCall.State; @@ -87,7 +87,7 @@ public class RttChatFragment extends Fragment @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy < 0) { - hideKeyboard(); + UiUtil.hideKeyboardFrom(getContext(), editText); } } }; @@ -182,7 +182,13 @@ public class RttChatFragment extends Fragment overflowMenu = new RttOverflowMenu(getContext(), inCallButtonUiDelegate); view.findViewById(R.id.rtt_overflow_button) - .setOnClickListener(v -> overflowMenu.showAtLocation(v, Gravity.TOP | Gravity.RIGHT, 0, 0)); + .setOnClickListener( + v -> { + // Hide keyboard when opening overflow menu. This is alternative solution since hiding + // keyboard after the menu is open or dialpad is shown doesn't work. + UiUtil.hideKeyboardFrom(getContext(), editText); + overflowMenu.showAtLocation(v, Gravity.TOP | Gravity.RIGHT, 0, 0); + }); nameTextView = view.findViewById(R.id.rtt_name_or_number); chronometer = view.findViewById(R.id.rtt_timer); @@ -265,14 +271,6 @@ public class RttChatFragment extends Fragment onRttScreenStop(); } - private void hideKeyboard() { - InputMethodManager inputMethodManager = getContext().getSystemService(InputMethodManager.class); - if (inputMethodManager.isAcceptingText()) { - inputMethodManager.hideSoftInputFromWindow( - getActivity().getCurrentFocus().getWindowToken(), 0); - } - } - @Override public void onRttScreenStart() { rttCallScreenDelegate.onRttCallScreenUiReady(); |