Xml文件  |  94行  |  3.89 KB

<?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.
-->

<!-- Layers used to render the in-call "Audio mode" compound button.

     This is a multi-mode button:

     - If no bluetooth headset is connected, it behaves like a simple
       "compound button" that switches the speaker on and off.  (This is why
       the button itself is a ToggleButton instance.)

     - But if a bluetooth headset is connected, this becomes a simple
       action button (with no concept of a "checked" state) that brings
       up a popup menu offering you a 3-way choice between earpiece /
       speaker / bluetooth.

     See InCallTouchUi.updateAudioButton() for the corresponding code. -->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- The standard "compound button" background, used to distinguish
         between the "checked" and "unchecked" states when this button is
         simply an on/off toggle for the speaker.
         (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" />

    <!-- The little triangle that indicates that this isn't a plain
         button, but will instead pop up a menu.  This layer is *not*
         shown when the audio button is simply an on/off toggle. -->
    <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full
         size of the button. -->
    <item android:id="@+id/moreIndicatorItem">
        <bitmap android:src="@drawable/ic_toolbar_arrow_whitespace"
                android:gravity="center"
                android:tint="@color/selectable_icon_tint" />
    </item>

    <!-- Finally, the button icon.

         When the audio button is simply an on/off toggle for the speaker,
         the icon is a "speakerphone" regardless of whether the speaker is
         active.  (Instead, the "on/off" indication comes from the
         btn_compound_background selector.)

         But when the audio button is connected to the 3-way popup menu,
         we use the button's icon to indicate the current audio mode
         (i.e. one of { earpiece (or wired headset) , speaker , bluetooth }).

         Here we have separate layers for each possible foreground icon,
         and in InCallTouchUi.updateAudioButton() we hide them all
         *except* the one needed for the current state. -->

    <!-- These all use an explicit <bitmap> to avoid scaling the icon up
         to the full size of the button. -->

    <!-- Bluetooth is active -->
    <item android:id="@+id/bluetoothItem">
        <bitmap android:src="@drawable/ic_toolbar_audio_bluetooth"
                android:gravity="center"
                android:tint="@color/selectable_icon_tint" />
    </item>


    <!-- Handset earpiece is active -->
    <item android:id="@+id/handsetItem">
        <bitmap android:src="@drawable/ic_toolbar_audio_phone"
                android:gravity="center"
                android:tint="@color/selectable_icon_tint" />
    </item>

    <!-- Speakerphone icon showing 'speaker on' state -->
    <item android:id="@+id/speakerphoneItem">
        <bitmap android:src="@drawable/ic_toolbar_speaker_on"
            android:gravity="center"
            android:tint="@color/selectable_icon_tint" />
    </item>

</layer-list>