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

Commit 34142b1d authored by James Lemieux's avatar James Lemieux
Browse files

Refactor Cities (World Clocks) to use new unified DataModel

This refactoring replaces CityObj with City, an immutable description
of a city and its associated clock information. City objects are fetched
via a DataModel class that is the single point of reference for all City
data. This allows the data to be shared across the entire application.
In particular, DigitalWidgetViewsFactory, ClockFragment and
CitySelectionActivity all draw upon the same model to determine what
cities exist, which ones are selected, and what the preferred display
order shall be.

Change-Id: I7c2eaa31b596b5333213415af58a7bb46ebb370e
parent dad3bb30
Loading
Loading
Loading
Loading
+31 −24
Original line number Diff line number Diff line
@@ -89,12 +89,11 @@
            </intent-filter>
        </activity>

        <activity android:name=".worldclock.CitiesActivity"
        <activity android:name=".worldclock.CitySelectionActivity"
                android:label="@string/cities_activity_title"
                android:theme="@style/CitiesTheme"
                android:taskAffinity=""
                android:excludeFromRecents="true"
                >
                android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
@@ -241,38 +240,46 @@
            </intent-filter>
        </receiver>

        <receiver android:name="com.android.alarmclock.AnalogAppWidgetProvider" android:label="@string/analog_gadget"
           android:icon="@mipmap/ic_launcher_alarmclock">
        <receiver
            android:name="com.android.alarmclock.AnalogAppWidgetProvider"
            android:icon="@mipmap/ic_launcher_alarmclock"
            android:label="@string/analog_gadget">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
            </intent-filter>
            <meta-data android:name="android.appwidget.oldName" android:value="com.android.deskclock.AnalogAppWidgetProvider" />
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/analog_appwidget" />

            <meta-data
                android:name="android.appwidget.oldName"
                android:value="com.android.deskclock.AnalogAppWidgetProvider"/>
            <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">
        <receiver
            android:name="com.android.alarmclock.DigitalAppWidgetProvider"
            android:icon="@mipmap/ic_launcher_alarmclock"
            android:label="@string/digital_gadget">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                <action android:name="com.android.deskclock.ON_QUARTER_HOUR" />
                <action android:name="android.intent.action.DATE_CHANGED" />
                <action android:name="android.intent.action.TIMEZONE_CHANGED" />
                <action android:name="android.intent.action.SCREEN_ON" />
                <action android:name="android.intent.action.TIME_SET"/>
                <action android:name="android.intent.action.SCREEN_ON"/>
                <action android:name="android.intent.action.DATE_CHANGED"/>
                <action android:name="android.intent.action.LOCALE_CHANGED"/>
                <action android:name="android.intent.action.TIMEZONE_CHANGED"/>
                <action android:name="com.android.deskclock.CITIES_CHANGED"/>
                <action android:name="com.android.deskclock.ON_QUARTER_HOUR"/>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
                <action android:name="android.app.action.NEXT_ALARM_CLOCK_CHANGED"/>
                <action android:name="com.android.deskclock.worldclock.update" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/digital_appwidget" />
            <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"
+15 −12
Original line number Diff line number Diff line
@@ -16,22 +16,25 @@

<!-- Use this clock_fragment for landscape, which has main clock frame next to cities,
     with a spacing ratio dependent on the number of clocks per row (phone has 1, tablet has 2). -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingStart="@dimen/clock_side_padding"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:paddingEnd="@dimen/clock_side_padding"
    android:orientation="horizontal">
    android:paddingStart="@dimen/clock_side_padding">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:layout_marginBottom="@dimen/main_clock_bottom_margin"
        android:layout_weight="2"
        android:gravity="center">

        <include layout="@layout/main_clock_frame"
        <include
            android:id="@+id/main_clock_left_pane"
            layout="@layout/main_clock_frame"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

@@ -41,8 +44,8 @@
        android:id="@+id/cities"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
            android:layout_weight="@integer/world_clocks_per_row"
        android:layout_gravity="center"
        android:layout_weight="@integer/world_clocks_per_row"
        android:clickable="false"/>

</LinearLayout>
 No newline at end of file
+11 −7
Original line number Diff line number Diff line
@@ -14,27 +14,31 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/cities"
        android:clickable="false"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingStart="@dimen/clock_side_padding"
        android:paddingEnd="@dimen/clock_side_padding_reduced" />
        android:clickable="false"
        android:paddingEnd="@dimen/clock_side_padding_reduced"
        android:paddingStart="@dimen/clock_side_padding"/>

    <FrameLayout
        android:layout_width="@dimen/footer_button_size"
        android:layout_height="@dimen/footer_button_size"
        android:layout_gravity="bottom|end"
        android:layout_marginBottom="@dimen/footer_button_layout_margin">

        <ImageButton
            android:id="@+id/menu_button"
            style="?attr/actionOverflowButtonStyle"
            android:layout_gravity="end|center_vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end|center_vertical"
            android:accessibilityTraversalAfter="@+id/fab"
            android:contentDescription="@string/button_menu"/>
    </FrameLayout>
+2 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2012 The Android Open Source Project
<?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.
+14 −17
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
<!-- 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.
-->

<!-- 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>
    <bool name="config_requiresScreenSaver">true</bool>
    <bool name="config_dockAppEnabled">true</bool>
    <bool name="config_rotateAlarmAlert">false</bool>
Loading