TizenRefApp-7979 Implement alarms list's item 71/112771/2
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 3 Feb 2017 07:22:23 +0000 (09:22 +0200)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 3 Feb 2017 07:22:23 +0000 (09:22 +0200)
Change-Id: I546dd00b789942582dacd80793ae3b0474decee5
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
20 files changed:
alarm-app/.cproject
alarm-app/inc/List/AlarmItem.h
alarm-app/src/AlarmApp.cpp
alarm-app/src/Input/DaySelector.cpp
alarm-app/src/List/AlarmItem.cpp
alarm-app/src/List/AlarmsView.cpp
alarm-widget/.cproject
alarm-widget/edje/widget/images/alarm_widget_icon.png [deleted file]
alarm-widget/edje/widget/images/alarm_widget_icon_bg.png [deleted file]
alarm-widget/res/widget/edje/WidgetLayout.h
alarm-widget/res/widget/edje/WidgetPath.h
alarm-widget/res/widget/edje/alarm-check-style.edc [deleted file]
alarm-widget/src/AlarmWidget.cpp
lib-common/.cproject
lib-common/edje/common/images/alarm_widget_icon.png [new file with mode: 0644]
lib-common/edje/common/images/alarm_widget_icon_bg.png [new file with mode: 0644]
lib-common/inc/Common/Format.h [new file with mode: 0644]
lib-common/res/common/edje/CommonPath.h [new file with mode: 0644]
lib-common/res/common/edje/alarm-check-style.edc [new file with mode: 0644]
lib-common/src/Common/Format.cpp [new file with mode: 0644]

index d71adaf28cb9b65576b2239e21077903d0fd53b7..0ffd340704c2c999cd827d8bd0a2e2fa3c886d28 100644 (file)
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-common/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/alarm-app/res/input/edje}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/alarm-app/res/list/edje}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-common/res/common/edje}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.208729733" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.570702224" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.app"/>
                                                                </option>
-                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1612390694" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1612390694" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath"/>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.705336083" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.include.paths.389112477" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
-                                                               </option>
-                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.705336083" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
-                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
-                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
-                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
-                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
-                                                               </option>
-                                                               <option id="gnu.cpp.compiler.option.include.paths.389112477" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-common/res/common/edje}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.697230212" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
index 5260f5f29699a49aa1be2c0136579b3f47b3d5bb..88831c0f0e19225850b8c8c56afbfb84a8aed148 100644 (file)
@@ -32,31 +32,25 @@ namespace List
        class AlarmItem: public Ux::SelectItem
        {
        public:
-               explicit AlarmItem(Common::Model::Alarm &alarm);
-
-       protected:
                /**
-                * @see SelectItem::getDefaultResult()
+                * @brief Create alarm item.
+                * @param[in]   alarm   Alarm associated with the item
                 */
-               virtual Ux::SelectResult getDefaultResult() const override;
+               explicit AlarmItem(Common::Model::Alarm &alarm);
 
                /**
-                * @see GenItem::getItemClass()
+                * @brief Update the item according to the changes.
+                * @param[in]   changes     Mask specifying which data has changed
                 */
-               virtual Elm_Gen_Item_Class *getItemClass() const override;
+               void update(int changes);
 
-               /**
-                * @see GenItem::getText()
-                */
+       private:
+               virtual Ux::SelectResult getDefaultResult() const override;
+               virtual Elm_Gen_Item_Class *getItemClass() const override;
                virtual char *getText(Evas_Object *parent, const char *part) override;
-
-               /**
-                * @see GenItem::getContent()
-                */
                virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override;
-
-       private:
-               bool is24HourFormat() const;
+               virtual void onSelected() override;
+               void onAlarmEnabled(Evas_Object *check, void *eventInfo);
 
                Common::Model::Alarm &m_Alarm;
        };
index 6f6e8ea408197d1f05c005b88d51ba81f332a768..6e935cc457fb2c22e3c9ddb5b45cf544640846ca 100644 (file)
@@ -19,6 +19,7 @@
 #include "Ui/Window.h"
 #include "Utils/Logger.h"
 
+#include "CommonPath.h"
 #include "DaySelectorPath.h"
 #include "ListPath.h"
 #include "OperationDefaultController.h"
