introduce ui_base_app class. 92/72292/1
authorHermet Park <hermet@hermet.pe.kr>
Tue, 31 May 2016 09:55:52 +0000 (18:55 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Tue, 31 May 2016 09:55:52 +0000 (18:55 +0900)
this is a base app class for all profiles.

Change-Id: I4e49810aae0246db9cbfc9465b5055e882f4f5d6

src/CMakeLists.txt
src/include/efl/mobile/ui_app.h
src/include/efl/mobile/ui_viewmgr.h
src/include/efl/ui_base_app.h [new file with mode: 0644]
src/include/efl/ui_base_viewmanager.h
src/include/efl/ui_base_viewmgr.h
src/include/ui_viewmanager.h
src/lib/CMakeLists.txt
src/lib/efl/mobile/ui_app.cpp
src/lib/efl/ui_base_app.cpp [new file with mode: 0644]

index 52a2bb9936c6e43570a56f96937db6365af4dd60..48ed9d5f3b9e76d6a6202bdb7f3c3bcaf757939e 100644 (file)
@@ -3,4 +3,5 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/lib)
 
 ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(lib)
-ADD_SUBDIRECTORY(examples/efl/c)
+ADD_SUBDIRECTORY(examples/efl/cpp)
+#ADD_SUBDIRECTORY(examples/efl/c)
index 7467c15f00a7788acd34a3ceadaaed3d3228d092..61d314be25030a9915962afc210347d24bde925c 100644 (file)
@@ -22,7 +22,7 @@ namespace efl_viewmanager
 
 class ui_viewmgr;
 
