*/
void setIndicator(UiViewIndicator indicator);
+ /**
+ * @brief Prepare the top view to be shown instantly.
+ *
+ * @remark This interface may called when top view should be prepared. If the current visible view is removed unexpectedly, the view manager requests
+ * the next top view by calling this interface(except push, pop, insert).
+ *
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #UI_VIEWMGR_ERROR_NONE Successful
+ */
+ int activateTopView() override;
+
/**
* @brief This is a constructor for initializing viewmgr.
*
*
* @warning This function must be called when push transition is finished.
*/
- void popViewFinished(UiIfaceView *view);
+ virtual void popViewFinished(UiIfaceView *view);
/**
* @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
*/
UiIfaceView *getLastView();
+ /**
+ * @brief Prepare the top view to be shown instantly.
+ *
+ * @remark This interface may called when top view should be prepared. If the current visible view is removed unexpectedly, the view manager requests
+ * the next top view by calling this interface(except push, pop, insert).
+ *
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #UI_VIEWMGR_ERROR_NONE Successful
+ */
+ virtual int activateTopView() = 0;
+
///Constructor.
UiIfaceViewmgr();
bool _createBaseLayout(Elm_Scroller *scroller, const char *style);
void _setIndicator(UiViewIndicator indicator) noexcept;
void _setAvailableRotations(UiBaseView *view) noexcept;
- void _activateTopView();
bool _init();
bool _term();
void deactivate() noexcept;
void pushView(UiBaseView *view);
void popView();
+ int activateTopView() noexcept;
Eo *getBase() const {
return this->_layout;
return this->_layout;
}
-void UiBaseViewmgrImpl::_activateTopView()
+int UiBaseViewmgrImpl::activateTopView() noexcept
{
Eo *pcontent = elm_object_part_content_unset(this->getBase(), "content");
if (pcontent) evas_object_hide(pcontent);
this->_setAvailableRotations(view);
this->_setIndicator(view->getIndicator());
+
+ return UI_VIEWMGR_ERROR_NONE;
}
//FIXME: How to deal with indicator in other UI framework? Dali? Volt?
void UiBaseViewmgrImpl::activate() noexcept
{
- this->_activateTopView();
evas_object_show(this->_win);
}
if (!strcmp(view->getTransitionStyle(), "none")) {
this->_viewmgr->popViewFinished(pview);
this->_viewmgr->popViewFinished(view);
- this->_activateTopView();
+ this->activateTopView();
return;
}
LOGE("invalid effect transition style?! = %s", view->getTransitionStyle());
this->_viewmgr->popViewFinished(pview);
this->_viewmgr->popViewFinished(view);
- this->_activateTopView();
+ this->activateTopView();
return;
}
//In case, if viewmgr has one view, we skip effect.
if (this->_viewmgr->getViewCount() == 1) {
- this->_activateTopView();
this->_viewmgr->pushViewFinished(view);
+ this->activateTopView();
return;
}
//In case, if view doesn't have transition effect
if (!strcmp(view->getTransitionStyle(), "none")) {
- this->_activateTopView();
this->_viewmgr->pushViewFinished(pview);
this->_viewmgr->pushViewFinished(view);
+ this->activateTopView();
return;
}
Elm_Layout *effect = this->_setTransitionLayout(view->getTransitionStyle());
if (!effect) {
LOGE("invalid effect transition style?! = %s", view->getTransitionStyle());
- this->_activateTopView();
this->_viewmgr->pushViewFinished(pview);
this->_viewmgr->pushViewFinished(view);
+ this->activateTopView();
return;
}
{
this->_impl->_setIndicator(indicator);
}
+
+int UiBaseViewmgr::activateTopView()
+{
+ this->_impl->activateTopView();
+}
{
if (!this->_layout) return false;
+ //clean up sub contents in advance
+ if (this->_titleLeftBtn) {
+ evas_object_event_callback_del(this->_titleLeftBtn, EVAS_CALLBACK_DEL, _titleLeftBtnDelCb);
+ this->_titleLeftBtn = nullptr;
+ }
+ if (this->_titleRightBtn) {
+ evas_object_event_callback_del(this->_titleRightBtn, EVAS_CALLBACK_DEL, _titleRightBtnDelCb);
+ this->_titleRightBtn = nullptr;
+ }
+ if (this->_toolbar) {
+ evas_object_event_callback_del(this->_toolbar, EVAS_CALLBACK_DEL, _toolbarDelCb);
+ this->_toolbar = nullptr;
+ }
+
evas_object_del(this->_layout);
this->_layout = nullptr;
UiIfaceViewImpl::~UiIfaceViewImpl()
{
+ bool activateTopView = false; //If this view is deleted instantly.
//This view is destroyed instantly.
if (this->_viewmgr && !this->_popping)
if ((view_count > 1) && (this->_viewmgr->getLastView() == this->_view))
{
auto pview = this->_viewmgr->getView(view_count - 2);
+ pview->onLoad();
this->_viewmgr->popViewFinished(pview);
+ activateTopView = true;
}
this->onUnload();
this->onDestroy();
}
- if (this->_viewmgr) this->_viewmgr->removeView(this->_view);
+ if (this->_viewmgr) {
+ auto* viewmgr = this->_viewmgr;
+ this->_viewmgr->removeView(this->_view);
+ if (activateTopView) viewmgr->activateTopView();
+ }
+
if (this->_rotations) delete[](this->_rotations);
}