@@ -40,6 +41,7 @@ bool AlarmApp::onCreate()
 
        elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_DAY_SELECTOR_LAYOUT).c_str());
        elm_theme_extension_add(nullptr, App::getResourcePath(PATH_LIST_ITEM_STYLE).c_str());
+       elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALARM_CHECK_STYLE).c_str());
 
        Application::onCreate();
        getWindow()->setRotationEnabled(true);
index 9d2f7914d3efe4a6dbb4eace7f7c081f95b14bfd..52fbba2cf0aeabac2860506f072e1a7d1450ac68 100644 (file)
  */
 
 #include "Input/DaySelector.h"
+#include "Common/Format.h"
 #include "Utils/Callback.h"
 
-#include <app_i18n.h>
-
 using namespace Input;
 
 DaySelector::DaySelector()
@@ -82,17 +81,7 @@ void DaySelector::updateLocale()
 
 void DaySelector::updateNames()
 {
-       const char *names[] = {
-               _("WDS_ALM_BUTTON_S_M_SUNDAY_ABB"),
-               _("WDS_ALM_BUTTON_M_M_MONDAY_ABB"),
-               _("WDS_ALM_BUTTON_T_M_TUESDAY_ABB"),
-               _("WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB"),
-               _("WDS_ALM_BUTTON_T_M_THURSDAY_ABB"),
-               _("WDS_ALM_BUTTON_F_M_FRIDAY_ABB"),
-               _("WDS_ALM_BUTTON_S_M_SATURDAY_ABB")
-       };
-
-       elm_dayselector_weekdays_names_set(getEvasObject(), names);
+       elm_dayselector_weekdays_names_set(getEvasObject(), Common::getWeekdayLetters().begin());
 }
 
 void DaySelector::updateWeekStart(i18n_ucalendar_h calendar)
index ab6ab73b3ce54e52e5dc7620f2a6a89f3b35dbf4..e2a8e7652bb3b61036ae1d5ec82011ac368c31b8 100644 (file)
  * limitations under the License.
  */
 
-#include "Common/Model/Alarm.h"
 #include "List/AlarmItem.h"
+#include "Input/InputView.h"
+
+#include "Common/Format.h"
+#include "Common/Model/Alarm.h"
+#include "Common/Model/AlarmConsumer.h"
+
+#include "Ui/Genlist.h"
+#include "Ui/Navigator.h"
+#include "Utils/Callback.h"
+
+#include "CommonPath.h"
 
-#include <system_settings.h>
+#define PART_TIME   "elm.text"
+#define PART_DATE   "elm.text.1"
+#define PART_ON_OFF "elm.icon"
 
-#define BUF_SIZE 16
+#define AM_PM_FONT_SIZE 26
+#define ON_OFF_WH 76
 
 using namespace Common::Model;
 using namespace List;
@@ -29,6 +42,23 @@ AlarmItem::AlarmItem(Alarm &alarm)
 {
 }
 
