Evas_Object *GetEvasObject();
private:
- Evas_Object *win_;
- Evas_Object *layout_;
- view::CounterView *counter_;
+ Evas_Object *win_ = NULL;
+ Evas_Object *layout_ = NULL;
+ Evas_Object *conformant_ = NULL;
+
+ Evas_Object *dismissButton_ = NULL;
+ Evas_Object *snoozeButton_ = NULL;
+
+ view::CounterView *counter_ = NULL;
std::vector<std::function<void(void)>> signals_
= std::vector<std::function<void(void)>>((int)RingSignal::MAX, nullptr);
* @param[in] ly The layout of the ring view where content must be placed.
*/
void SetMainContent(Evas_Object *ly);
+
+ /**
+ * @brief Creates dismiss swipe button
+ *
+ * @return Evas_Object of the button
+ */
+ Evas_Object *CreateDismissButton();
+
+ /**
+ * @brief Creates snooze swipe button
+ *
+ * @return Evas_Object of the button
+ */
+ Evas_Object *CreateSnoozeButton();
+
+ /**
+ * @brief Creates swipe button
+ *
+ * @param[in] group The button's layout group
+ *
+ * @return Evas_Object of the button
+ */
+ Evas_Object *CreateSwipeButton(const char *group);
+
};
} //namespace view
elm_win_indicator_mode_set(win_, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(win_, ELM_WIN_INDICATOR_OPAQUE);
- Evas_Object *conformant = elm_conformant_add(win_);
+ conformant_ = elm_conformant_add(win_);
- evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conformant_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(conformant_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win_, conformant);
+ elm_win_resize_object_add(win_, conformant_);
- layout_ = elm_layout_add(conformant);
+ layout_ = elm_layout_add(conformant_);
if (!layout_) {
ERR("elm_layout_add failed");
evas_object_del(win_);
if (!elm_layout_file_set(layout_, utils::TizenAppUtils::GetResourcePath(
utils::TizenAppUtils::APP_DIR_RESOURCE, EDJE_FILE), GROUP)) {
ERR("elm_layout_file_set failed");
- evas_object_del(layout_);
evas_object_del(win_);
return;
}
- elm_object_content_set(conformant, layout_);
+ elm_object_content_set(conformant_, layout_);
elm_object_translatable_part_text_set(layout_, "txt.hours", "IDS_COM_BODY_HOURS");
elm_object_translatable_part_text_set(layout_, "txt.minutes", "IDS_COM_BODY_MINUTES");
evas_object_size_hint_weight_set(layout_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(layout_);
- evas_object_show(conformant);
+ evas_object_show(conformant_);
evas_object_show(win_);
- elm_object_signal_callback_add(layout_, "button,swipe,accept", "sw.swipe.area:sw.btn.dismiss:button", DismissCb, this);
- elm_object_signal_callback_add(layout_, "button,swipe,accept", "sw.swipe.area:sw.btn.snooze:button", SnoozeCb, this);
+ dismissButton_ = CreateDismissButton();
+ elm_object_part_content_set(layout_, "sw.swipe.area:sw.btn.dismiss", dismissButton_);
}
RingView::~RingView()
counter_ = nullptr;
}
}
+
Evas_Object *RingView::GetEvasObject()
{
return layout_;
void RingView::SetTimeLabel(const char *ampm, const char *hour, const char *date)
{
- DBG("%s %s %s", ampm, hour, date);
Evas_Object *content = elm_layout_add(layout_);
if (!content)
return;
elm_object_signal_emit(layout_, "set,ring,alarm,view", "ring");
}
+Evas_Object *RingView::CreateDismissButton()
+{
+ Evas_Object *button = CreateSwipeButton("button_dismiss");
+
+ elm_object_signal_callback_add(button, "button,swipe,accept", "button", DismissCb, this);
+
+ return button;
+}
+
+Evas_Object *RingView::CreateSnoozeButton()
+{
+ Evas_Object *button = CreateSwipeButton("button_snooze");
+
+ elm_object_signal_callback_add(button, "button,swipe,accept", "button", SnoozeCb, this);
+
+ return button;
+}
+
+Evas_Object *RingView::CreateSwipeButton(const char *group)
+{
+ Evas_Object *layout = elm_layout_add(layout_);
+
+ if (!elm_layout_file_set(layout, utils::TizenAppUtils::GetResourcePath(
+ utils::TizenAppUtils::APP_DIR_RESOURCE, EDJE_FILE), group)) {
+ ERR("elm_layout_file_set failed");
+ evas_object_del(layout);
+ return NULL;
+ }
+
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ evas_object_show(layout);
+
+ return layout;
+}
+
void RingView::EnableSnooze(bool enabled)
{
- DBG("Enable snooze: %d", enabled);
- if (enabled)
+ if (enabled) {
elm_object_signal_emit(layout_, "sw.swipe.area:buttons,expand", "ring");
- else
+ if (!snoozeButton_) {
+ snoozeButton_ = CreateSnoozeButton();
+ elm_object_part_content_set(layout_, "sw.swipe.area:sw.btn.snooze", snoozeButton_);
+ }
+ } else {
elm_object_signal_emit(layout_, "sw.swipe.area:buttons,contract", "ring");
+
+ snoozeButton_ = elm_object_part_content_unset(layout_, "sw.swipe.area:sw.btn.snooze");
+ if (snoozeButton_)
+ evas_object_del(snoozeButton_);
+ }
}
void RingView::SetMainContent(Evas_Object *ly)