-class ui_app
+class ui_app : public ui_base_app
 {
 public:
        /**
@@ -50,89 +50,7 @@ public:
         */
        static ui_app *get_instance();
 
-       /**
-        *  @brief Application life-cycle start and add application event callback functions add.
-        *
-        *  @note This is calling ui_app_main function to start application life-cycle start.
-        *        and adding all of the functions for application events handling such as
-        *        create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY
-        *        APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED.
-        *        Application can add those events using wrapping functions by viewmgr supported.
-        */
-       virtual int run(int argc, char **argv);
-
-protected:
-       /**
-        *  @brief Calling before the main event loop start.
-        *
-        *  @note Take necessary actions like a Initialize UI resources and application data.
-        *
-        *  @return If this function returns true, the application main loop starts.
-        *          If this function returns false, the application terminates.
-        */
-       virtual bool on_create();
-
-       /**
-        *  @brief Calling before the main event loop finish.
-        *
-        *  @note Release all resources here.
-        */
-       virtual void on_terminate();
-
-       /**
-        *  @brief Calling when application becomes invisible.
-        */
-       virtual void on_pause();
-
-       /**
-        *  @brief Calling when application becomes visible.
-        */
-       virtual void on_resume();
-
-       /**
-        *  @brief Calling when gets a launch request event.
-        *
-        *  @param app_control_h The instance of app_control_h.
-        */
-       virtual void on_control(app_control_h app_control);
-
-       /**
-        *  @brief Calling when device low battery.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_low_battery(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device low memory.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_low_memory(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device region changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_region_changed(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device orient changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_orient_changed(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when language changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_lang_changed(app_event_info_h event_info);
-
 private:
-       _UI_DECLARE_PRIVATE_IMPL(ui_app);
        _UI_DISABLE_COPY_AND_ASSIGN(ui_app);
 };
 
index 1a29c55d8e97ad2a6c3f3684c9536f87ccc11e17..d285c5c45a564cf1fa3adce6d739bee761344c15 100644 (file)
@@ -47,7 +47,6 @@ protected:
        virtual ~ui_viewmgr();
 
 private:
-       _UI_DECLARE_PRIVATE_IMPL(ui_viewmgr);
        _UI_DISABLE_COPY_AND_ASSIGN(ui_viewmgr);
        _UI_DECLARE_FRIENDS(ui_view);
        _UI_DECLARE_FRIENDS(ui_app);
diff --git a/src/include/efl/ui_base_app.h b/src/include/efl/ui_base_app.h
new file mode 100644 (file)
index 0000000..7f50d57
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  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 _UI_BASE_APP_H_
+#define _UI_BASE_APP_H_
+
+namespace efl_viewmanager
+{
+
+class ui_base_viewmgr;
+
+class ui_base_app
+{
+public:
+       /**
+        *  @brief This is a constructor for initializing ui_base_app.
+        *
+        *  @param pkg The name of package.
+        *  @param loale_dir The path of locale directory.
+        *  @param viewmgr instance of ui_viewmgr.
+        */
+       ui_base_app(const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr);
+
+       ///Destructor.
+       virtual ~ui_base_app();
+
+       /**
+        *  @brief Return the viewmgr instance.
+        *
+        *  @return ui_viewmgr instance.
+        */
+       ui_base_viewmgr *get_viewmgr();
+
+       /**
+        *  @brief Return ui_base_app instance.
+        *
+        *  @return The instance of ui_base_app.
+        */
+       static ui_base_app *get_instance();
+
+       /**
+        *  @brief Application life-cycle start and add application event callback functions add.
+        *
+        *  @note This is calling ui_base_app_main function to start application life-cycle start.
+        *        and adding all of the functions for application events handling such as
+        *        create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY
+        *        APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED.
+        *        Application can add those events using wrapping functions by viewmgr supported.
+        */
+       virtual int run(int argc, char **argv);
+
+protected:
+       /**
+        *  @brief Calling before the main event loop start.
+        *
+        *  @note Take necessary actions like a Initialize UI resources and application data.
+        *
+        *  @return If this function returns true, the application main loop starts.
+        *          If this function returns false, the application terminates.
+        */
+       virtual bool on_create();
+
+       /**
+        *  @brief Calling before the main event loop finish.
+        *
+        *  @note Release all resources here.
+        */
+       virtual void on_terminate();
+
+       /**
+        *  @brief Calling when application becomes invisible.
+        */
+       virtual void on_pause();
+
+       /**
+        *  @brief Calling when application becomes visible.
+        */
+       virtual void on_resume();
+
+       /**
+        *  @brief Calling when gets a launch request event.
+        *
+        *  @param app_control_h The instance of app_control_h.
+        */
+       virtual void on_control(app_control_h app_control);
+
+       /**
+        *  @brief Calling when device low battery.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_low_battery(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device low memory.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_low_memory(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device region changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_region_changed(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device orient changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_orient_changed(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when language changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_lang_changed(app_event_info_h event_info);
+
+private:
+       _UI_DECLARE_PRIVATE_IMPL(ui_base_app);
+       _UI_DISABLE_COPY_AND_ASSIGN(ui_base_app);
+};
+
+}
+
+#endif /* _UI_BASE_APP_H_ */
index ff4f8402dbffec38f8cb8b6dc53487e91427aff3..5c715c4bef3d5f7076f1fdc49b3bcb96b33b1f2a 100644 (file)
@@ -28,6 +28,7 @@
 #include "ui_base_key_listener.h"
 #include "ui_base_viewmgr.h"
 #include "ui_base_view.h"
+#include "ui_base_app.h"
 
 #define UI_BASE_VIEWMGR dynamic_cast<ui_base_viewmgr *>(ui_iface_viewmgr::get_instance())
 
index b44fdc8d792d60bd68d96e358103696859650da1..c124368554e14f8ba1c5e3f0d0b1ebd103c8560d 100644 (file)
@@ -192,6 +192,7 @@ private:
        _UI_DECLARE_PRIVATE_IMPL(ui_base_viewmgr);
        _UI_DISABLE_COPY_AND_ASSIGN(ui_base_viewmgr);
        _UI_DECLARE_FRIENDS(ui_base_view);
+       _UI_DECLARE_FRIENDS(ui_base_app);
 };
 
 }
index be890fa90f92be382b157f1996ccdb4e86f9da51..e1fbd09e87aeb44fda08458505db2acb6274c147 100644 (file)
@@ -15,5 +15,5 @@
  *
  */
 //FIXME: C++ app include below.