+void AlarmItem::update(int changes)
+{
+       if (changes & Alarm::ChangedDate) {
+               GenItem::update(PART_TIME, ELM_GENLIST_ITEM_FIELD_TEXT);
+               if (!m_Alarm.getRepeat()) {
+                       GenItem::update(PART_DATE, ELM_GENLIST_ITEM_FIELD_TEXT);
+               }
+       }
+       if (changes & Alarm::ChangedRepeat) {
+               GenItem::update(PART_DATE, ELM_GENLIST_ITEM_FIELD_TEXT);
+       }
+       if (changes & Alarm::ChangedEnabled) {
+               Evas_Object *check = elm_object_item_part_content_get(getObjectItem(), PART_ON_OFF);
+               elm_check_state_set(check, m_Alarm.isEnabled());
+       }
+}
+
 Ux::SelectResult AlarmItem::getDefaultResult() const
 {
        return { 0, &m_Alarm };
@@ -42,13 +72,14 @@ Elm_Gen_Item_Class *AlarmItem::getItemClass() const
 
 char *AlarmItem::getText(Evas_Object *parent, const char *part)
 {
-       if (strcmp(part, "elm.text") == 0) {
-               char buf[BUF_SIZE];
-               strftime(buf, sizeof(buf), is24HourFormat() ? "%H:%M" : "%I:%M %p", &m_Alarm.getDate());
-
-               return strdup(buf);
-       } else if (strcmp(part, "elm.text.1") == 0) {
-               //TODO Get here alarm subtext
+       if (strcmp(part, PART_TIME) == 0) {
+               return strdup(Common::formatTime(m_Alarm.getDate(), AM_PM_FONT_SIZE));
+       } else if (strcmp(part, PART_DATE) == 0) {
+               if (m_Alarm.getRepeat()) {
+                       return strdup(Common::formatRepeat(m_Alarm.getRepeat()));
+               } else {
+                       return strdup(Common::formatDate(m_Alarm.getDate()));
+               }
        }
 
        return nullptr;
@@ -56,8 +87,17 @@ char *AlarmItem::getText(Evas_Object *parent, const char *part)
 
 Evas_Object *AlarmItem::getContent(Evas_Object *parent, const char *part)
 {
-       if (strcmp(part, "elm.icon") == 0) {
-               //TODO Make on/off alarm icon
+       if (strcmp(part, PART_ON_OFF) == 0) {
+               Evas_Object *check = elm_check_add(parent);
+               elm_object_style_set(check, STYLE_CHECK_ALARM_ON_OFF);
+               elm_check_state_set(check, m_Alarm.isEnabled());
+
+               evas_object_propagate_events_set(check, EINA_FALSE);
+               evas_object_size_hint_min_set(check, ON_OFF_WH, ON_OFF_WH);
+               evas_object_smart_callback_add(check, "changed",
+                               makeCallback(&AlarmItem::onAlarmEnabled), this);
+
+               return check;
        } else if (strcmp(part, "elm.swallow.center_check") == 0) {
                SelectItem::getContent(parent, part);
        }
@@ -65,9 +105,15 @@ Evas_Object *AlarmItem::getContent(Evas_Object *parent, const char *part)
        return nullptr;
 }
 
-bool AlarmItem::is24HourFormat() const
+void AlarmItem::onSelected()
+{
+       if (auto navigator = getParent()->findParent<Ui::Navigator>()) {
+               navigator->navigateTo(new Input::InputView(m_Alarm));
+       }
+}
+
+void AlarmItem::onAlarmEnabled(Evas_Object *check, void *eventInfo)
 {
-       bool is24hour = true;
-       system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &is24hour);
-       return is24hour;
+       m_Alarm.setEnabled(elm_check_state_get(check));
+       AlarmConsumer::getInstance().updateAlarm(m_Alarm, nullptr);
 }
index c65fead215f982e58656b1d3af1fa97becea5012..2dbf59ebd30a1b09716d10f3741d0dbd63fc9700 100644 (file)
@@ -94,8 +94,7 @@ void AlarmsView::onAlarmInserted(::Model::DataItem &dataItem)
 
 void AlarmsView::onAlarmUpdated(AlarmItem *item, int changes)
 {
-       /* TODO: Use changes to update specific parts */
-       item->update("*", ELM_GENLIST_ITEM_FIELD_ALL);
+       item->update(changes);
 }
 
 void AlarmsView::onAlarmDeleted(AlarmItem *item)
index 2c0118d46dde6a3f244aa71d887e0d67ac2d1a48..8bec9d27bc4076f925f5a381c5743be1a6317c86 100644 (file)
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-apps-common/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-common/inc}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/alarm-widget/res/widget/edje}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/lib-common/res/common/edje}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1604887711" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
diff --git a/alarm-widget/edje/widget/images/alarm_widget_icon.png b/alarm-widget/edje/widget/images/alarm_widget_icon.png
deleted file mode 100644 (file)
index 3bbe63d..0000000
Binary files a/alarm-widget/edje/widget/images/alarm_widget_icon.png and /dev/null differ
diff --git a/alarm-widget/edje/widget/images/alarm_widget_icon_bg.png b/alarm-widget/edje/widget/images/alarm_widget_icon_bg.png
deleted file mode 100644 (file)
index b70b6d0..0000000
Binary files a/alarm-widget/edje/widget/images/alarm_widget_icon_bg.png and /dev/null differ
index 16170bf63c0dfc181089aad2632739f20f2c00ef..fce3a17e7f6d96584b8ef5dff95b73e76906e455 100644 (file)
@@ -21,7 +21,6 @@
 
 #define LAYOUT_NO_ALARM             "no_alarm"
 #define LAYOUT_ALARM                "alarm"
