am 9be240fa: Replaces ToggleButtons with ImageButtons

* commit '9be240faad1857e122614a70fd6e632b143ddc41':
  Replaces ToggleButtons with ImageButtons
diff --git a/InCallUI/res/drawable/btn_compound_audio.xml b/InCallUI/res/drawable/btn_compound_audio.xml
index c348c98..5d36494 100644
--- a/InCallUI/res/drawable/btn_compound_audio.xml
+++ b/InCallUI/res/drawable/btn_compound_audio.xml
@@ -37,7 +37,7 @@
          (In states where the audio button *not* a toggle, we explicitly
          hide this layer.) -->
     <item android:id="@+id/compoundBackgroundItem"
-          android:drawable="@drawable/btn_compound_background" />
+          android:drawable="@drawable/btn_fake_compound_background" />
 
     <!-- The little triangle that indicates that this isn't a plain
          button, but will instead pop up a menu.  This layer is *not*
diff --git a/InCallUI/res/drawable/btn_fake_compound_background.xml b/InCallUI/res/drawable/btn_fake_compound_background.xml
new file mode 100644
index 0000000..197f589
--- /dev/null
+++ b/InCallUI/res/drawable/btn_fake_compound_background.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Background resource for "compound buttons" in the in-call UI.
+     These buttons have two states (checked and unchecked), and
+     show a blue bar along the bottom edge when checked. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="true" android:state_selected="true"
+          android:drawable="@drawable/list_selector_selected_and_pressed" />
+    <item android:state_pressed="true"
+          android:drawable="@drawable/list_pressed_holo_dark" />
+    <item android:state_selected="true" android:state_focused="true"
+          android:drawable="@drawable/list_selector_focused_and_checked" />
+    <item android:state_focused="true"
+          android:drawable="@drawable/list_focused_holo" />
+    <item android:state_selected="true"
+          android:drawable="@drawable/ic_active_state_dialer_holo_dark" />
+
+    <item
+        android:drawable="@android:color/transparent" />
+
+</selector>
\ No newline at end of file
diff --git a/InCallUI/res/drawable/btn_compound_hold.xml b/InCallUI/res/drawable/btn_fake_compound_hold.xml
similarity index 94%
rename from InCallUI/res/drawable/btn_compound_hold.xml
rename to InCallUI/res/drawable/btn_fake_compound_hold.xml
index 50161ea..04bdd94 100644
--- a/InCallUI/res/drawable/btn_compound_hold.xml
+++ b/InCallUI/res/drawable/btn_fake_compound_hold.xml
@@ -18,7 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:drawable="@drawable/btn_fake_compound_background" />
 
     <!-- ...and the actual icon on top.  Use an explicit <bitmap> to avoid scaling
          the icon up to the full size of the button. -->
diff --git a/InCallUI/res/drawable/btn_compound_mute.xml b/InCallUI/res/drawable/btn_fake_compound_mute.xml
similarity index 94%
rename from InCallUI/res/drawable/btn_compound_mute.xml
rename to InCallUI/res/drawable/btn_fake_compound_mute.xml
index 4e09bd9..69048a2 100644
--- a/InCallUI/res/drawable/btn_compound_mute.xml
+++ b/InCallUI/res/drawable/btn_fake_compound_mute.xml
@@ -18,7 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:drawable="@drawable/btn_fake_compound_background" />
 
     <!-- ...and the actual icon on top.  Use an explicit <bitmap> to avoid scaling
          the icon up to the full size of the button. -->
diff --git a/InCallUI/res/drawable/btn_compound_mute.xml b/InCallUI/res/drawable/list_selector_selected_and_pressed.xml
similarity index 61%
copy from InCallUI/res/drawable/btn_compound_mute.xml
copy to InCallUI/res/drawable/list_selector_selected_and_pressed.xml
index 4e09bd9..d81ee36 100644
--- a/InCallUI/res/drawable/btn_compound_mute.xml
+++ b/InCallUI/res/drawable/list_selector_selected_and_pressed.xml
@@ -14,17 +14,7 @@
      limitations under the License.
 -->
 
-<!-- Layers used to render the in-call "Mute" compound button. -->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
-
-    <!-- ...and the actual icon on top.  Use an explicit <bitmap> to avoid scaling
-         the icon up to the full size of the button. -->
-    <item>
-        <bitmap android:src="@drawable/ic_mute_holo_dark"
-                android:gravity="center" />
-    </item>
-
-</layer-list>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:drawable="@drawable/ic_active_state_dialer_holo_dark" />
+    <item android:drawable="@drawable/list_pressed_holo_dark" />
+</layer-list>
\ No newline at end of file
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 1e7049d..013d1b2 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -101,8 +101,8 @@
              action button that brings up a popup menu; see
              btn_compound_audio.xml and InCallTouchUi.updateAudioButton()
              for the full details. -->
