summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-04-18 20:17:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-18 20:17:13 +0000
commitb7b852a423f4c8b1be36271ca78af3e801ba0c2f (patch)
tree8f9b4f6c349f2e50d93e962323d89d7688a5b5d3
parent1cbcd2ffe78747a7092c727e87c7f26f077e7687 (diff)
parentf53e15cf384e0e48df799bb2e6fbdd4d9445bf77 (diff)
Merge "Update buttons state once UI is ready"
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java25
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 718dd52c7..82c576f79 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;
}
/**