-#define STYLE_CHECK_ALARM_ON_OFF    "alarm_on_off"
 
 #define PART_NO_ALARM_TEXT          "text.no_alarm"
 #define PART_AM_PM                  "text.am_pm"
index d0d2c67e2138be8c2db7d0dbc52a941be520098a..30c11b9400f740da428317887f5a9180b4340743 100644 (file)
 #define WIDGET_EDJ_DIR              "widget/edje/"
 
 #define PATH_WIDGET_LAYOUT           WIDGET_EDJ_DIR"widget-layout.edj"
-#define PATH_ALARM_CHECK_STYLE       WIDGET_EDJ_DIR"alarm-check-style.edj"
-
 #define PATH_NO_ALARM                WIDGET_IMG_DIR"alarm_widget_no_alarm.png"
-#define PATH_ALARM_ICON              WIDGET_IMG_DIR"alarm_widget_icon.png"
-#define PATH_ALARM_ICON_BG           WIDGET_IMG_DIR"alarm_widget_icon_bg.png"
 
 #endif /* WIDGET_PATH_H */
diff --git a/alarm-widget/res/widget/edje/alarm-check-style.edc b/alarm-widget/res/widget/edje/alarm-check-style.edc
deleted file mode 100644 (file)
index 7a32e29..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-#include "WidgetLayout.h"
-
-collections {
-       base_scale: 1.3;
-
-       group { "elm/check/base/"STYLE_CHECK_ALARM_ON_OFF;
-               images {
-                       image: PATH_ALARM_ICON_BG COMP;
-                       image: PATH_ALARM_ICON COMP;
-               }
-               parts {
-                       image { "image.bg";
-                               desc { "default";
-                                       image.normal: PATH_ALARM_ICON_BG;
-                                       color: 77 207 255 255;
-                               }
-                               desc { "checked";
-                                       inherit: "default";
-                                       color: 77 207 255 102;
-                               }
-                       }
-                       image { "image.alarm";
-                               desc { "default";
-                                       image.normal: PATH_ALARM_ICON;
-                                       color: 77 207 255 255;
-                               }
-                               desc { "checked";
-                                       inherit: "default";
-                                       color: 77 207 255 102;
-                               }
-                       }
-               }
-               programs {
-                       program {
-                               signal: "elm,state,check,on";
-                               source: "elm";
-                               action: STATE_SET "default";
-                               target: "image.alarm";
-                               target: "image.bg";
-                       }
-                       program {
-                               signal: "elm,state,check,off";
-                               source: "elm";
-                               action: STATE_SET "checked";
-                               target: "image.alarm";
-                               target: "image.bg";
-                       }
-                       program {
-                               signal: "mouse,clicked,*";
-                               source: "*";
-                               action: SIGNAL_EMIT "elm,action,check,toggle" "";
-                       }
-               }
-       }
-}
\ No newline at end of file
index 2a456c6aad3ae77b3b745058062e1a5f58854377..21edd9a1ebfc339b5d53889cb0afb38d257d808e 100644 (file)
@@ -20,6 +20,8 @@
 #include "Ui/Window.h"
 #include "Utils/Callback.h"
 #include "Utils/Logger.h"
+
+#include "CommonPath.h"
 #include "WidgetLayout.h"
 
 #define TAG_PREFIX "<match>"
index 960d153b312b523dcf4baf551b8342996a947fff..7f4056a8ad2ffbfd5a379898519bb89686ee1722 100644 (file)
@@ -26,7 +26,7 @@
                                                                <option id="gnu.cpp.compiler.option.optimization.level.1398093091" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.512256296" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1379021540" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.sharedLib"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1812812065" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.676051183" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.202562662" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option id="sbi.gnu.c.compiler.option.682801576" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.sharedLib"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.925347047" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                        <tool id="org.tizen.nativecore.tool.ast.cpp.1727772058" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
                                                        <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.178013541" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
                                                        <tool id="org.tizen.nativecore.tool.sbi.po.compiler.284142865" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
