desc { "default";
}
}
+ swallow { "gallery.swallow.overlay";
+ desc { "default";
+ }
+ }
+ }
+}
+
+group { "elm/layout/gallery/proccessing";
+ parts {
+ rect { "bg";
+ norepeat;
+ desc { "default";
+ color: 0 0 0 0;
+ }
+ desc { "visible";
+ color: 0 0 0 255;
+ }
+ }
+ swallow { "gallery.swallow.progress";
+ desc { "default";
+ hid;
+ }
+ desc { "visible";
+ inherit: "default";
+ vis;
+ }
+ }
+ textblock { name: "elm.text";
+ scale: 1;
+ desc { "default";
+ hid;
+ text.style: "popup_graphic_toast_style";
+ text.min: 0 1;
+ text.max: 0 1;
+ }
+ desc { "visible";
+ inherit: "default";
+ vis;
+ }
+ }
+ }
+ programs {
+ program { "gallery,show";
+ signal: "gallery,show";
+ source: "";
+ action: STATE_SET "visible";
+ target: "bg";
+ target: "gallery.swallow.progress";
+ target: "elm.text";
+ }
+ program { "gallery,hide";
+ signal: "gallery,hide";
+ source: "";
+ action: STATE_SET "default";
+ target: "bg";
+ target: "gallery.swallow.progress";
+ target: "elm.text";
+ }
+ program { "gallery,hide,progress";
+ signal: "gallery,hide,progress";
+ source: "";
+ action: STATE_SET "default";
+ target: "gallery.swallow.progress";
+ target: "elm.text";
+ }
+ }
+}
+
+group { "elm/layout/gallery/popup_icon";
+ images.image: "check_18.png" COMP;
+ parts {
+ image { "check";
+ scale;
+ desc { "default";
+ hid;
+ image.normal: "check_18.png";
+ aspect: 1 1;
+ aspect_preference: BOTH;
+ }
+ desc { "visible";
+ inherit: "default";
+ vis;
+ min: 82 82;
+ max: 82 82;
+ }
+ desc { "clipped";
+ inherit: "visible";
+ clip_to: "check_mask";
+ }
+ }
+ spacer { "check_left_pad";
+ scale;
+ desc { "default";
+ align: 0.0 0.5;
+ fixed: 1 1;
+ min: 8 0;
+ rel1.to: "check";
+ rel2.to: "check";
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ spacer { "check_right_pad";
+ scale;
+ desc { "default";
+ align: 1.0 0.5;
+ fixed: 1 1;
+ min: 6 0;
+ rel1.to: "check";
+ rel2.to: "check";
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ }
+ }
+ rect { "check_mask";
+ desc { "default";
+ hid;
+ fixed: 1 1;
+ }
+ desc { "anim_state_0";
+ vis;
+ rel1.to: "check_left_pad";
+ rel2.to: "check_left_pad";
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ }
+ desc { "anim_state_1";
+ inherit: "anim_state_0";
+ rel2.to: "check_right_pad";
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ }
+ programs {
+ program { "gallery,animate,check";
+ signal: "gallery,animate,check";
+ source: "";
+ sequence {
+ action: STATE_SET "clipped";
+ target: "check";
+ action: STATE_SET "anim_state_0";
+ target: "check_mask";
+
+ action: STATE_SET "anim_state_1";
+ target: "check_mask";
+ transition: CUBIC_BEZIER 0.3 0.46 0.03 0.52 0.95;
+
+ action: STATE_SET "default";
+ target: "check_mask";
+ action: STATE_SET "visible";
+ target: "check";
+ }
+ }
}
}
--- /dev/null
+/*
+ * 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 __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
+#define __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
+
+#include "ucl/gui/Layout.h"
+#include "ucl/gui/StyledWidget.h"
+
+#include "types.h"
+
+namespace gallery {
+
+ class ProcessingPresenter final : public ucl::RefCountAware {
+ public:
+ enum class IconType {
+ NONE,
+ CHECK
+ };
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setProcessingText(ucl::TString text);
+ Builder &setCompleteText(ucl::TString text);
+ Builder &setIconType(IconType value);
+ ProcessingPresenterSRef build(ucl::Widget &parent) const;
+ private:
+ ucl::TString m_processingText;
+ ucl::TString m_completeText;
+ IconType m_iconType;
+ };
+
+ using DismissHandler = ucl::WeakDelegate<void()>;
+
+ public:
+ ucl::Widget &getWidget();
+
+ void complete(const DismissHandler &dismissHandler);
+
+ private:
+ friend class ucl::RefCountObj<ProcessingPresenter>;
+ ProcessingPresenter(ucl::RefCountObjBase &rc, IconType iconType);
+ virtual ~ProcessingPresenter();
+
+ ucl::Result prepare(ucl::Widget &parent,
+ const ucl::TString &processingText,
+ const ucl::TString &completeText);
+
+ ucl::Result createWidget(ucl::Widget &parent,
+ const ucl::TString &processingText);
+ ucl::Result createProgress();
+ ucl::Result createPopup(const ucl::TString &completeText);
+ ucl::Result createIcon();
+
+ bool resetTimer(double timeout);
+ void stopTimer();
+
+ void tryShowPopup();
+ void dismissPopup(bool force = false);
+
+ void animateIcon();
+
+ Eina_Bool onTimer();
+
+ void onPopupDismissed(ucl::Widget &widget, void *eventInfo);
+ void onPopupHWBackKey(Evas_Object *obj, void *eventInfo);
+
+ private:
+ enum class State {
+ WAITING,
+ PROCESSING,
+ POPUP_ANIMATION,
+ COMPLETE
+ };
+
+ private:
+ const IconType m_iconType;
+ ucl::LayoutSRef m_widget;
+ ucl::StyledWidgetWRef m_popup;
+ ucl::LayoutWRef m_icon;
+ DismissHandler m_dismissHandler;
+ Ecore_Timer *m_timer;
+ State m_state;
+ bool m_mayComplete;
+ bool m_isComplete;
+ };
+}
+
+#endif // __GALLERY_PRESENTERS_PROCESSING_PRESENTER_H__
UCL_DECLARE_REF_ALIASES(ISelectModeListener);
UCL_DECLARE_REF_ALIASES(SelectModePresenter);
+ UCL_DECLARE_REF_ALIASES(ProcessingPresenter);
+
UCL_DECLARE_REF_ALIASES(AlertDialog);
UCL_DECLARE_REF_ALIASES(Page);
enum class Part {
DEFAULT,
+ OVERLAY,
MORE_OPTIONS,
SELECT_BUTTON,
BOTTOM_BUTTON
}
}
+ styles {
+ style { name: "popup_graphic_toast_style";
+ base: "font=Tizen:weight=Normal:width=Condensed font_size=32 color=#fafafaff linesize=42 wrap=mixed align=center ellipsis=1.0 text_class=tizen";
+ }
+ }
+
#include "../../edc/colors.h"
#include "../../edc/images.edc"
#include "../../edc/image-grid.edc"
--- /dev/null
+/*
+ * 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 "presenters/ProcessingPresenter.h"
+
+#include "common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ using namespace ucl;
+
+ constexpr auto IDLE_WAIT_TIME_SEC = 0.2;
+ constexpr auto PROCESSING_MIN_TIME_SEC = 1.0;
+
+ constexpr auto POPUP_SHOW_TIME_SEC = 0.3;
+ constexpr auto POPUP_DURATION_SEC = 2.0;
+ constexpr auto POPUP_TIMEOUT_SEC =
+ (POPUP_DURATION_SEC - POPUP_SHOW_TIME_SEC);
+
+ constexpr LayoutTheme LAYOUT_PROCESSING_WIDGET
+ {"layout", "gallery", "proccessing"};
+
+ constexpr EdjeSignal SIGNAL_SHOW {"gallery,show"};
+ constexpr EdjeSignal SIGNAL_HIDE {"gallery,hide"};
+ constexpr EdjeSignal SIGNAL_HIDE_PROGRESS {"gallery,hide,progress"};
+
+ constexpr LayoutTheme LAYOUT_POPUP_ICON
+ {"layout", "gallery", "popup_icon"};
+
+ constexpr EdjeSignal SIGNAL_ANIMATE_CHECK {"gallery,animate,check"};
+
+ constexpr ElmStyle POPUP_STYLE {"toast/circle"};
+ constexpr EdjePart PART_TOAST_ICON {"toast,icon"};
+}}}
+
+namespace gallery {
+
+ using namespace ucl;
+
+ // ProcessingPresenter::Builder //
+
+ ProcessingPresenter::Builder::Builder() :
+ m_iconType(IconType::NONE)
+ {
+ }
+
+ ProcessingPresenter::Builder &ProcessingPresenter::Builder::
+ setProcessingText(TString text)
+ {
+ m_processingText = std::move(text);
+ return *this;
+ }
+
+ ProcessingPresenter::Builder &ProcessingPresenter::Builder::
+ setCompleteText(TString text)
+ {
+ m_completeText = std::move(text);
+ return *this;
+ }
+
+ ProcessingPresenter::Builder &ProcessingPresenter::Builder::
+ setIconType(const IconType value)
+ {
+ m_iconType = value;
+ return *this;
+ }
+
+ ProcessingPresenterSRef ProcessingPresenter::Builder::
+ build(Widget &parent) const
+ {
+ auto result = makeShared<ProcessingPresenter>(m_iconType);
+
+ FAIL_RETURN_VALUE(result->prepare(parent,
+ m_processingText, m_completeText), {},
+ "result->prepare() failed!");
+
+ return result;
+ }
+
+ // ProcessingPresenter //
+
+ ProcessingPresenter::ProcessingPresenter(RefCountObjBase &rc,
+ const IconType iconType) :
+ RefCountAware(&rc),
+ m_iconType(iconType),
+ m_timer(nullptr),
+ m_state(State::WAITING),
+ m_mayComplete(true),
+ m_isComplete(false)
+ {
+ }
+
+ ProcessingPresenter::~ProcessingPresenter()
+ {
+ stopTimer();
+ dismissPopup(true);
+ }
+
+ Result ProcessingPresenter::prepare(Widget &parent,
+ const TString &processingText,
+ const TString &completeText)
+ {
+ FAIL_RETURN(createWidget(parent, processingText),
+ "createWidget() failed!");
+
+ FAIL_RETURN(createProgress(), "createProgress() failed!");
+
+ FAIL_RETURN(createPopup(completeText), "createPopup() failed!");
+
+ if (m_iconType != IconType::NONE) {
+ FAIL_RETURN(createIcon(), "createIcon() failed!");
+ }
+
+ if (!resetTimer(impl::IDLE_WAIT_TIME_SEC)) {
+ LOG_RETURN(RES_FAIL, "resetTimer() failed!");
+ }
+
+ return RES_OK;
+ }
+
+ Result ProcessingPresenter::createWidget(Widget &parent,
+ const TString &processingText)
+ {
+ m_widget = Layout::Builder().
+ setTheme(impl::LAYOUT_PROCESSING_WIDGET).
+ setIsOwner(true).
+ build(parent);
+ if (!m_widget) {
+ LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+ }
+
+ m_widget->setText(processingText);
+
+ return RES_OK;
+ }
+
+ Result ProcessingPresenter::createProgress()
+ {
+ Evas_Object *const progressEo = elm_progressbar_add(*m_widget);
+ if (!progressEo) {
+ LOG_RETURN(RES_FAIL, "elm_progressbar_add() failed!");
+ }
+
+ StyledWidget progress{progressEo};
+ progress.setStyle(ElmStyle("process"));
+ m_widget->setContent(progress, EdjePart("gallery.swallow.progress"));
+ elm_progressbar_pulse(progress, EINA_TRUE);
+ show(progress);
+
+ return RES_OK;
+ }
+
+ Result ProcessingPresenter::createPopup(const TString &completeText)
+ {
+ Evas_Object *const popupEo = elm_popup_add(*m_widget);
+ if (!popupEo) {
+ LOG_RETURN(RES_FAIL, "elm_popup_add() failed!");
+ }
+
+ m_popup = makeShared<StyledWidget>(popupEo);
+ m_popup->setStyle(impl::POPUP_STYLE);
+ m_popup->setText(completeText, PART_TEXT);
+
+ m_popup->addEventHandler(POPUP_DISMISSED, WEAK_DELEGATE(
+ ProcessingPresenter::onPopupDismissed, asWeak(*this)));
+
+ eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK,
+ CALLBACK_A(ProcessingPresenter::onPopupHWBackKey), this);
+
+ return RES_OK;
+ }
+
+ Result ProcessingPresenter::createIcon()
+ {
+ m_icon = Layout::Builder().
+ setTheme(impl::LAYOUT_POPUP_ICON).
+ build(*m_popup);
+ if (!m_icon) {
+ LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+ }
+
+ m_popup->setContent(*m_icon, impl::PART_TOAST_ICON);
+
+ return RES_OK;
+ }
+
+ bool ProcessingPresenter::resetTimer(const double timeout)
+ {
+ stopTimer();
+
+ m_timer = ecore_timer_add(timeout, CALLBACK_A(
+ ProcessingPresenter::onTimer), this);
+ if (!m_timer) {
+ LOG_RETURN_VALUE(RES_FAIL, false, "ecore_timer_add() failed!");
+ }
+
+ return true;
+ }
+
+ void ProcessingPresenter::stopTimer()
+ {
+ if (m_timer) {
+ ecore_timer_del(m_timer);
+ m_timer = nullptr;
+ }
+ }
+
+ void ProcessingPresenter::tryShowPopup()
+ {
+ if (m_isComplete && m_mayComplete && m_popup) {
+ m_widget->emit(impl::SIGNAL_HIDE_PROGRESS);
+
+ show(*m_popup);
+
+ m_state = State::POPUP_ANIMATION;
+ resetTimer(impl::POPUP_SHOW_TIME_SEC);
+ }
+ }
+
+ void ProcessingPresenter::dismissPopup(const bool force)
+ {
+ if (m_popup) {
+ eext_object_event_callback_del(*m_popup, EEXT_CALLBACK_BACK,
+ CALLBACK_A(ProcessingPresenter::onPopupHWBackKey));
+ if (force) {
+ m_popup->markForDeletion();
+ } else {
+ elm_popup_dismiss(*m_popup);
+ }
+ m_popup.reset();
+ }
+ }
+
+ void ProcessingPresenter::animateIcon()
+ {
+ if (m_icon) {
+ if (m_iconType == IconType::CHECK) {
+ m_icon->emit(impl::SIGNAL_ANIMATE_CHECK);
+ }
+ }
+ }
+
+ Eina_Bool ProcessingPresenter::onTimer()
+ {
+ m_timer = nullptr;
+
+ switch (m_state) {
+ case State::WAITING:
+ m_widget->emit(impl::SIGNAL_SHOW);
+ m_state = State::PROCESSING;
+ m_mayComplete = false;
+ resetTimer(impl::PROCESSING_MIN_TIME_SEC);
+ break;
+
+ case State::PROCESSING:
+ m_mayComplete = true;
+ tryShowPopup();
+ break;
+
+ case State::POPUP_ANIMATION:
+ animateIcon();
+ m_widget->emit(impl::SIGNAL_HIDE);
+ m_state = State::COMPLETE;
+ resetTimer(impl::POPUP_TIMEOUT_SEC);
+ break;
+
+ case State::COMPLETE:
+ dismissPopup();
+ break;
+ }
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ void ProcessingPresenter::onPopupDismissed(Widget &widget, void *eventInfo)
+ {
+ widget.markForDeletion();
+
+ if (m_dismissHandler) {
+ m_dismissHandler();
+ }
+ }
+
+ void ProcessingPresenter::onPopupHWBackKey(
+ Evas_Object *obj, void *eventInfo)
+ {
+ if (m_popup) {
+ m_widget->emit(impl::SIGNAL_HIDE);
+ stopTimer();
+ dismissPopup();
+ }
+ }
+
+ Widget &ProcessingPresenter::getWidget()
+ {
+ return *m_widget;
+ }
+
+ void ProcessingPresenter::complete(const DismissHandler &dismissHandler)
+ {
+ if (!dismissHandler) {
+ LOG_RETURN_VOID(RES_INVALID_ARGUMENTS, "dismissHandler is NULL");
+ }
+ if (m_isComplete) {
+ LOG_RETURN_VOID(RES_ILLEGAL_STATE, "Already in complete state!");
+ }
+
+ m_dismissHandler = dismissHandler;
+ m_isComplete = true;
+
+ tryShowPopup();
+ }
+}
{"layout", "bottom_button", "default"};
constexpr EdjePart PART_MORE_OPTIONS {"gallery.swallow.more_options"};
+ constexpr EdjePart PART_OVERLAY {"gallery.swallow.overlay"};
constexpr EdjeSignal SIGNAL_SHOW_SELECT_BUTTON {"select_mode,button,show"};
constexpr EdjeSignal SIGNAL_HIDE_SELECT_BUTTON {"select_mode,button,hide"};
switch (part) {
case Part::DEFAULT:
return impl::callSafe(getTopLayout(), func, PART_CONTENT);
+ case Part::OVERLAY:
+ return impl::callSafe(m_moreOptions.get(), func,
+ impl::PART_OVERLAY);
case Part::MORE_OPTIONS:
return impl::callSafe(m_moreOptions.get(), func,
impl::PART_MORE_OPTIONS);
#include "ucl/appfw/InstanceManagerBase.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/appfw/SysEventProvider.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include <app.h>
#include "ucl/appfw/IInstanceAppControlExt.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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 __UCL_APPFW_COMMON_H__
+#define __UCL_APPFW_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_APPFW_COMMON_H__
#include "ucl/appfw/helpers.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/gui/stdTheme/layout.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/gui/Naviframe.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/gui/Widget.h"
-#include "../common.h"
+#include "common.h"
namespace ucl { namespace { namespace impl {
#include "ucl/gui/Window.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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 __UCL_GUI_COMMON_H__
+#define __UCL_GUI_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_GUI_COMMON_H__
#include "ucl/misc/Variant.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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 __UCL_MISC_COMMON_H__
+#define __UCL_MISC_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_MISC_COMMON_H__