-//#include "efl/mobile/ui_mobile_viewmanager.h"
-#include "efl/mobile/c/ui_mobile_viewmanager.h"
+#include "efl/mobile/ui_mobile_viewmanager.h"
+//#include "efl/mobile/c/ui_mobile_viewmanager.h"
index 0edf5750632fdc7e996269f798635eddb31b40c4..150b8920498be7cd30038c72a9c13b66476515f3 100644 (file)
@@ -2,6 +2,7 @@ SET(SRCS
      interface/ui_iface_overlay.cpp
      interface/ui_iface_view.cpp
      interface/ui_iface_viewmgr.cpp
+     efl/ui_base_app.cpp
      efl/ui_base_view.cpp
      efl/ui_base_viewmgr.cpp
      efl/ui_base_key_listener.cpp
@@ -13,11 +14,11 @@ SET(SRCS
      efl/mobile/ui_standard_view.cpp
      efl/mobile/ui_key_listener.cpp
      efl/mobile/ui_viewmgr.cpp
-     efl/mobile/c/ui_app.cpp
-     efl/mobile/c/ui_menu.cpp
-     efl/mobile/c/ui_popup.cpp
-     efl/mobile/c/ui_view.cpp
-     efl/mobile/c/ui_viewmgr.cpp
+#     efl/mobile/c/ui_app.cpp
+#     efl/mobile/c/ui_menu.cpp
+#     efl/mobile/c/ui_popup.cpp
+#     efl/mobile/c/ui_view.cpp
+#     efl/mobile/c/ui_viewmgr.cpp
     )
 
 ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
index 0737421cdd1558cedc8ae4e627c70695d467211c..ce71b9eff249e48c8635440bce07105a2811eee1 100644 (file)
 /***********************************************************************************************/
 /* Internal class Implementation                                                               */
 /***********************************************************************************************/
-namespace efl_viewmanager
-{
-
-class ui_app_impl
-{
-       friend class ui_app;
-
-private:
-       ui_app *app;
-       ui_viewmgr *viewmgr;
-       Eina_Stringshare *pkg;
-       Eina_Stringshare *locale_dir;
-
-public:
-       ui_app_impl(ui_app *ui_app, const char *pkg, const char *locale_dir);
-       ~ui_app_impl();
-
-       int run(int argc, char **argv);
-       ui_viewmgr *get_viewmgr();
-
-       bool init();
-       bool on_create();
-       void on_terminate();
-       void on_pause();
-       void on_resume();
-       void on_control(app_control_h app_control);
-       void on_low_battery(app_event_info_h event_info);
-       void on_low_memory(app_event_info_h event_info);
-       void on_region_changed(app_event_info_h event_info);
-       void on_orient_changed(app_event_info_h event_info);
-       void on_lang_changed(app_event_info_h event_info);
-};
-
-}
-
-static bool app_create(void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       return app->on_create();
-}
-
-static void app_terminate(void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_terminate();
-}
-
-static void app_pause(void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_pause();
-}
-
-static void app_resume(void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_resume();
-}
-
-static void app_control(app_control_s *app_control, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_control(app_control);
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_lang_changed(event_info);
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_orient_changed(event_info);
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_region_changed(event_info);
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_low_battery(event_info);
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *data)
-{
-       ui_app_impl *app = static_cast<ui_app_impl *>(data);
-       app->on_low_memory(event_info);
-}
-
-bool ui_app_impl::init()
-{
-       //FIXME: this scale value should be configurable.
-       elm_app_base_scale_set(2.6);
-
-       /* Bind package locale file */
-       bindtextdomain(this->pkg, this->locale_dir);
-       textdomain(this->pkg);
-
-       /* Default View Manager */
-       this->viewmgr = new ui_viewmgr(this->pkg);
-       if (!this->viewmgr)
-       {
-               LOGE("Failed to create a viewmgr(%s)", this->pkg);
-               return false;
-       }
-       return true;
-}
-
-ui_app_impl::ui_app_impl(ui_app *app, const char *pkg, const char *locale_dir)
-               : app(app), viewmgr(NULL)
-{
-       this->pkg = eina_stringshare_add(pkg);
-       this->locale_dir = eina_stringshare_add(locale_dir);
-}
-
-int ui_app_impl::run(int argc, char **argv)
-{
-       ui_app_lifecycle_callback_s event_callback =
-       { 0, };
-       app_event_handler_h handlers[5] =
-       { NULL, };
-
-       event_callback.create = app_create;
-       event_callback.terminate = app_terminate;
-       event_callback.pause = app_pause;
-       event_callback.resume = app_resume;
-       event_callback.app_control = app_control;
-
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this);
-
-       int ret = ui_app_main(argc, argv, &event_callback, this);
-
-       if (ret != APP_ERROR_NONE)
-       {
-               LOGE("ui_app_main() is failed. err = %d", ret);
-       }
-
-       return ret;
-}
-
-ui_app_impl::~ui_app_impl()
-{
-       delete (this->viewmgr);
-       eina_stringshare_del(this->pkg);
-       eina_stringshare_del(this->locale_dir);
-}
-
-ui_viewmgr *ui_app_impl::get_viewmgr()
-{
-       return this->viewmgr;
-}
-
-void ui_app_impl::on_lang_changed(app_event_info_h event_info)
-{
-       this->app->on_lang_changed(event_info);
-}
-
-void ui_app_impl::on_low_memory(app_event_info_h event_info)
-{
-       this->app->on_low_memory(event_info);
-}
-
-void ui_app_impl::on_low_battery(app_event_info_h event_info)
-{
-       this->app->on_low_battery(event_info);
-}
-
-void ui_app_impl::on_region_changed(app_event_info_h event_info)
-{
-       this->app->on_region_changed(event_info);
-}
-
-void ui_app_impl::on_orient_changed(app_event_info_h event_info)
-{
-       this->app->on_orient_changed(event_info);
-}
-
-bool ui_app_impl::on_create()
-{
-       return this->app->on_create();
-}
-
-void ui_app_impl::on_pause()
-{
-       this->app->on_pause();
-}
-
-void ui_app_impl::on_resume()
-{
-       this->app->on_resume();
-}
-
-void ui_app_impl::on_control(app_control_h app_control)
-{
-       this->app->on_control(app_control);
-}
-
-void ui_app_impl::on_terminate()
-{
-       this->app->on_terminate();
-}
 
 /***********************************************************************************************/
 /* External class Implementation                                                               */
 /***********************************************************************************************/
 
