//The previous view has been pushed. This should be unload.
if (last != view) {
- view->onUnload();
+ if (view->getContent()) {
+ view->onUnload();
+ }
return;
}
//A new view has been pushed. This should be activate.
- view->onActivate();
+ if (view->getContent()) view->onActivate();
this->setEventBlock(view, false);
}
//This view has been popped. It should be destroyed.
if (last == view) {
- view->onUnload();
- view->onDestroy();
- delete (view);
+ this->_inst->destroyView(view);
return;
}
//The previous view has been popped. It should become activate.
- view->onActivate();
+ if (view->getContent()) view->onActivate();
this->setEventBlock(view, false);
view->_setPopping(false);
}
{
//Terminate views
this->_destroying = EINA_TRUE;
+
for (auto ritr = this->_viewList.rbegin(); ritr != this->_viewList.rend(); ritr++) {
auto view = *ritr;
- if ((view->getState() != UI_VIEW_STATE_DEACTIVATE) &&
- (view->getState() != UI_VIEW_STATE_UNLOAD)) {
- view->onDeactivate();
- }
- if (view->getState() != UI_VIEW_STATE_UNLOAD) {
- view->onUnload();
+ if (view->getState() == UI_VIEW_STATE_DESTROY) {
+ continue;
}
-
view->onDestroy();
- delete (view);
+ view->_setViewmgr(nullptr);
+ delete(view);
}
this->_destroying = EINA_FALSE;
//Previous view
if (this->_viewList.size() > 0) {
pview = this->_viewList.back();
- pview->onDeactivate();
+ if (pview->getContent()) {
+ pview->onDeactivate();
+ }
this->setEventBlock(pview, true);
}
if (this->getViewCount() == 1) {
//destroy viewmgr?
UiIfaceView*view = this->_viewList.back();
- view->onDeactivate();
- view->onUnload();
- view->onDestroy();
- delete(view);
+ this->_inst->destroyView(view);
return UI_VIEWMGR_ERROR_NONE;
}
view->_setPopping(true);
- view->onDeactivate();
+ if (view->getContent()) {
+ view->onDeactivate();
+ }
this->setEventBlock(view, true);
//Below object has to be used in child class...
auto pview = *nx;
pview->_setPopping(true);
if (!pview->getContent()) pview->onLoad();
- pview->onDeactivate();
this->setEventBlock(pview, true);
return UI_VIEWMGR_ERROR_NONE;
if (!view) {
LOGE("invalid view argument. view(nullptr)");
return UI_VIEWMGR_ERROR_INVALID_PARAMETER;
-
}
if (view == before) {
auto view = this->getLastView();
if (!view->getContent()) view->onLoad();
- view->onActivate();
+ if (view->getContent()) view->onActivate();
this->_inst->activateTopView();
auto view = this->getLastView();
- if ((view->getState() != UI_VIEW_STATE_DEACTIVATE) &&
- (view->getState() != UI_VIEW_STATE_UNLOAD)) {
- view->onDeactivate();
- }
- if (view->getState() != UI_VIEW_STATE_UNLOAD) {
+ if (view->getContent()) {
+ if ((view->getState() == UI_VIEW_STATE_ACTIVATE) || (view->getState() == UI_VIEW_STATE_PAUSE)) {
+ view->onDeactivate();
+ }
view->onUnload();
}
{
return UiIfaceViewmgrImpl::getInstance();
}
+
+int UiIfaceViewmgr::destroyView(UiIfaceView *view)
+{
+ if (!view) {
+ LOGE("invalid view argument. view(nullptr)");
+ return UI_VIEWMGR_ERROR_INVALID_PARAMETER;
+ }
+
+ if (view->getState() == UI_VIEW_STATE_DESTROY)
+ {
+ LOGE("this view(%p) is already on destroying");
+ return UI_VIEWMGR_ERROR_ALREADY_IN_PROGRESS;
+ }
+
+ if (view->getContent()) {
+ if ((view->getState() == UI_VIEW_STATE_ACTIVATE) || (view->getState() == UI_VIEW_STATE_PAUSE)) {
+ view->onDeactivate();
+ }
+ view->onUnload();
+ }
+ view->onDestroy();
+
+ delete(view);
+
+ return UI_VIEWMGR_ERROR_NONE;
+}