-                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.2065305140" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.2065305140" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler">
+                                                               <option id="sbi.gnu.edc.compiler.option.misc.id.1235266472" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/edje&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.edc.compiler.option.misc.sd.259343775" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/edje&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.edc.compiler.option.misc.fd.114004466" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/edje&quot;"/>
+                                                               </option>
+                                                       </tool>
                                                </toolChain>
                                        </folderInfo>
                                        <sourceEntries>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="res"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
                                        </sourceEntries>
                                </configuration>
diff --git a/lib-common/edje/common/images/alarm_widget_icon.png b/lib-common/edje/common/images/alarm_widget_icon.png
new file mode 100644 (file)
index 0000000..3bbe63d
Binary files /dev/null and b/lib-common/edje/common/images/alarm_widget_icon.png differ
diff --git a/lib-common/edje/common/images/alarm_widget_icon_bg.png b/lib-common/edje/common/images/alarm_widget_icon_bg.png
new file mode 100644 (file)
index 0000000..b70b6d0
Binary files /dev/null and b/lib-common/edje/common/images/alarm_widget_icon_bg.png differ
diff --git a/lib-common/inc/Common/Format.h b/lib-common/inc/Common/Format.h
new file mode 100644 (file)
index 0000000..137f022
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef COMMON_FORMAT_H
+#define COMMON_FORMAT_H
+
+#include <ctime>
+#include <tizen.h>
+#include "Utils/Range.h"
+
+namespace Common
+{
+       /**
+        * @return Localized first letters of weekday names.
+        */
+       EXPORT_API Utils::Range<const char **> getWeekdayLetters();
+
+       /**
+        * @return Whether 24-hour time format is set.
+        */
+       EXPORT_API bool is24HourFormat();
+
+       /**
+        * @brief Create string representation for given time.
+        * @param[in]   time        Time to format
+        * @param[in]   fontSize    Font size for AM/PM representation
+        * @return Formatted time.
+        */
+       EXPORT_API const char *formatTime(const tm &time, int fontSize);
+
+       /**
+        * @brief Create string representation for given date.
+        * @param[in]   date    Time to format
+        * @return Formatted date.
+        */
+       EXPORT_API const char *formatDate(const tm &date);
+
+       /**
+        * @brief Create string representation for weekly repeat mask.
+        * @param[in]   repeat  Repeat mask to format
+        * @return Formatted weekday letters with highlighted repeat.
+        */
+       EXPORT_API const char *formatRepeat(int repeat);
+}
+
+#endif /* COMMON_FORMAT_H */
diff --git a/lib-common/res/common/edje/CommonPath.h b/lib-common/res/common/edje/CommonPath.h
new file mode 100644 (file)
index 0000000..be24b8f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef COMMON_PATH_H
+#define COMMON_PATH_H
+
+#define COMMON_EDJ_DIR              "common/edje/"
+#define COMMON_IMG_DIR              "common/images/"
+
+#define PATH_ALARM_CHECK_STYLE      COMMON_EDJ_DIR"alarm-check-style.edj"
+
+#define PATH_ALARM_ICON             COMMON_IMG_DIR"alarm_widget_icon.png"
+#define PATH_ALARM_ICON_BG          COMMON_IMG_DIR"alarm_widget_icon_bg.png"
+
+#define STYLE_CHECK_ALARM_ON_OFF    "alarm_on_off"
+
+#endif /* COMMON_PATH_H */
diff --git a/lib-common/res/common/edje/alarm-check-style.edc b/lib-common/res/common/edje/alarm-check-style.edc
new file mode 100644 (file)
index 0000000..3765803
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#include "CommonPath.h"
+
+collections {
+       base_scale: 1.3;
+
+       group { "elm/check/base/"STYLE_CHECK_ALARM_ON_OFF;
+               images {
+                       image: PATH_ALARM_ICON_BG COMP;
+                       image: PATH_ALARM_ICON COMP;
+               }
+               parts {
+                       image { "image.bg";
+                               desc { "default";
+                                       aspect: 1 1;
+                                       aspect_preference: HORIZONTAL;
+                                       image.normal: PATH_ALARM_ICON_BG;
+                                       color: 77 207 255 255;
+                               }
+                               desc { "checked";
+                                       inherit: "default";
+                                       color: 77 207 255 102;
+                               }
+                       }
+                       image { "image.alarm";
+                               desc { "default";
+                                       aspect: 1 1;
+                                       aspect_preference: HORIZONTAL;
+                                       image.normal: PATH_ALARM_ICON;
+                                       color: 77 207 255 255;
+                               }
+                               desc { "checked";
+                                       inherit: "default";
+                                       color: 77 207 255 102;
+                               }
+                       }
+               }
+               programs {
+                       program {
+                               signal: "elm,state,check,on";
+                               source: "elm";
+                               action: STATE_SET "default";
+                               target: "image.alarm";
+                               target: "image.bg";
+                       }
+                       program {
+                               signal: "elm,state,check,off";
+                               source: "elm";
+                               action: STATE_SET "checked";
+                               target: "image.alarm";
+                               target: "image.bg";
+                       }
+                       program {
+                               signal: "mouse,clicked,*";
+                               source: "*";
+                               action: SIGNAL_EMIT "elm,action,check,toggle" "";
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/lib-common/src/Common/Format.cpp b/lib-common/src/Common/Format.cpp
new file mode 100644 (file)
index 0000000..84a52cc
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#include "Common/Format.h"
+
+#include <app_i18n.h>
+#include <string>
+#include <system_settings.h>
+
+#define DAY_COUNT 7
+#define TIME_BUFFER_SIZE 64
+#define DATE_BUFFER_SIZE 32
+#define REPEAT_BUFFER_SIZE 256
+
+namespace
+{
+       const char *weekdays[DAY_COUNT] = {
+               "WDS_ALM_BUTTON_S_M_SUNDAY_ABB",
+               "WDS_ALM_BUTTON_M_M_MONDAY_ABB",
+               "WDS_ALM_BUTTON_T_M_TUESDAY_ABB",
+               "WDS_ALM_BUTTON_W_M_WEDNESDAY_ABB",
+               "WDS_ALM_BUTTON_T_M_THURSDAY_ABB",
+               "WDS_ALM_BUTTON_F_M_FRIDAY_ABB",
+               "WDS_ALM_BUTTON_S_M_SATURDAY_ABB"
+       };
+}
+
+Utils::Range<const char **> Common::getWeekdayLetters()
+{
+       static const char *days[DAY_COUNT];
+       for (size_t i = 0; i < Utils::count(days); ++i) {
+               days[i] = _(weekdays[i]);
+       }
+       return days;
+}
+
+bool Common::is24HourFormat()
+{
+       bool is24hour = true;
+       system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &is24hour);
+       return is24hour;
+}
+
+const char *Common::formatTime(const tm &time, int fontSize)
+{
+       static char buffer[TIME_BUFFER_SIZE];
+       if (is24HourFormat()) {
+               strftime(buffer, sizeof(buffer), "%H:%M", &time);
+       } else {
+               char format[TIME_BUFFER_SIZE];
+               snprintf(format, sizeof(format), "%%I:%%M <font_size=%d>%%p</font_size>", fontSize);
+               strftime(buffer, sizeof(buffer), format, &time);
+       }
+
+       return buffer;
+}
+
+const char *Common::formatDate(const tm &date)
+{
+       static char buffer[DATE_BUFFER_SIZE];
+       /* TODO: Use i18n for locale-dependent pattern generation */
+       strftime(buffer, sizeof(buffer), "%a, %d %b", &date);
+       return buffer;
+}
+
+const char *Common::formatRepeat(int repeat)
+{
+       static std::string buffer;
+       auto days = getWeekdayLetters();
+
+       buffer.clear();
+       for (int i = 0; i < DAY_COUNT; ++i) {
+               if (!buffer.empty()) {
+                       buffer += " ";
+               }
+               if (repeat & (1 << i)) {
+                       buffer += "<match>";
+                       buffer += days[i];
+                       buffer += "</match>";
+               } else {
+                       buffer += days[i];
+               }
+       }
+       return buffer.c_str();
+}