Xml文件  |  238行  |  9.81 KB

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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.
-->

<LinearLayout
    android:id="@+id/alarm_item"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dc="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingStart="@dimen/alarm_side_padding"
    android:paddingEnd="@dimen/alarm_side_padding"
    android:background="?android:attr/selectableItemBackground"
    android:gravity="center_horizontal|top"
    android:orientation="vertical">
    <!-- TODO~: flatten this layout using gridLayout which supports layout_weight as of 21 -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
        android:orientation="horizontal">

        <com.android.deskclock.widget.TextTime
            android:id="@+id/digital_clock"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="@color/clock_white"
            android:textSize="@dimen/alarm_time_font_size"
            android:fontFamily="sans-serif-thin"
            dc:format12Hour="@string/alarm_time_12_hours_format"
            dc:format24Hour="@string/clock_24_hours_format" />

        <Space
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <Switch
            android:id="@+id/onoff"
            android:theme="@style/AlarmSwitchTheme"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|end" />
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/expand_area"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_marginBottom="@dimen/collapse_expand_height"
            android:orientation="vertical"
            android:visibility="gone">

            <CheckBox
                android:id="@+id/repeat_onoff"
                android:layout_width="wrap_content"
                android:layout_height="48dip"
                android:layout_gravity="center_vertical|start"
                android:text="@string/alarm_repeat"
                android:textSize="16sp"
                android:paddingStart="12dip"
                android:textColor="@color/clock_white" />

            <LinearLayout
                android:id="@+id/repeat_days"
                android:layout_width="match_parent"
                android:layout_height="48dip"
                android:layout_gravity="top"
                android:orientation="horizontal"
                android:visibility="gone">
                <!-- Day buttons are put here programatically -->
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/choose_ringtone"
                    android:layout_width="0dip"
                    android:layout_height="48dip"
                    android:layout_weight="1"
                    android:layout_alignParentStart="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:clickable="true"
                    android:paddingStart="4dip"
                    android:drawablePadding="16dp"
                    android:drawableStart="@drawable/ic_ringtone"
                    android:ellipsize="marquee"
                    android:gravity="center_vertical"
                    android:marqueeRepeatLimit="marquee_forever"
                    android:scrollHorizontally="true"
                    android:singleLine="true"
                    android:textAlignment="viewStart"
                    android:textSize="16sp"
                    android:textColor="@color/clock_white"
                    />

                <CheckBox
                    android:id="@+id/vibrate_onoff"
                    android:layout_width="wrap_content"
                    android:layout_height="48dip"
                    android:layout_alignParentEnd="true"
                    android:layout_centerVertical="true"
                    android:includeFontPadding="false"
                    android:text="@string/alarm_vibrate"
                    android:paddingStart="16dip"
                    android:textSize="16sp"
                    android:textColor="@color/white" />
            </LinearLayout>

            <TextView
                android:id="@+id/edit_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:hint="@string/label"
                android:paddingBottom="12dp"
                android:paddingEnd="12dp"
                android:paddingLeft="18dp"
                android:paddingRight="12dp"
                android:paddingStart="18dp"
                android:paddingTop="12dp"
                android:singleLine="true"
                android:textSize="16sp"
                android:textColor="@color/white" />

            <View
                android:layout_width="match_parent"
                android:layout_height="@dimen/hairline_height"
                android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:background="@color/hairline" />

        </LinearLayout>

        <FrameLayout
            android:id="@+id/collapse_expand"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:contentDescription="@string/collapse_alarm">

            <ImageButton
                android:id="@+id/delete"
                android:layout_width="wrap_content"
                android:layout_height="48dip"
                android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
                android:layout_marginBottom="@dimen/alarm_clock_vertical_margin"
                android:layout_marginStart="4dip"
                android:layout_gravity="start"
                android:background="?android:attr/selectableItemBackgroundBorderless"
                android:contentDescription="@string/delete_alarm"
                android:src="@drawable/ic_delete_small" />

            <View
                android:id="@+id/hairline"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_gravity="bottom"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                android:background="@color/hairline" />

            <com.android.deskclock.widget.EllipsizeLayout
                android:id="@+id/summary"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="@dimen/alarm_clock_vertical_margin"
                android:gravity="center_vertical">

                <TextView
                    android:id="@+id/label"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="none"
                    android:singleLine="true"
                    android:paddingEnd="4dip"
                    android:textSize="16sp"
                    android:textColor="@color/clock_gray" />

                <TextView
                    android:id="@+id/daysOfWeek"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:singleLine="true"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:textColor="@color/clock_white" />

                <TextView
                    android:id="@+id/tomorrowLabel"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:singleLine="true"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:textColor="@color/clock_white" />

            </com.android.deskclock.widget.EllipsizeLayout>

            <ImageView
                android:id="@+id/arrow"
                android:layout_width="wrap_content"
                android:layout_height="48dip"
                android:layout_gravity="center_vertical|end"
                android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
                android:layout_marginBottom="@dimen/alarm_clock_vertical_margin"
                android:contentDescription="@string/expand_alarm"
                android:src="@drawable/ic_expand_down" />
        </FrameLayout>
    </FrameLayout>

</LinearLayout>