Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6f73547 authored by Daria Evdokimova's avatar Daria Evdokimova
Browse files

Picker UI for Alarms.

Implements the UI for Alarms.
When a user tries to DISMISS_ALARM and it's ambiguous
which alarm they mean we show the UI that lets them
pick an alarm they want.

Change-Id: Ia70277db7d6b6ac4277604837ec7b14cd519b2c6
parent 20b03333
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -276,6 +276,11 @@
            </intent-filter>
        </activity>

        <activity
            android:name=".AlarmSelectionActivity"
            android:label="@string/dismiss_alarm"
            android:theme="@android:style/Theme.Holo.Light.Dialog.NoActionBar"/>

        <!-- This activity is basically like the TimerFragment in DeskClock
         but only during lock screen
         so that it only has the fired timers -->
+63 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dc="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/alarm_item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/alarm_label_padding"
    android:gravity="top"
    android:orientation="vertical">

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

        <com.android.deskclock.widget.TextTime
            android:id="@+id/digital_clock"
            android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/black"
            android:textSize="@dimen/label_font_size"
            android:textStyle="bold"
            dc:format12Hour="@string/alarm_time_12_hours_format"
            dc:format24Hour="@string/clock_24_hours_format" />

        <TextView
            android:id="@+id/daysOfWeek"
            tools:text="M, T, W"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:singleLine="true"
            android:textSize="@dimen/label_font_size"
            android:textColor="@color/black"
            android:layout_marginTop="@dimen/alarm_clock_vertical_margin"
            android:layout_marginStart="@dimen/alarm_clock_vertical_margin" />
    </LinearLayout>

    <com.android.deskclock.widget.EllipsizeLayout
        android:id="@+id/summary"
        android:layout_marginTop="@dimen/label_margin_big"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        android:layout_gravity="end"
        android:orientation="vertical"
        android:layout_marginBottom="@dimen/alarm_clock_vertical_margin">

        <TextView
            android:id="@+id/label"
            tools:text="Pick up kids"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="none"
            android:singleLine="true"
            android:textSize="@dimen/label_font_size"
            android:textColor="@color/black_54p" />
    </com.android.deskclock.widget.EllipsizeLayout>
</LinearLayout>
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal|top"
    android:orientation="vertical"
    android:paddingLeft="@dimen/alarm_picker_dialog_horizontal_margin"
    android:paddingRight="@dimen/alarm_picker_dialog_horizontal_margin"
    android:paddingTop="@dimen/alarm_picker_dialog_vertical_margin">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/dismiss_alarm"
        android:textColor="@color/black"
        android:textSize="@dimen/header_font_size"
        android:layout_marginBottom="@dimen/alarm_picker_margin_bottom"/>

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:dividerHeight="0dp"
        android:divider="@null"/>

    <Button
        android:id="@+id/cancel_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/time_picker_cancel"
        android:clickable="true"
        android:gravity="end"
        android:background="@android:color/transparent"
        android:textColor="@android:color/holo_blue_light"/>

</LinearLayout>
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

<!-- These resources are around just to allow their values to be customized
     for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<resources>
    <dimen name="label_text_size">14sp</dimen>
    <dimen name="time_text_size">120dip</dimen>
    <dimen name="ampm_text_size">20dip</dimen>
@@ -80,6 +80,10 @@
    <dimen name="alarm_info_font_size">36sp</dimen>
    <dimen name="no_alarm_font_size">16sp</dimen>

    <dimen name="alarm_picker_dialog_horizontal_margin">30dp</dimen>
    <dimen name="alarm_picker_dialog_vertical_margin">20dp</dimen>
    <dimen name="alarm_picker_margin_bottom">10dp</dimen>

    <dimen name="body_font_padding">4dp</dimen>
    <dimen name="button_font_size">24sp</dimen>
    <dimen name="dialog_button_font_size">16sp</dimen>
+1 −9
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ public abstract class AlarmClockFragment extends DeskClockFragment implements
            } else {
                itemHolder.tomorrowLabel.setVisibility(View.VISIBLE);
                final Resources resources = getResources();
                final String labelText = isTomorrow(alarm) ?
                final String labelText = Alarm.isTomorrow(alarm) ?
                        resources.getString(R.string.alarm_tomorrow) :
                        resources.getString(R.string.alarm_today);
                itemHolder.tomorrowLabel.setText(labelText);
@@ -877,14 +877,6 @@ public abstract class AlarmClockFragment extends DeskClockFragment implements
            return Color.rgb(red, green, blue);
        }

        private boolean isTomorrow(Alarm alarm) {
            final Calendar now = Calendar.getInstance();
            final int alarmHour = alarm.hour;
            final int currHour = now.get(Calendar.HOUR_OF_DAY);
            return alarmHour < currHour ||
                        (alarmHour == currHour && alarm.minutes <= now.get(Calendar.MINUTE));
        }

        private void bindExpandArea(final ItemHolder itemHolder, final Alarm alarm) {
            // Views in here are not bound until the item is expanded.

Loading