AlarmListView: show yellow button when snoozed 72/140972/2
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Sun, 23 Jul 2017 11:00:07 +0000 (13:00 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 27 Jul 2017 15:10:25 +0000 (17:10 +0200)
Add notifications of state changes for Alarm objects.

Change-Id: I3156261944de2b220c37541feb2831b422dcab7c

clock/inc/Model/Alarm.h
clock/inc/Presenter/AlarmListPresenter.h
clock/inc/Utils/Comparators.h [new file with mode: 0644]
clock/inc/Utils/ObservableObject.h [new file with mode: 0644]
clock/inc/View/AlarmListView.h
clock/src/Model/Alarm.cpp
clock/src/Model/Ring.cpp
clock/src/Presenter/AlarmListPresenter.cpp
clock/src/Presenter/DeleteAlarmPresenter.cpp
clock/src/Presenter/RingPresenter.cpp
clock/src/View/AlarmListView.cpp

index d0900f4..07b256c 100644 (file)
@@ -25,6 +25,7 @@
 #include "Utils/Serialization.h"
 #include "Utils/Time.h"
 #include "Utils/Log.h"
+#include "Utils/ObservableObject.h"
 
 namespace model {
        typedef int AlarmId;
@@ -33,7 +34,7 @@ namespace model {
         * It implements scheduling, rescheduling, canceling alarms and also
         * managing snoozing feature.
         */
-       class Alarm : public utils::ISerializable {
+       class Alarm : public utils::ObservableObject, public utils::ISerializable {
                public:
                        /**
                         * @brief Alarm type
@@ -112,6 +113,13 @@ namespace model {
                        bool CanSnooze() const;
 
                        /**
+                        * @brief Check if alarm is currently snoozed.
+                        *
+                        * @return true if alarm is currently snoozed, false otherwise.
+                        */
+                       bool IsSnoozed() const;
+
+                       /**
                         * @brief Sets time interval between snooze alarms
                         * @param[in] seconds number of seconds for Snooze to be scheduled.
                         */
@@ -234,6 +242,7 @@ namespace model {
                        inline bool operator==(const Alarm &a) { return (time == a.time) && (a.name == name); }
                        /** Two alarms are considered same if they have same AlarmId */
                        inline bool operator==(const AlarmId id) { return (this->alarm_id == id) || (this->snooze.alarm_id == id); }
+
                private:
                        int alarm_id;
                        std::string name;
@@ -253,6 +262,8 @@ namespace model {
                                unsigned int attempts_max;
                        } snooze;
                        utils::Time time;
+                       static void CancelPlatformAlarm(int &id);
+                       static bool IsPlatformAlarmCancelled(int id);
        };
        void Deserialize(utils::IReader &w, Alarm::Type &type);
        void Serialize(utils::IWriter &w, Alarm::Type type);
index 0b7a558..fdbd53b 100644 (file)
@@ -50,8 +50,10 @@ namespace presenter {
                        void OnAlarmEditedEvent(model::AlarmList::Iterator e);
                        void OnDeleteItemClicked();
                        void UpdateBackgroundLabel();
+                       void AddItem(model::AlarmList::Iterator iterator);
                        std::map<int, model::AlarmList::Iterator> alarms_;
                        std::vector<utils::Connection> connections_;
+                       std::vector<utils::Connection> object_connections_;
                        bool CheckModelSizeLimit();
                        void OnMenuButtonClicked();
        };
diff --git a/clock/inc/Utils/Comparators.h b/clock/inc/Utils/Comparators.h
new file mode 100644 (file)
index 0000000..95817e0
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+* 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 <limits>
+
+static inline bool AreEqual(double v1, double v2)
+{
+       return std::abs(v1 - v2) < std::numeric_limits<double>::epsilon();
+}
+
diff --git a/clock/inc/Utils/ObservableObject.h b/clock/inc/Utils/ObservableObject.h
new file mode 100644 (file)
index 0000000..4869596
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+* 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 OBSERVABLEOBJECT_H_
+#define OBSERVABLEOBJECT_H_
+
+#include "Utils/Signal.h"
+
+namespace utils {
+       /*
+        * @brief Base class for objects required to broadcast
+        * notifications about changes of their states.
+        */
+       class ObservableObject {
+               public:
+                       ObservableObject() {}
+                       ObservableObject(const ObservableObject &) {}
+                       ObservableObject(ObservableObject &&r)
+                       {
+                               OnChanged = std::move(r.OnChanged);
+                       }
+                       void operator=(const ObservableObject &) {}
+                       virtual ~ObservableObject() {}
+
+                       /**
+                        * @brief Signal that should be triggered
+                        * when any property of the object changed.
+                        */
+                       utils::Signal<void(void)> OnChanged;
+       };
+} /* utils */
+
+#endif /* end of include guard: OBSERVABLEOBJECT_H_ */
index 51bf679..0fc16c5 100644 (file)
@@ -32,6 +32,7 @@ namespace view {
         */
        class AlarmListView : public ui::IView {
                public:
+                       typedef uintptr_t ItemId;
                        /**
                         * @brief Alarm view constructor
                         *
@@ -55,14 +56,14 @@ namespace view {
                         *
                         * @return return item identiefier.
                         */
-                       int ItemPrepend(utils::Time time, const char *name,
-                                       const model::WeekFlags flags, bool active);
+                       ItemId ItemPrepend(utils::Time time, const char *name,
+                                       const model::WeekFlags flags, bool active, bool is_snoozed);
 
                        /**
                         * @brief Remove item from view.
-                        * @param idx item identifier.
+                        * @param id item identifier.
                         */
-                       void RemoveItem(int idx);
+                       void RemoveItem(ItemId id);
 
                        /**
                         * @brief Updates item.
@@ -72,9 +73,10 @@ namespace view {
                         * @param[in] name name to be displayed.
                         * @param[in] flags weekflags to be displayed.
                         * @param[in] active item active status.
+                        * @param[in] is_snoozed item snooze status.
                         */
-                       void ItemUpdate(int idx, utils::Time time, const char *name,
-                                       const model::WeekFlags flags, bool active);
+                       void ItemUpdate(ItemId id, utils::Time time, const char *name,
+                                       const model::WeekFlags flags, bool active, bool is_snoozed);
 
                        /**
                         * @brief Signal emitted when user clicked "delete" item on Delete popup
@@ -145,6 +147,9 @@ namespace view {
                        utils::Connection time_format_change_listener_;
                        void TimeFormatChanged();
                        void CreateNoContentLayout(Evas_Object *parent);
+                       static void SetItemCheckboxStatus(Elm_Object_Item *item, bool is_snoozed);
+                       static void SetItemActiveStatus(Elm_Object_Item *it, bool active);
+                       static void SetCheckboxStatus(Evas_Object *check, bool is_snoozed);
        };
 }
 
index eccf076..eb100cd 100644 (file)
 */
 
 #include <app_alarm.h>
+#include <cmath>
 #include "Model/Alarm.h"
 #include "Common/Defines.h"
 #include "Utils/Log.h"
+#include "Utils/Comparators.h"
 
 using namespace model;
 using namespace utils;
@@ -87,6 +89,7 @@ void Alarm::Activate()
        }
 
        app_control_destroy(control);
+       ObservableObject::OnChanged();
 }
 
 void Alarm::Deactivate()
@@ -94,33 +97,39 @@ void Alarm::Deactivate()
        if (!activated)
                return;
 
-       int err = alarm_cancel(alarm_id);
-       if (err != ALARM_ERROR_NONE) {
-               ERR("alarm_cancel failed: %s", get_error_message(err));
-       }
-       if (snooze.alarm_id != -1 ) {
-               err = alarm_cancel(snooze.alarm_id);
-               if (err != ALARM_ERROR_NONE) {
-                       ERR("alarm_cancel failed: %s", get_error_message(err));
-               } else {
-                       snooze.alarm_id = -1;
-               }
-       }
+       Dismiss();
+       CancelPlatformAlarm(alarm_id);
 
        activated = false;
+       ObservableObject::OnChanged();
 }
 
-void Alarm::Snooze()
+bool Alarm::IsPlatformAlarmCancelled(int id)
+{
+       return id == -1;
+}
+
+void Alarm::CancelPlatformAlarm(int &id)
 {
-       if (!activated || !snooze_enabled)
+       if (id == -1)
                return;
 
-       if (snooze.attempt >= snooze.attempts_max)
+       int err = alarm_cancel(id);
+       if (err != ALARM_ERROR_NONE) {
+               INF("alarm_cancel failed: %s", get_error_message(err));
+       }
+       id = -1;
+}
+
+void Alarm::Snooze()
+{
+       if (!CanSnooze())
                return;
 
        app_control_h control = AppControlCreate();
        if (!control) return;
 
+       CancelPlatformAlarm(snooze.alarm_id);
        int err = alarm_schedule_once_after_delay(control, snooze.interval, &snooze.alarm_id);
        if (err == ALARM_ERROR_NONE) {
                snooze.attempt++;
@@ -129,19 +138,22 @@ void Alarm::Snooze()
        }
 
        app_control_destroy(control);
+       ObservableObject::OnChanged();
 }
 
 void Alarm::Dismiss()
 {
-       if (!activated || !snooze_enabled)
+       if (!IsActivated() || !IsSnoozeEnabled())
                return;
 
+       CancelPlatformAlarm(snooze.alarm_id);
        snooze.attempt = 0;
+       ObservableObject::OnChanged();
 }
 
 bool Alarm::CanSnooze() const
 {
-       if (!activated || !snooze_enabled)
+       if (!IsActivated() || !IsSnoozeEnabled())
                return false;
 
        if (snooze.attempt >= snooze.attempts_max)
@@ -152,12 +164,23 @@ bool Alarm::CanSnooze() const
 
 void Alarm::EnableSnooze()
 {
-       snooze_enabled = true;
+       if (!snooze_enabled)
+       {
+               snooze_enabled = true;
+               ObservableObject::OnChanged();
+       }
 }
 
 void Alarm::DisableSnooze()
 {
-       snooze_enabled = false;
+       if (IsSnoozed())
+               Dismiss();
+
+       if (snooze_enabled)
+       {
+               snooze_enabled = false;
+               ObservableObject::OnChanged();
+       }
 }
 
 bool Alarm::IsSnoozeEnabled() const
@@ -165,9 +188,18 @@ bool Alarm::IsSnoozeEnabled() const
        return snooze_enabled;
 }
 
+bool Alarm::IsSnoozed() const
+{
+       return !IsPlatformAlarmCancelled(snooze.alarm_id);
+}
+
 void Alarm::SetSnoozeInterval(unsigned int seconds)
 {
-       snooze.interval = seconds;
+       if (snooze.interval != seconds)
+       {
+               snooze.interval = seconds;
+               ObservableObject::OnChanged();
+       }
 }
 
 unsigned int Alarm::GetSnoozeInterval() const
@@ -177,7 +209,11 @@ unsigned int Alarm::GetSnoozeInterval() const
 
 void Alarm::SetSnoozeMaxAttemps(unsigned int attemps)
 {
-       snooze.attempts_max = attemps;
+       if (snooze.attempts_max != attemps)
+       {
+               snooze.attempts_max = attemps;
+               ObservableObject::OnChanged();
+       }
 }
 
 unsigned int Alarm::GetSnoozeMaxAttempts() const
@@ -192,7 +228,11 @@ std::string Alarm::GetName() const
 
 void Alarm::SetName(std::string nm)
 {
-       name = nm;
+       if (name != nm)
+       {
+               name = nm;
+               ObservableObject::OnChanged();
+       }
 }
 
 Time Alarm::GetTime() const
@@ -207,10 +247,11 @@ void Alarm::SetTime(Time tm)
 
        time = tm;
 
-       if (activated) {
+       if (IsActivated()) {
                Deactivate();
                Activate();
        }
+       ObservableObject::OnChanged();
 }
 
 std::string Alarm::GetMelody() const
@@ -220,7 +261,11 @@ std::string Alarm::GetMelody() const
 
 void Alarm::SetMelody(std::string path)
 {
-       sound.melody = path;
+       if (sound.melody != path)
+       {
+               sound.melody = path;
+               ObservableObject::OnChanged();
+       }
 }
 
 Alarm::Type Alarm::GetType() const
@@ -230,7 +275,11 @@ Alarm::Type Alarm::GetType() const
 
 void Alarm::SetType(Alarm::Type type)
 {
-       type_ = type;
+       if (type_ != type)
+       {
+               type_ = type;
+               ObservableObject::OnChanged();
+       }
 }
 
 WeekFlags Alarm::GetWeekFlags() const
@@ -238,17 +287,18 @@ WeekFlags Alarm::GetWeekFlags() const
        return flags;
 }
 
-void Alarm::SetWeekFlags(WeekFlags flags)
+void Alarm::SetWeekFlags(WeekFlags fl)
 {
-       if (this->flags == flags)
+       if (flags == fl)
                return;
 
-       this->flags = flags;
+       flags = fl;
 
-       if (activated) {
+       if (IsActivated()) {
                Deactivate();
                Activate();
        }
+       ObservableObject::OnChanged();
 }
 
 bool Alarm::IsActivated() const
@@ -309,8 +359,10 @@ double Alarm::GetVolume() const
 
 void Alarm::SetVolume(double volume)
 {
+       if (AreEqual(sound.volume, volume)) return;
        if (volume < 0.0) volume = 0.0;
        if (volume > 1.0) volume = 1.0;
        sound.volume = volume;
+       ObservableObject::OnChanged();
 }
 
index 638aa3d..db0d577 100644 (file)
@@ -54,7 +54,7 @@ namespace model {
 
        void Ring::AlarmDefer()
        {
-               if (alarm_ && alarm_->IsSnoozeEnabled()) {
+               if (alarm_ && alarm_->CanSnooze()) {
                        AlarmSnooze();
                        return;
                }
index f0924fe..6001a80 100644 (file)
@@ -54,19 +54,26 @@ AlarmListPresenter::~AlarmListPresenter()
 {
 }
 
+void AlarmListPresenter::AddItem(AlarmList::Iterator it)
+{
+       int id = view_->ItemPrepend(
+                       it->GetTime(),
+                       it->GetName().c_str(),
+                       it->GetWeekFlags(),
+                       it->IsActivated(),
+                       it->IsSnoozed());
+       alarms_.insert(std::map<int, AlarmList::Iterator>::value_type (id, it));
+       object_connections_.push_back(it->OnChanged.Connect(
+                               std::bind(&AlarmListPresenter::OnAlarmEditedEvent, this, it)));
+}
+
 void AlarmListPresenter::ShowAll()
 {
        view_->Clear();
+       object_connections_.clear();
 
-       for (auto it = model_.Begin(); it != model_.End(); ++it) {
-               int id = view_->ItemPrepend(
-                               it->GetTime(),
-                               it->GetName().c_str(),
-                               it->GetWeekFlags(),
-                               it->IsActivated());
-               alarms_.insert(std::map<int, AlarmList::Iterator>::value_type (id, it));
-       }
-
+       for (auto it = model_.Begin(); it != model_.End(); ++it)
+               AddItem(it);
        UpdateBackgroundLabel();
 }
 
@@ -104,10 +111,14 @@ void AlarmListPresenter::OnItemActiveStatusChanged(int idx)
 
        auto &alarm_it = it->second;
 
-       if (alarm_it->IsActivated()) {
-               alarm_it->Deactivate();
+       if (alarm_it->IsSnoozed()) {
+               alarm_it->Dismiss();
        } else {
-               alarm_it->Activate();
+               if (alarm_it->IsActivated()) {
+                       alarm_it->Deactivate();
+               } else {
+                       alarm_it->Activate();
+               }
        }
 
        model_.Replace(alarm_it, *alarm_it);
@@ -115,12 +126,7 @@ void AlarmListPresenter::OnItemActiveStatusChanged(int idx)
 
 void AlarmListPresenter::OnAlarmAddedEvent(AlarmList::Iterator it)
 {
-       int id = view_->ItemPrepend(
-                       it->GetTime(),
-                       it->GetName().c_str(),
-                       it->GetWeekFlags(),
-                       it->IsActivated());
-       alarms_.insert(std::map<int, AlarmList::Iterator>::value_type (id, it));
+       AddItem(it);
        UpdateBackgroundLabel();
 }
 
@@ -163,7 +169,7 @@ void AlarmListPresenter::OnAlarmEditedEvent(AlarmList::Iterator iterator)
                if (iterator == it->second) {
                        auto &alarm_it = it->second;
                        view_->ItemUpdate(it->first, alarm_it->GetTime(), alarm_it->GetName().c_str(),
-                                       alarm_it->GetWeekFlags(), alarm_it->IsActivated());
+                                       alarm_it->GetWeekFlags(), alarm_it->IsActivated(), alarm_it->IsSnoozed());
                        break;
                }
        }
index 5b87631..33caa90 100644 (file)
@@ -54,7 +54,14 @@ void DeleteAlarmPresenter::OnDeleteButtonClicked()
        std::vector<int> deleted = view_->GetSelectedItems();
 
        for (auto idx: deleted) {
-               model_.Remove(alarms_.find(idx)->second);
+               auto it = alarms_.find(idx);
+               if (it != alarms_.end())
+               {
+                       auto alarm_it = it->second;
+                       alarm_it->Deactivate();
+                       model_.Remove(alarm_it);
+               }
+
        }
        view_->PopPage();
 }
index 67c1b63..c941aa4 100644 (file)
@@ -98,7 +98,7 @@ void RingPresenter::AlarmHandle(utils::Event &e)
 
        animator_.Start();
 
-       view_->EnableSnooze(alarm ? alarm->IsSnoozeEnabled() : false);
+       view_->EnableSnooze(alarm ? alarm->CanSnooze() : false);
 }
 
 void RingPresenter::TimeoutHandle(utils::Event &e)
index dfe5a37..d439d4a 100644 (file)
@@ -49,6 +49,8 @@ struct ItemData {
        Time time;
        /** Iternal EFL handle */
        Elm_Object_Item *it;
+       /* Snooze flag */
+       bool snoozed;
 };
 
 Elm_Genlist_Item_Class AlarmListView::alarm_itc = {
@@ -66,12 +68,6 @@ Elm_Genlist_Item_Class AlarmListView::alarm_itc = {
 void AlarmListView::ItemClicked(void *data, Evas_Object *obj, void *info)
 {
        ItemData *id = static_cast<ItemData*>(data);
-
-       if (elm_check_state_get(obj))
-               elm_object_item_signal_emit(id->it, "alarm,state,enabled", "clock");
-       else
-               elm_object_item_signal_emit(id->it, "alarm,state,disabled", "clock");
-
        id->instance->OnItemToggled((uintptr_t)id->it);
 }
 
@@ -84,17 +80,47 @@ static void SetItemRepeatIconVisibility(Elm_Object_Item *it, bool visible)
        }
 }
 
-void AlarmListView::ItemRealized(void *data, Evas_Object *obj, void *info)
+static void
+tizen_check_color_set(Evas_Object *check, int r, int g, int b, int a)
 {
-       Elm_Object_Item *it = static_cast<Elm_Object_Item*>(info);
+       Evas_Object *edje = elm_layout_edje_get(check);
+       if (!edje) return;
+       edje_object_color_class_set(edje, "check/toggle/bg_on", r, g, b, a,
+                       0, 0, 0, 0, 0, 0, 0, 0);
+}
 
-       ItemData *id = static_cast<ItemData*>(elm_object_item_data_get(it));
+void AlarmListView::SetCheckboxStatus(Evas_Object *check, bool is_snoozed)
+{
+       if (is_snoozed)
+               tizen_check_color_set(check, 255, 180, 0, 255);
+       else
+               tizen_check_color_set(check, 89, 176, 58, 255);
+}
 
-       if (id->active)
-               elm_object_item_signal_emit(id->it, "alarm,state,enabled", "clock");
+void AlarmListView::SetItemCheckboxStatus(Elm_Object_Item *item, bool is_snoozed)
+{
+       Evas_Object *check = elm_object_item_part_content_get(item, "onoff");
+       if (!check)
+               return;
+
+       SetCheckboxStatus(check, is_snoozed);
+}
+
+void AlarmListView::SetItemActiveStatus(Elm_Object_Item *it, bool active)
+{
+       if (active)
+               elm_object_item_signal_emit(it, "alarm,state,enabled", "clock");
        else
-               elm_object_item_signal_emit(id->it, "alarm,state,disabled", "clock");
+               elm_object_item_signal_emit(it, "alarm,state,disabled", "clock");
+}
+
+void AlarmListView::ItemRealized(void *data, Evas_Object *obj, void *info)
+{
+       Elm_Object_Item *it = static_cast<Elm_Object_Item*>(info);
+       ItemData *id = static_cast<ItemData*>(elm_object_item_data_get(it));
 
+       SetItemCheckboxStatus(it, id->snoozed);
+       SetItemActiveStatus(it, id->active);
        SetItemRepeatIconVisibility(it, (id->flags.OnAny(WeekDay::ALL_WEEK)));
 }
 
@@ -111,13 +137,14 @@ Evas_Object *AlarmListView::ContentGet(void *data, Evas_Object *obj, const char
        ItemData *id = static_cast<ItemData*>(data);
 
        if (!strcmp(part, "onoff")) {
-               Evas_Object *toggle = elm_check_add(obj);
-               elm_object_style_set(toggle, "on&off");
-               elm_check_state_set(toggle, id->active ? EINA_TRUE : EINA_FALSE);
-               evas_object_propagate_events_set(toggle, EINA_FALSE);
-               evas_object_smart_callback_add(toggle, "changed", AlarmListView::ItemClicked, id);
-               evas_object_show(toggle);
-               return toggle;
+               Evas_Object *check = elm_check_add(obj);
+               elm_object_style_set(check, "toggle");
+               elm_check_state_set(check, id->active ? EINA_TRUE : EINA_FALSE);
+               evas_object_propagate_events_set(check, EINA_FALSE);
+               evas_object_smart_callback_add(check, "changed", AlarmListView::ItemClicked, id);
+               SetCheckboxStatus(check, id->snoozed);
+               evas_object_show(check);
+               return check;
        }
        return nullptr;
 }
@@ -283,7 +310,7 @@ void AlarmListView::Clear()
        elm_genlist_clear(genlist_);
 }
 
-int AlarmListView::ItemPrepend(Time time, const char *name, const  WeekFlags flags, bool active)
+AlarmListView::ItemId AlarmListView::ItemPrepend(Time time, const char *name, const  WeekFlags flags, bool active, bool is_snoozed)
 {
        ItemData *data = new ItemData;
 
@@ -292,6 +319,7 @@ int AlarmListView::ItemPrepend(Time time, const char *name, const  WeekFlags fla
        data->flags = flags;
        data->active = active;
        data->time = time;
+       data->snoozed = is_snoozed;
 
        data->it = elm_genlist_item_prepend(genlist_,
                        &alarm_itc,
@@ -300,13 +328,13 @@ int AlarmListView::ItemPrepend(Time time, const char *name, const  WeekFlags fla
                        ELM_GENLIST_ITEM_NONE,
                        AlarmListView::ItemSelected, data);
 
-       return (uintptr_t)data->it;
+       return (ItemId)data->it;
 }
 
-void AlarmListView::ItemUpdate(int idx, Time time, const char *name,
-               const WeekFlags flags, bool active)
+void AlarmListView::ItemUpdate(ItemId id, Time time, const char *name,
+               const WeekFlags flags, bool active, bool is_snoozed)
 {
-       Elm_Object_Item *it = (Elm_Object_Item*)idx;
+       Elm_Object_Item *it = (Elm_Object_Item*)id;
        if (!it) return;
 
        ItemData *data = static_cast<ItemData*>(elm_object_item_data_get(it));
@@ -316,14 +344,14 @@ void AlarmListView::ItemUpdate(int idx, Time time, const char *name,
        data->flags = flags;
        data->active = active;
        data->time = time;
+       data->snoozed = is_snoozed;
 
-       SetItemRepeatIconVisibility(it, (data->flags.OnAny(WeekDay::ALL_WEEK)));
        elm_genlist_item_update(it);
 }
 
-void AlarmListView::RemoveItem(int idx)
+void AlarmListView::RemoveItem(ItemId id)
 {
-       Elm_Object_Item *it = (Elm_Object_Item*)idx;
+       Elm_Object_Item *it = (Elm_Object_Item*)id;
        if (it) elm_object_item_del(it);
 }