-static ui_app *inst = NULL;
-
-void ui_app::on_lang_changed(app_event_info_h event_info)
-{
-       char *locale = NULL;
-       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-       elm_language_set(locale);
-       free(locale);
-}
-
-void ui_app::on_low_memory(app_event_info_h event_info)
-{
-
-}
-
-void ui_app::on_low_battery(app_event_info_h event_info)
-{
-
-}
-
-void ui_app::on_region_changed(app_event_info_h event_info)
-{
-
-}
-
-void ui_app::on_orient_changed(app_event_info_h event_info)
-{
-
-}
-
-bool ui_app::on_create()
-{
-       return this->impl->init();
-}
-
-void ui_app::on_pause()
-{
-       this->impl->get_viewmgr()->deactivate();
-}
-
-void ui_app::on_resume()
-{
-//     this->impl->get_viewmgr()->activate();
-}
-
-void ui_app::on_control(app_control_h app_control)
-{
-       /* Handle the launch request. */
-       this->impl->get_viewmgr()->activate();
-}
-
-void ui_app::on_terminate()
-{
-       delete(this);
-}
-
 ui_app::ui_app(const char *pkg, const char *locale_dir)
+               : ui_base_app(pkg, locale_dir, new ui_viewmgr(pkg))
 {
-       if (inst)
-       {
-               LOGE("You created ui_app multiple times!!");
-       }
-       inst = this;
-       this->impl = new ui_app_impl(this, pkg, locale_dir);
-}
-
-int ui_app::run(int argc, char **argv)
-{
-       return this->impl->run(argc, argv);
 }
 
 ui_app::~ui_app()
 {
-       delete (this->impl);
-       inst = NULL;
 }
 
 ui_viewmgr *ui_app::get_viewmgr()
 {
-       return this->impl->get_viewmgr();
+       return dynamic_cast<ui_viewmgr*>(ui_base_app::get_viewmgr());
 }
 
 ui_app *ui_app::get_instance()
 {
-       return inst;
+       return dynamic_cast<ui_app*>(ui_base_app::get_instance());
 }