-        <ToggleButton android:id="@+id/audioButton"
-                      style="@style/InCallCompoundButton"
+        <ImageButton android:id="@+id/audioButton"
+                      style="@style/InCallButton"
                       android:background="@drawable/btn_compound_audio"
                       android:contentDescription="@string/onscreenAudioText"
                 />
@@ -112,9 +112,9 @@
 
         <!-- "Mute" -->
         <!-- This is a "compound button": it has checked and unchecked states. -->
-        <ToggleButton android:id="@+id/muteButton"
-                      style="@style/InCallCompoundButton"
-                      android:background="@drawable/btn_compound_mute"
+        <ImageButton android:id="@+id/muteButton"
+                      style="@style/InCallButton"
+                      android:background="@drawable/btn_fake_compound_mute"
                       android:contentDescription="@string/onscreenMuteText"
                 />
 
@@ -126,9 +126,9 @@
              must always be set to GONE. -->
         <!-- "Hold" -->
         <!-- This is a "compound button": it has checked and unchecked states. -->
-        <ToggleButton android:id="@+id/holdButton"
-                      style="@style/InCallCompoundButton"
-                      android:background="@drawable/btn_compound_hold"
+        <ImageButton android:id="@+id/holdButton"
+                      style="@style/InCallButton"
+                      android:background="@drawable/btn_fake_compound_hold"
                       android:contentDescription="@string/onscreenHoldText"
                 />
         <!-- "Swap" (or "Manage calls" in some CDMA states) -->
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index b0fdda1..ed76903 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -41,9 +41,9 @@
         implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, OnDismissListener,
         View.OnClickListener, CompoundButton.OnCheckedChangeListener {
 
-    private ToggleButton mMuteButton;
-    private ToggleButton mAudioButton;
-    private ToggleButton mHoldButton;
+    private ImageButton mMuteButton;
+    private ImageButton mAudioButton;
+    private ImageButton mHoldButton;
     private ToggleButton mShowDialpadButton;
     private ImageButton mMergeButton;
     private ImageButton mAddCallButton;
@@ -107,16 +107,16 @@
         // along the inside perimeter of the button.
         mEndCallButton.setOnTouchListener(new SmallerHitTargetTouchListener());
 
-        mMuteButton = (ToggleButton) parent.findViewById(R.id.muteButton);
+        mMuteButton = (ImageButton) parent.findViewById(R.id.muteButton);
         mMuteButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
-                final CompoundButton button = (CompoundButton) v;
-                getPresenter().muteClicked(button.isChecked());
+                final ImageButton button = (ImageButton) v;
+                getPresenter().muteClicked(!button.isSelected());
             }
         });
 
-        mAudioButton = (ToggleButton) parent.findViewById(R.id.audioButton);
+        mAudioButton = (ImageButton) parent.findViewById(R.id.audioButton);
         mAudioButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -124,11 +124,12 @@
             }
         });
 
-        mHoldButton = (ToggleButton) parent.findViewById(R.id.holdButton);
-        mHoldButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+        mHoldButton = (ImageButton) parent.findViewById(R.id.holdButton);
+        mHoldButton.setOnClickListener(new OnClickListener() {
             @Override
-            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                getPresenter().holdClicked(isChecked);
+            public void onClick(View v) {
+                final ImageButton button = (ImageButton) v;
+                getPresenter().holdClicked(!button.isSelected());
             }
         });
 
@@ -210,7 +211,7 @@
 
     @Override
     public void setMute(boolean value) {
-        mMuteButton.setChecked(value);
+        mMuteButton.setSelected(value);
     }
 
     @Override
@@ -220,7 +221,7 @@
 
     @Override
     public void setHold(boolean value) {
-        mHoldButton.setChecked(value);
+        mHoldButton.setSelected(value);
     }
 
     @Override
@@ -422,7 +423,7 @@
         final int VISIBLE = 255;
 
         mAudioButton.setEnabled(audioButtonEnabled);
-        mAudioButton.setChecked(audioButtonChecked);
+        mAudioButton.setSelected(audioButtonChecked);
 
         final LayerDrawable layers = (LayerDrawable) mAudioButton.getBackground();
         Log.d(this, "'layers' drawable: " + layers);
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 3b1411b..be25737 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -66,6 +66,7 @@
 
     @Override
     public void onStateChange(InCallState state, CallList callList) {
+
         if (state == InCallState.OUTGOING) {
             mCall = callList.getOutgoingCall();
         } else if (state == InCallState.INCALL) {
@@ -171,6 +172,7 @@
 
     public void muteClicked(boolean checked) {
         Log.d(this, "turning on mute: " + checked);
+
         CallCommandClient.getInstance().mute(checked);
     }
 
@@ -182,7 +184,6 @@
         Log.d(this, "holding: " + mCall.getCallId());
 
         CallCommandClient.getInstance().hold(mCall.getCallId(), checked);
-        getUi().setHold(checked);
     }
 
     public void mergeClicked() {