diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-16 18:31:39 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-16 18:46:24 -0700 |
commit | f53e15cf384e0e48df799bb2e6fbdd4d9445bf77 (patch) | |
tree | 37190f5ab6d1dffc84deaee0a0d7b92010f0fcbf | |
parent | 7418811be271669b5af68bbb96996f81d6798355 (diff) |
Update buttons state once UI is ready
* updateUi was not getting called for outgoing calls between
DIALING -> ACTIVE
* Adhere to UI directive that buttons representing disabled functionality
are hidden rather than disabled.
* Also fix issue where buttons are not updated for incoming call.
Bug: 20295789
Change-Id: I2606aa7b27c3dfb2de441737f1ecc2cc80ffdd7e
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonPresenter.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 43431c73c..1ff30c667 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -58,11 +58,16 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto AudioModeProvider.getInstance().addListener(this); // register for call state changes last - InCallPresenter.getInstance().addListener(this); - InCallPresenter.getInstance().addIncomingCallListener(this); - InCallPresenter.getInstance().addDetailsListener(this); - InCallPresenter.getInstance().addCanAddCallListener(this); - InCallPresenter.getInstance().getInCallCameraManager().addCameraSelectionListener(this); + final InCallPresenter inCallPresenter = InCallPresenter.getInstance(); + inCallPresenter.addListener(this); + inCallPresenter.addIncomingCallListener(this); + inCallPresenter.addDetailsListener(this); + inCallPresenter.addCanAddCallListener(this); + inCallPresenter.getInCallCameraManager().addCameraSelectionListener(this); + + // Update the buttons state immediately for the current call + onStateChange(InCallState.NO_CALLS, inCallPresenter.getInCallState(), + CallList.getInstance()); } @Override @@ -100,7 +105,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto if (ui != null) { ui.displayDialpad(false /* show */, true /* animate */); } - mCall = null; + mCall = callList.getIncomingCall(); } else { mCall = null; } @@ -336,17 +341,11 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto state.isConnectingOrConnected() &&!state.isIncoming() && call != null; ui.setEnabled(isEnabled); - if (!isEnabled) { + if (call == null) { return; } updateButtonsState(call); - - ui.enableButton(BUTTON_MUTE, call.can(android.telecom.Call.Details.CAPABILITY_MUTE)); - } - - private static int toInteger(boolean b) { - return b ? 1 : 0; } /** |