diff --git a/src/lib/efl/ui_base_app.cpp b/src/lib/efl/ui_base_app.cpp
new file mode 100644 (file)
index 0000000..6e43db9
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  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 <system_settings.h>
+#include "../../include/efl/ui_base_viewmanager.h"
+
+/***********************************************************************************************/
+/* Internal class Implementation                                                               */
+/***********************************************************************************************/
+namespace efl_viewmanager
+{
+
+class ui_base_app_impl
+{
+public:
+       friend class ui_base_app;
+
+       ui_base_app *app;
+       ui_base_viewmgr *viewmgr;
+       Eina_Stringshare *pkg;
+       Eina_Stringshare *locale_dir;
+
+       ui_base_app_impl(ui_base_app *app, const char *pkg, const char *locale_dir, ui_base_viewmgr* viewmgr);
+       ~ui_base_app_impl();
+
+       int run(int argc, char **argv);
+
+       bool init();
+       bool on_create();
+       void on_terminate();
+       void on_pause();
+       void on_resume();
+       void on_control(app_control_h app_control);
+       void on_low_battery(app_event_info_h event_info);
+       void on_low_memory(app_event_info_h event_info);
+       void on_region_changed(app_event_info_h event_info);
+       void on_orient_changed(app_event_info_h event_info);
+       void on_lang_changed(app_event_info_h event_info);
+};
+
+}
+
+static bool app_create(void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       return app->on_create();
+}
+
+static void app_terminate(void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_terminate();
+}
+
+static void app_pause(void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_pause();
+}
+
+static void app_resume(void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_resume();
+}
+
+static void app_control(app_control_s *app_control, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_control(app_control);
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_lang_changed(event_info);
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_orient_changed(event_info);
+}
+
+static void ui_app_region_changed(app_event_info_h event_info, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_region_changed(event_info);
+}
+
+static void ui_app_low_battery(app_event_info_h event_info, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_low_battery(event_info);
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *data)
+{
+       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
+       app->on_low_memory(event_info);
+}
+
+bool ui_base_app_impl::init()
+{
+       //FIXME: this scale value should be configurable.
+       elm_app_base_scale_set(2.6);
+
+       /* Bind package locale file */
+       bindtextdomain(this->pkg, this->locale_dir);
+       textdomain(this->pkg);
+
+       return true;
+}
+
+ui_base_app_impl::ui_base_app_impl(ui_base_app *app, const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr)
+               : app(app), viewmgr(viewmgr)
+{
+       this->pkg = eina_stringshare_add(pkg);
+       this->locale_dir = eina_stringshare_add(locale_dir);
+}
+
+int ui_base_app_impl::run(int argc, char **argv)
+{
+       ui_app_lifecycle_callback_s event_callback =
+       { 0, };
+       app_event_handler_h handlers[5] =
+       { NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this);
+
+       int ret = ui_app_main(argc, argv, &event_callback, this);
+
+       if (ret != APP_ERROR_NONE)
+       {
+               LOGE("ui_app_main() is failed. err = %d", ret);
+       }
+
+       return ret;
+}
+
+ui_base_app_impl::~ui_base_app_impl()
+{
+       delete (this->viewmgr);
+       eina_stringshare_del(this->pkg);
+       eina_stringshare_del(this->locale_dir);
+}
+
+void ui_base_app_impl::on_lang_changed(app_event_info_h event_info)
+{
+       this->app->on_lang_changed(event_info);
+}
+
+void ui_base_app_impl::on_low_memory(app_event_info_h event_info)
+{
+       this->app->on_low_memory(event_info);
+}
+
+void ui_base_app_impl::on_low_battery(app_event_info_h event_info)
+{
+       this->app->on_low_battery(event_info);
+}
+
+void ui_base_app_impl::on_region_changed(app_event_info_h event_info)
+{
+       this->app->on_region_changed(event_info);
+}
+
+void ui_base_app_impl::on_orient_changed(app_event_info_h event_info)
+{
+       this->app->on_orient_changed(event_info);
+}
+
+bool ui_base_app_impl::on_create()
+{
+       return this->app->on_create();
+}
+
+void ui_base_app_impl::on_pause()
+{
+       this->app->on_pause();
+}
+
+void ui_base_app_impl::on_resume()
+{
+       this->app->on_resume();
+}
+
+void ui_base_app_impl::on_control(app_control_h app_control)
+{
+       this->app->on_control(app_control);
+}
+
+void ui_base_app_impl::on_terminate()
+{
+       this->app->on_terminate();
+}
+
+/***********************************************************************************************/
+/* External class Implementation                                                               */
+/***********************************************************************************************/
+
+static ui_base_app *inst = NULL;
+
+void ui_base_app::on_lang_changed(app_event_info_h event_info)
+{
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+}
+
+void ui_base_app::on_low_memory(app_event_info_h event_info)
+{
+
+}
+
+void ui_base_app::on_low_battery(app_event_info_h event_info)
+{
+
+}
+
+void ui_base_app::on_region_changed(app_event_info_h event_info)
+{
+
+}
+
+void ui_base_app::on_orient_changed(app_event_info_h event_info)
+{
+
+}
+
+bool ui_base_app::on_create()
+{
+       return this->impl->init();
+}
+
+void ui_base_app::on_pause()
+{
+       this->impl->viewmgr->deactivate();
+}
+
+void ui_base_app::on_resume()
+{
+//     this->impl->viewmgr->activate();
+}
+
+void ui_base_app::on_control(app_control_h app_control)
+{
+       /* Handle the launch request. */
+       this->impl->viewmgr->activate();
+}
+
+void ui_base_app::on_terminate()
+{
+       delete(this);
+}
+
+ui_base_app::ui_base_app(const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr)
+{
+       if (inst)
+       {
+               LOGE("You created ui_base_app multiple times!!");
+       }
+       inst = this;
+
+       this->impl = new ui_base_app_impl(this, pkg, locale_dir, viewmgr);
+}
+
+int ui_base_app::run(int argc, char **argv)
+{
+       return this->impl->run(argc, argv);
+}
+
+ui_base_app::~ui_base_app()
+{
+       delete (this->impl);
+       inst = NULL;
+}
+
+ui_base_viewmgr *ui_base_app::get_viewmgr()
+{
+       return this->impl->viewmgr;
+}
+
+ui_base_app *ui_base_app::get_instance()
+{
+       return inst;
+}