{
class MsgEngine;
class ContactManager;
+ class IAppListener;
class App
{
const SystemSettingsManager &getSysSettingsManager() const;
void exit();
+ void addListener(IAppListener &l);
+ void removeListener(IAppListener &l);
+ bool isPause() const;
protected:
bool init();
+ void pause();
+ void resume();
private:
virtual void terminate() = 0;
PopupManager *m_pPopupManager;
ThumbnailMaker *m_pThumbnailMaker;
SystemSettingsManager *m_pSysSettingsManager;
+ std::list<IAppListener*> m_Listeners;
+ bool m_IsPause;
+ };
+
+ class IAppListener
+ {
+ public:
+ virtual ~IAppListener() {}
+ virtual void onAppPause() {};
+ virtual void onAppResume() {};
};
}
virtual NaviFrameController &getParent();
void pop();
+ void pause();
+ void resume();
+ bool isPause() const;
+
protected:
void setNaviBarTitle(const MsgAddressList &addressList);
// NaviFrameItem
virtual void onAttached(ViewItem &item);
+ virtual void onPause() {};
+ virtual void onResume() {};
+
+ private:
+ bool m_IsPause;
};
}
#include "AppControlCommand.h"
#include "AppControlCompose.h"
#include "AppControlDefault.h"
+#include "App.h"
namespace Msg
{
: public ViewController
, public NaviFrameView
, private IHwButtonListener
+ , private IAppListener
{
public:
NaviFrameController(App &app);
void destroy();
private:
- void init();
template<typename T>
T *getTopFrame() const;
+ FrameController *getTopFrame() const;
bool prepare(const AppControlCommand &cmd);
+ void registerHWButtonEvent();
bool isUnreadNotificationSingle(AppControlDefault::DefaultType type) const;
+ // H/W buttons:
virtual void onHwBackButtonClicked();
virtual void onHwMoreButtonClicked();
- private:
- void registerHWButtonEvent();
+ // NaviFrameView:
+ virtual void onPause(NaviFrameItem &item);
+ virtual void onResume(NaviFrameItem &item);
+ virtual void onBeforeDelete(View &view);
+
+ // App:
+ virtual void onAppPause();
+ virtual void onAppResume();
};
}
#include "ContactManager.h"
#include "PathUtils.h"
+#include <algorithm>
+
using namespace Msg;
App::App()
, m_pPopupManager(nullptr)
, m_pThumbnailMaker(nullptr)
, m_pSysSettingsManager(nullptr)
+ , m_IsPause(true)
{
int serviceResult = m_Engine.openService();
if(serviceResult != MESSAGES_ERROR_NONE)
{
terminate();
}
+
+void App::addListener(IAppListener &l)
+{
+ auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &l);
+ if(found == m_Listeners.end())
+ m_Listeners.push_back(&l);
+}
+
+void App::removeListener(IAppListener &l)
+{
+ auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &l);
+ if(found != m_Listeners.end())
+ m_Listeners.erase(found);
+}
+
+bool App::isPause() const
+{
+ return m_IsPause;
+}
+
+void App::pause()
+{
+ m_IsPause = true;
+ for(IAppListener *l : m_Listeners)
+ l->onAppPause();
+}
+
+void App::resume()
+{
+ m_IsPause = false;
+ for(IAppListener *l : m_Listeners)
+ l->onAppResume();
+}
FrameController::FrameController(NaviFrameController &parent)
: ViewItemController(&parent)
, NaviFrameItem(parent)
+ , m_IsPause(true)
{
}
getNaviBar().showButton(NaviCenterButtonId, true);
getNaviBar().setButtonText(NaviCenterButtonId, title);
}
+
+void FrameController::pause()
+{
+ if(!m_IsPause)
+ {
+ m_IsPause = true;
+ onPause();
+ }
+}
+
+void FrameController::resume()
+{
+ if(m_IsPause)
+ {
+ m_IsPause = false;
+ onResume();
+ }
+}
+
+bool FrameController::isPause() const
+{
+ return m_IsPause;
+}
: ViewController(app)
, NaviFrameView(app.getWindow())
{
- init();
+ setHwButtonListener(getEo(), this);
+ getApp().addListener(*this);
}
NaviFrameController::~NaviFrameController()
MSG_LOG("Destructor: ", this);
}
-void NaviFrameController::init()
-{
- setHwButtonListener(getEo(), this);
-}
-
void NaviFrameController::pop(FrameController &frame)
{
if(isLastFrame())
return nullptr;
}
+FrameController *NaviFrameController::getTopFrame() const
+{
+ return static_cast<FrameController*>(NaviFrameView::getTopFrame());
+}
+
bool NaviFrameController::isUnreadNotificationSingle(AppControlDefault::DefaultType type) const
{
return type == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() == 1;
void NaviFrameController::onHwBackButtonClicked()
{
- pop();
+ auto *top = getTopFrame();
+ if(top)
+ pop(*top);
}
void NaviFrameController::onHwMoreButtonClicked()
{
+}
+
+void NaviFrameController::onPause(NaviFrameItem &item)
+{
+ static_cast<FrameController&>(item).pause();
+}
+
+void NaviFrameController::onResume(NaviFrameItem &item)
+{
+ static_cast<FrameController&>(item).resume();
+}
+void NaviFrameController::onAppPause()
+{
+ auto *top = getTopFrame();
+ if(top)
+ top->pause();
+}
+
+void NaviFrameController::onAppResume()
+{
+ auto *top = getTopFrame();
+ if(top)
+ top->resume();
+}
+
+void NaviFrameController::onBeforeDelete(View &view)
+{
+ NaviFrameView::onBeforeDelete(view);
+ getApp().removeListener(*this);
}
*/
bool getTransitionStatus() const;
+ protected:
+ virtual void onPause(NaviFrameItem &item) {};
+ virtual void onResume(NaviFrameItem &item) {};
+ virtual void onBeforeDelete(View &view);
+
private:
void create(Evas_Object *parent);
+ void pause();
+ void resume();
void onTransitionFinished(Evas_Object *obj, void *eventInfo);
private:
show();
}
+void NaviFrameView::pause()
+{
+ NaviFrameItem *top = getTopFrame();
+ if(top)
+ onPause(*top);
+}
+
+void NaviFrameView::resume()
+{
+ NaviFrameItem *top = getTopFrame();
+ if(top)
+ onResume(*top);
+}
+
bool NaviFrameView::isLastFrame() const
{
return elm_naviframe_bottom_item_get(getEo()) == elm_naviframe_top_item_get(getEo());
void NaviFrameView::push(NaviFrameItem &item, Evas_Object *content)
{
m_TransitionStatus = !isEmpty();
+ pause();
Elm_Object_Item *it = elm_naviframe_item_push(getEo(), nullptr, nullptr, nullptr, content, naviTitleStyleEmpty);
item.setElmObjItem(it);
processSignal();
+ resume();
}
void NaviFrameView::push(NaviFrameItem &item, View &content)
if(getTopFrame() == &item)
{
m_TransitionStatus = getItemsCount() > 1;
+ pause();
elm_naviframe_item_pop(getEo());
+ resume();
}
else
{
+ pause();
item.destroy();
+ resume();
}
}
}
if(before)
{
insert = elm_naviframe_item_insert_before(getEo(), before, nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty);
+ item.setElmObjItem(insert);
}
else
{
m_TransitionStatus = !isEmpty();
+ pause();
insert = elm_naviframe_item_push(getEo(), nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty);
+ item.setElmObjItem(insert);
+ resume();
}
-
- item.setElmObjItem(insert);
}
void NaviFrameView::promote(NaviFrameItem &item)
{
- m_TransitionStatus = &item != getTopFrame();
- elm_naviframe_item_promote(item);
+ bool isTop = &item != getTopFrame();
+ if(!isTop)
+ {
+ m_TransitionStatus = true;
+ pause();
+ elm_naviframe_item_promote(item);
+ resume();
+ }
}
void NaviFrameView::onTransitionFinished(Evas_Object *obj, void *eventInfo)
transFinishedItem->onTransitionFinished(*transFinishedItem);
}
+void NaviFrameView::onBeforeDelete(View &view)
+{
+ pause();
+}
+
bool NaviFrameView::getTransitionStatus() const
{
// TODO: Move functionality for gets TransitionStatus to EFL (elm_naviframe) side.
virtual void onAttached(ViewItem &item);
virtual void onTransitionFinished(NaviFrameItem &item);
virtual void onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId);
+ virtual void onPause();
+ virtual void onResume();
// IHwButtonListener:
virtual void onHwBackButtonClicked();
}
}
+void Conversation::onPause()
+{
+ MSG_LOG("");
+}
+
+void Conversation::onResume()
+{
+ MSG_LOG("");
+}
+
void Conversation::onHwBackButtonClicked()
{
MSG_LOG("");
void MainApp::onAppPause()
{
TRACE;
+ App::pause();
}
void MainApp::onAppResume()
{
TRACE;
+ App::resume();
}
void MainApp::onAppControl(app_control_h app_control)