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

Commit 5c464d35 authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

New digital clock widget for Clock

Bug: 7390795

Added a new widget with its own provider and service and factory.
Factory extends a broadcast receiver and listens to all time
changes, locale changes, changes in world clock and alarms.
Added broadcasts for changing the world clock's user cities list
and for setting the next alarm.

Change-Id: Ida4bbd619da941fb46505cb2ac653fde0a41a97f
parent 37ecc738
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@
        </receiver>

        <receiver android:name="com.android.alarmclock.AnalogAppWidgetProvider" android:label="@string/analog_gadget"
           android:icon="@mipmap/ic_widget_analog_clock">
           android:icon="@mipmap/ic_launcher_alarmclock">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
@@ -164,6 +164,21 @@
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/analog_appwidget" />
        </receiver>

        <receiver android:name="com.android.alarmclock.DigitalAppWidgetProvider" android:label="@string/digital_gadget"
           android:icon="@mipmap/ic_launcher_alarmclock">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/digital_appwidget" />
        </receiver>

        <service android:name="com.android.alarmclock.DigitalAppWidgetService"
             android:permission="android.permission.BIND_REMOTEVIEWS"
             android:exported="false" />

        <receiver android:name="com.android.alarmclock.DigitalWidgetViewsFactory"
             android:exported="false" />

        <!-- Dream (screensaver) implementation -->
        <service android:name="Screensaver"
            android:exported="true"
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->

<!-- loading message for the digital widget -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:text="@string/widget_loading_ms"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:ellipsize="none"
    android:layout_gravity="center"
    style="@style/small_light"
    android:textColor="@color/clock_white" />
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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 xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/digital_appwidget"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <include layout="@layout/digital_widget_time"
        android:id="@+id/digital_clock"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
         />

      <ListView
          android:id="@+id/digital_appwidget_listview"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:layout_marginTop="12dip"
          android:divider="@null" />
</LinearLayout>
+70 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->

<!-- digital clock for the digital widget -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_gravity="center"
    android:baselineAligned="false"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center">
        <TextView
            android:id="@+id/timeDisplayHours"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="@dimen/time_margin_right"
            android:singleLine="true"
            android:ellipsize="none"
            style="@style/big_bold"
            android:textColor="@color/clock_white" />
        <TextView
            android:id="@+id/timeDisplayMinutes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/big_thin"
            android:singleLine="true"
            android:ellipsize="none"
            android:textColor="@color/clock_white" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center">
        <TextView android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/clock_white"
            style="@style/label"
            android:gravity="center"
            />
        <TextView android:id="@+id/nextAlarm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawablePadding="2dip"
            android:drawableLeft="@drawable/ic_alarm_small"
            android:textColor="@color/clock_gray"
            style="@style/label"
            android:layout_marginLeft="8dip"
            android:gravity="center"
            />
    </LinearLayout>
</LinearLayout>
+141 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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 xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/widget_item"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="8dip"
            android:gravity="center" >

            <TextView
                android:id="@+id/timeDisplayHoursLeft"
                style="@style/widget_medium_bold"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:paddingRight="@dimen/time_margin_right"
                android:singleLine="true"
                android:textColor="@color/clock_white" />

            <TextView
                android:id="@+id/timeDisplayMinutesLeft"
                style="@style/widget_medium_light"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:singleLine="true"
                android:textColor="@color/clock_white" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center" >

            <TextView
                android:id="@+id/city_name_left"
                style="@style/label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/clock_white" />

            <TextView
                android:id="@+id/city_day_left"
                style="@style/label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/style_label_space"
                android:ellipsize="none"
                android:singleLine="true"
                android:textColor="@color/clock_gray" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center" >

            <TextView
                android:id="@+id/timeDisplayHoursRight"
                style="@style/widget_medium_bold"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:paddingRight="@dimen/time_margin_right"
                android:singleLine="true"
                android:textColor="@color/clock_white" />

            <TextView
                android:id="@+id/timeDisplayMinutesRight"
                style="@style/widget_medium_light"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:singleLine="true"
                android:textColor="@color/clock_white" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center" >

            <TextView
                android:id="@+id/city_name_right"
                style="@style/label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/clock_white" />

            <TextView
                android:id="@+id/city_day_right"
                style="@style/label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/style_label_space"
                android:ellipsize="none"
                android:singleLine="true"
                android:textColor="@color/clock_gray" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>
 No newline at end of file
Loading