View life-cycle hasn't been tested strictly.
So, I tested it and fix all corner cases that I could find.
Change-Id: Ia18c3b029e0302487978a03cb6e136d13f5b1ebf
*
* @see deactivate()
*/
- virtual int activate() = 0;
+ virtual int activate();
/**
* @brief Overlay deactivate.
*
* @see activate()
*/
- virtual int deactivate() = 0;
+ virtual int deactivate();
/**
* @brief Returns the active status of overlay.
_UI_DECLARE_PRIVATE_IMPL(UiIfaceView);
_UI_DECLARE_FRIENDS(UiIfaceViewmgr);
_UI_DECLARE_FRIENDS(UiIfaceApp);
+ _UI_DECLARE_FRIENDS(UiIfaceOverlay);
};
}
menu->unsetContent();
}
-static bool _updateMenu(UiMenu *menu)
+static int _updateMenu(UiMenu *menu)
{
Elm_Win *win = menu->getBase();
if (!win) return UI_VIEWMGR_ERROR_NOT_PERMITTED;
}
elm_ctxpopup_dismiss(ctxpopup);
- dynamic_cast<UiView *>(this->getView())->onResume();
- return UI_VIEWMGR_ERROR_NONE;
+ return UiBaseOverlay::deactivate();
}
int UiMenu::activate()
{
- bool ret = _updateMenu(this);
+ int ret = UiBaseOverlay::activate();
+
+ if (ret != UI_VIEWMGR_ERROR_NONE) return ret;
+
+ ret = _updateMenu(this);
if (ret != UI_VIEWMGR_ERROR_NONE) dynamic_cast<UiView *>(this->getView())->onPause();
return ret;
static int _updatePopup(UiPopup *popup)
{
- if (popup->getView()->getState() != UI_VIEW_STATE_ACTIVATE)
+ if (popup->getView()->getState() != UI_VIEW_STATE_PAUSE)
return UI_VIEWMGR_ERROR_NOT_PERMITTED;
Elm_Win *win = popup->getBase();
}
elm_popup_dismiss(popup);
- dynamic_cast<UiView*>(this->getView())->onResume();
- return UI_VIEWMGR_ERROR_NONE;
+ return UiBaseOverlay::deactivate();
}
int UiPopup::activate()
{
- int ret = _updatePopup(this);
- if (ret != UI_VIEWMGR_ERROR_NONE) dynamic_cast<UiView*>(this->getView())->onPause();
+ int ret = UiBaseOverlay::activate();
+ if (ret != UI_VIEWMGR_ERROR_NONE) return ret;
+
+ ret = _updatePopup(this);
return ret;
}
return this->_view;
}
-
/***********************************************************************************************/
/* External class Implementation */
/***********************************************************************************************/
{
this->deactivate();
}
+
+int UiIfaceOverlay::activate()
+{
+ this->_impl->_view->onPause();
+
+ return UI_VIEWMGR_ERROR_NONE;
+}
+
+int UiIfaceOverlay::deactivate()
+{
+ this->_impl->_view->onResume();
+
+ return UI_VIEWMGR_ERROR_NONE;
+}
if ((view_count > 1) && (this->_viewmgr->getLastView() == this->_view))
{
auto pview = this->_viewmgr->getView(view_count - 2);
- pview->onLoad();
+ if (!pview->getContent()) pview->onLoad();
this->_viewmgr->popViewFinished(pview);
activateTopView = true;
}
//If view manager is not activated yet, don't load view.
if (!this->isActivated()) return UI_VIEWMGR_ERROR_NONE;
- view->onLoad();
- view->onDeactivate();
+ if (!view->getContent()) view->onLoad();
if (this->_viewList.size() != 1) {
this->setEventBlock(view, true);
auto nx = prev(this->_viewList.end(), 2);
auto pview = *nx;
pview->_setPopping(true);
- pview->onLoad();
+ if (!pview->getContent()) pview->onLoad();
pview->onDeactivate();
this->setEventBlock(pview, true);
auto view = this->getLastView();
- view->onLoad();
- view->onDeactivate();
+ if (!view->getContent()) view->onLoad();
view->onActivate();
this->_inst->activateTopView();