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

Commit 6d603b7c authored by James Lemieux's avatar James Lemieux
Browse files

Refactor Timers to use new unified DataModel

Bug: 24816218
Bug: 25494722

This refactoring introduces a Timer domain object. Instances of these
domain objects are fetched via a DataModel class that is the single point
of reference for all timer data. This allows the data to be shared across
the entire application. In particular, the timer notifications, TimerFragment
and ExpiredTimersActivity all draw upon the same model to determine
what the state of the timers are.

IMPORTANT: The public intent com.android.deskclock.action.STOP_TIMER
has been renamed to com.android.deskclock.action.PAUSE_TIMER to be
more accurate.

Change-Id: Ib904e80a25c6de1861de2b395bec27db16ff0e66
parent ea18eed9
Loading
Loading
Loading
Loading
+10 −44
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@
                <category android:name="android.intent.category.VOICE" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.deskclock.action.STOP_TIMER" />
                <action android:name="com.android.deskclock.action.PAUSE_TIMER" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.VOICE" />
            </intent-filter>
@@ -313,59 +313,25 @@
            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 -->
        <activity android:name="com.android.deskclock.timer.TimerAlertFullScreen"
        <!-- This activity displays only the timers that have expired with only a reset button
         present. This makes the activity appropriate for display above the lock screen so that
         users have the limited ability to silence expired timers but nothing else. -->
        <activity android:name=".timer.ExpiredTimersActivity"
                android:excludeFromRecents="true"
                android:theme="@style/TimerAlertFullScreenTheme"
                android:theme="@style/ExpiredTimersActivityTheme"
                android:launchMode="singleInstance"
                android:showOnLockScreen="true"
                android:taskAffinity=""
                android:configChanges="screenSize|keyboardHidden|keyboard|navigation"/>

        <service android:name="TimerRingService"
        <service android:name=".timer.TimerService"
                 android:exported="false"
                android:description="@string/timer_ring_service_desc">
            <intent-filter>
                <action android:name="com.android.deskclock.TIMER_ALERT" />
            </intent-filter>
                 android:description="@string/timer_service_desc">
        </service>

        <receiver android:name="com.android.deskclock.timer.TimerReceiver"
                android:exported="false">
            <intent-filter>
                <action android:name="start_timer" />
                <action android:name="stop_timer" />
                <action android:name="delete_timer" />
                <action android:name="reset_timer" />
                <action android:name="times_up" />
                <action android:name="timer_done" />
                <action android:name="timer_update" />
                <action android:name="notif_in_use_show" />
                <action android:name="notif_in_use_cancel" />
                <action android:name="notif_times_up_stop" />
                <action android:name="notif_times_up_plus_one" />
                <action android:name="notif_times_up_show" />
                <action android:name="notif_times_up_cancel" />
                <action android:name="notif_pause_timer" />
                <action android:name="notif_plus_one_timer" />
                <action android:name="notif_resume_timer" />
                <action android:name="notif_reset_timer" />
                <action android:name="notif_reset_all_timers" />
                <action android:name="notif_update" />
            </intent-filter>
        </receiver>

        <service android:name="com.android.deskclock.stopwatch.StopwatchService"
        <service android:name=".stopwatch.StopwatchService"
                android:exported="false"
                android:description="@string/stopwatch_service_desc">
            <intent-filter>
                <action android:name="com.android.deskclock.action.START_STOPWATCH" />
                <action android:name="com.android.deskclock.action.PAUSE_STOPWATCH" />
                <action android:name="com.android.deskclock.action.LAP_STOPWATCH" />
                <action android:name="com.android.deskclock.action.RESET_STOPWATCH" />
            </intent-filter>
        </service>
    </application>
</manifest>
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <com.android.deskclock.stopwatch.StopwatchTimer
            <com.android.deskclock.stopwatch.StopwatchCircleView
                android:id="@+id/stopwatch_time"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
+0 −28
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/timers_list_page"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false">

    <include layout="@layout/timer_timer_view"/>

    <include layout="@layout/timer_setup_view"/>

</FrameLayout>
 No newline at end of file
+50 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
<!-- Copyright (C) 2015 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.
@@ -14,25 +14,28 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/expired_timers_activity"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    android:fitsSystemWindows="true">

    <FrameLayout
        android:id="@+id/timers_list_page"
    <ScrollView
        android:id="@+id/expired_timers_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        android:scrollbars="none">

        <com.android.deskclock.widget.sgv.StaggeredGridView
            android:id="@+id/timers_list"
        <LinearLayout
            android:id="@+id/expired_timers_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:divider="@null"
            android:dividerHeight="@dimen/timer_divider_height" />
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            android:orientation="vertical"
            android:paddingTop="?attr/actionBarSize" />
    </ScrollView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
@@ -40,18 +43,8 @@
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_margin="@dimen/fab_margin"
            android:src="@drawable/ic_stop_white_24dp"
        android:contentDescription="@string/timer_stop"
        android:src="@drawable/ic_stop_white_24dp"
        app:borderWidth="0dp"
        app:elevation="@dimen/fab_elevation" />

    </FrameLayout>

    <com.android.deskclock.TimerSetupView
        android:id="@+id/timer_setup"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginEnd="16dip"
        android:layout_marginStart="16dip" />

</FrameLayout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <com.android.deskclock.stopwatch.StopwatchTimer
        <com.android.deskclock.stopwatch.StopwatchCircleView
            android:id="@+id/stopwatch_time"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
Loading