+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 __CALL_UI_H__
-#define __CALL_UI_H__
-
-#include <app.h>
-#include <Elementary.h>
-#include <system_settings.h>
-#include <efl_extension.h>
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "call-ui"
-
-#if !defined(PACKAGE)
-#define PACKAGE "org.tizen.call-ui"
-#endif
-
-#endif /* __CALL_UI_H__ */
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __CALLUI_CONFIG_H__
+#define __CALLUI_CONFIG_H__
+
+#define CALLUI_LOG_TAG "CALLUI"
+
+namespace callui {
+
+ constexpr auto WINDOW_NAME = "org.tizen.call-ui";
+
+ constexpr auto BASE_SCALE = 1.3;
+}
+
+#endif // __CALL_UI_CONFIG_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __CALLUI_MAIN_INSTANCE_H__
+#define __CALLUI_MAIN_INSTANCE_H__
+
+#include "types.h"
+
+#include "ucl/appfw/IInstance.h"
+#include "ucl/appfw/IInstanceAppControlExt.h"
+
+#include "ucl/appfw/SysEventProvider.h"
+
+namespace callui {
+
+ class Instance :
+ public ucl::IInstance,
+ public ucl::IInstanceAppControlExt {
+ public:
+ Instance(ucl::SysEventProvider &sysEventProvider);
+
+ // IInstance //
+
+ virtual ucl::Result onCreate(
+ ucl::IInstanceContext *context) final override;
+ virtual void onPause() final override;
+ virtual void onResume() final override;
+
+ // IInstanceAppControlExt //
+
+ virtual void onAppControl(app_control_h appControl) final override;
+
+ private:
+ void onBack(Evas_Object *obj, void *event_info);
+ void onSysEvent(const ucl::SysEvent sysEvent);
+
+ private:
+ ucl::SysEventProvider &m_sysEventProvider;
+ ucl::IInstanceContext *m_context;
+ ucl::WindowSRef m_win;
+ };
+}
+
+#endif // __CALLUI_MAIN_INSTANCE_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __CALLUI_MAIN_INSTANCE_MANAGER_H__
+#define __CALLUI_MAIN_INSTANCE_MANAGER_H__
+
+#include "types.h"
+
+#include "ucl/appfw/InstanceManagerBase.h"
+
+namespace callui {
+
+ class InstanceManager : public ucl::InstanceManagerBase {
+ public:
+ InstanceManager();
+
+ // ucl::InstanceManagerBase //
+
+ virtual ucl::IInstance *newInstance() const final override;
+ };
+}
+
+#endif // __CALLUI_MAIN_INSTANCE_MANAGER_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __CALLUI_TYPES_H__
+#define __CALLUI_TYPES_H__
+
+#include "config.h"
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+#include "ucl/util/delegation.h"
+
+#endif // __CALLUI_TYPES_H_
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "call-ui.h"
-
-typedef struct appdata {
- Evas_Object *win;
- Evas_Object *conform;
- Evas_Object *label;
-} appdata_s;
-
-static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
-{
- ui_app_exit();
-}
-
-static void win_back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- appdata_s *ad = static_cast<appdata_s *>(data);
- /* Let window go to hide state. */
- elm_win_lower(ad->win);
-}
-
-static void create_base_gui(appdata_s *ad)
-{
- /* Window */
- /* Create and initialize elm_win.
- elm_win is mandatory to manipulate window. */
- ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
- elm_win_autodel_set(ad->win, EINA_TRUE);
-
- if (elm_win_wm_rotation_supported_get(ad->win)) {
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
- }
-
- evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
- eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);
-
- /* Conformant */
- /* Create and initialize elm_conformant.
- elm_conformant is mandatory for base gui to have proper size
- when indicator or virtual keypad is visible. */
- ad->conform = elm_conformant_add(ad->win);
- elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
- elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
- evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ad->win, ad->conform);
- evas_object_show(ad->conform);
-
- /* Label */
- /* Create an actual view of the base gui.
- Modify this part to change the view. */
- ad->label = elm_label_add(ad->conform);
- elm_object_text_set(ad->label, "<align=center>Hello Tizen</align>");
- evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_content_set(ad->conform, ad->label);
-
- /* Show window after base gui is set up */
- evas_object_show(ad->win);
-}
-
-static bool app_create(void *data)
-{
- /* Hook to take necessary actions before main event loop starts
- Initialize UI resources and application's data
- If this function returns true, the main loop of application starts
- If this function returns false, the application is terminated */
- appdata_s *ad = static_cast<appdata_s *>(data);
-
- create_base_gui(ad);
-
- return true;
-}
-
-static void app_control(app_control_h app_control, void *data)
-{
- /* Handle the launch request. */
-}
-
-static void app_pause(void *data)
-{
- /* Take necessary actions when application becomes invisible. */
-}
-
-static void app_resume(void *data)
-{
- /* Take necessary actions when application becomes visible. */
-}
-
-static void app_terminate(void *data)
-{
- /* Release all resources. */
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LANGUAGE_CHANGED*/
- char *locale = NULL;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
- elm_language_set(locale);
- free(locale);
- return;
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
- return;
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char *argv[])
-{
- appdata_s ad = {0,};
- int ret = 0;
-
- 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, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
-
- ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
- }
-
- return ret;
-}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __CALLUI_COMMON_H__
+#define __CALLUI_COMMON_H__
+
+#include <algorithm>
+
+#include <Ecore.h>
+
+#include "ucl/util/helpers.h"
+#include "ucl/util/logging.h"
+#include "ucl/util/shortLogs.h"
+
+#include "ucl/gui/stdTheme.h"
+#include "ucl/gui/helpers.h"
+
+#undef UCL_LOG_TAG
+#define UCL_LOG_TAG "CALLUI"
+
+#endif // __CALLUI_COMMON_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "main/Instance.h"
+
+#include <system_settings.h>
+#include <efl_extension.h>
+
+#include "../common.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ Instance::Instance(SysEventProvider &sysEventProvider) :
+ m_sysEventProvider(sysEventProvider),
+ m_context(nullptr)
+ {
+ }
+
+ Result Instance::onCreate(IInstanceContext *const context)
+ {
+ m_context = context;
+
+ m_win = m_context->getWindow();
+
+ m_sysEventProvider.addEventHandler(
+ DELEGATE(Instance::onSysEvent, this));
+
+ eext_object_event_callback_add(*m_win, EEXT_CALLBACK_BACK,
+ CALLBACK_A(Instance::onBack), this);
+
+ return RES_OK;
+ }
+
+ void Instance::onPause()
+ {
+ ILOG("PAUSED");
+ }
+
+ void Instance::onResume()
+ {
+ ILOG("RESUMED");
+ }
+
+ void Instance::onAppControl(app_control_h appControl)
+ {
+ char *op = {};
+ app_control_get_operation(appControl, &op);
+ ILOG("operation: %s", op);
+ free(op);
+
+ if (!m_win->isVisible()) {
+ show(*m_win);
+ }
+ }
+
+ void Instance::onBack(Evas_Object *obj, void *event_info)
+ {
+ ILOG("Exiting the application...");
+ m_context->exitApp();
+ }
+
+ void Instance::onSysEvent(const SysEvent sysEvent)
+ {
+ switch(sysEvent) {
+ case SysEvent::LANGUAGE_CHANGED:
+ ILOG("SysEvent::LANGUAGE_CHANGED");
+ {
+ char *locale = NULL;
+ system_settings_get_value_string(
+ SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ }
+ break;
+ default:
+ ILOG("sysEvent: %d", sysEvent);
+ break;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "main/InstanceManager.h"
+
+#include "main/Instance.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ InstanceManager::InstanceManager() :
+ InstanceManagerBase(AppParams().
+ set(AppParam::WINDOW_NAME, WINDOW_NAME).
+ set(AppParam::BASE_SCALE, BASE_SCALE))
+ {
+ }
+
+ IInstance *InstanceManager::newInstance() const
+ {
+ return new Instance(getSysEventProvider());
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/UIApp.h"
+
+#include "main/InstanceManager.h"
+
+#include "../common.h"
+
+using namespace ucl;
+using namespace callui;
+
+int main(int argc, char *argv[])
+{
+ InstanceManager mgr;
+ const int ret = UIApp(mgr).run(argc, argv);
+ ILOG("ret: %d", ret);
+ return ret;
+}
#define UCL_DEFAULT_LOG_TAG "UCL"
-#define UCL_INCLUDE_DELEGATION_SHORT_MACRO_H 0
-#define UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H 0
+#define UCL_INCLUDE_DELEGATION_SHORT_MACRO_H 1
+#define UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H 1
#endif // __UCL_CONFIG_H__