From: nazib.ullah Date: Wed, 21 Dec 2016 06:10:32 +0000 (+0600) Subject: [TBT][tizen_3.0_mobile][ui-viewmgr module and tbt_uiviewgr app added] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6812171cd176c148fc20ba414d861e9309b50a0f;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][ui-viewmgr module and tbt_uiviewgr app added] Change-Id: If977ad4c22c35e13c44ba787a5d2a5783e27d02a Signed-off-by: nazib.ullah --- diff --git a/release/binary-aarch64/install.sh b/release/binary-aarch64/install.sh index 13788fd..0e69e79 100644 --- a/release/binary-aarch64/install.sh +++ b/release/binary-aarch64/install.sh @@ -34,6 +34,7 @@ sdb push org.tizen.tbt-ime-1.0.0-aarch64.tpk /tmp sdb push org.tizen.tbtcoreapp-dali-1.0.0-aarch64.tpk /tmp sdb push org.tizen.tbtcoreapp-1.0.0-aarch64.tpk /tmp sdb push org.tizen.tbt_pushtestapp-1.0.0-aarch64.tpk /tmp +sdb push org.tizen.tbt_ui_viewmgr-1.0.0-aarch64.tpk /tmp sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-aarch64.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-aarch64.tpk" $EXECUTION_USER @@ -44,6 +45,7 @@ sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-1.0.0-aarch64.tpk sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.tbt-ime-1.0.0-aarch64.tpk sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-dali-1.0.0-aarch64.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_pushtestapp-1.0.0-aarch64.tpk" $EXECUTION_USER +sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_ui_viewmgr-1.0.0-aarch64.tpk" $EXECUTION_USER sdb push dog_1024_960.gif /home/$EXECUTION_USER/media/Images sdb push SampleMP3.mp3 /home/$EXECUTION_USER/media/Sounds diff --git a/release/binary-aarch64/org.tizen.tbt_ui_viewmgr-1.0.0-aarch64.tpk b/release/binary-aarch64/org.tizen.tbt_ui_viewmgr-1.0.0-aarch64.tpk new file mode 100644 index 0000000..15abad4 Binary files /dev/null and b/release/binary-aarch64/org.tizen.tbt_ui_viewmgr-1.0.0-aarch64.tpk differ diff --git a/release/binary-aarch64/org.tizen.tbtcoreapp-1.0.0-aarch64.tpk b/release/binary-aarch64/org.tizen.tbtcoreapp-1.0.0-aarch64.tpk index db581bd..ba34805 100644 Binary files a/release/binary-aarch64/org.tizen.tbtcoreapp-1.0.0-aarch64.tpk and b/release/binary-aarch64/org.tizen.tbtcoreapp-1.0.0-aarch64.tpk differ diff --git a/release/binary-armv7l/install.sh b/release/binary-armv7l/install.sh index d951c79..ac12364 100755 --- a/release/binary-armv7l/install.sh +++ b/release/binary-armv7l/install.sh @@ -34,6 +34,7 @@ sdb push org.tizen.tbt-ime-1.0.0-arm.tpk /tmp sdb push org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk /tmp sdb push org.tizen.tbtcoreapp-1.0.0-arm.tpk /tmp sdb push org.tizen.tbt_pushtestapp-1.0.0-arm.tpk /tmp +sdb push org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk /tmp sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk" $EXECUTION_USER @@ -44,6 +45,7 @@ sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-1.0.0-arm.tpk" $E sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.tbt-ime-1.0.0-arm.tpk sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_pushtestapp-1.0.0-arm.tpk" $EXECUTION_USER +sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk" $EXECUTION_USER sdb push dog_1024_960.gif /home/$EXECUTION_USER/media/Images sdb push SampleMP3.mp3 /home/$EXECUTION_USER/media/Sounds diff --git a/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk new file mode 100644 index 0000000..002384c Binary files /dev/null and b/release/binary-armv7l/org.tizen.tbt_ui_viewmgr-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index c41fc28..8a42364 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/install.sh b/release/binary-x86/install.sh index 596c1d9..e3a9a86 100644 --- a/release/binary-x86/install.sh +++ b/release/binary-x86/install.sh @@ -34,6 +34,7 @@ sdb push org.tizen.tbt-ime-1.0.0-i386.tpk /tmp sdb push org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk /tmp sdb push org.tizen.tbtcoreapp-1.0.0-i386.tpk /tmp sdb push org.tizen.tbt_pushtestapp-1.0.0-i386.tpk /tmp +sdb push org.tizen.tbt_ui_viewmgr-1.0.0-i386.tpk /tmp sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk" $EXECUTION_USER @@ -44,6 +45,7 @@ sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-1.0.0-i386.tpk" $ sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.tbt-ime-1.0.0-i386.tpk sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_pushtestapp-1.0.0-i386.tpk" $EXECUTION_USER +sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_ui_viewmgr-1.0.0-i386.tpk" $EXECUTION_USER sdb push dog_1024_960.gif /home/$EXECUTION_USER/media/Images sdb push SampleMP3.mp3 /home/$EXECUTION_USER/media/Sounds diff --git a/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-i386.tpk new file mode 100644 index 0000000..52e09f8 Binary files /dev/null and b/release/binary-x86/org.tizen.tbt_ui_viewmgr-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 7156437..4c0cdb7 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86_64/install.sh b/release/binary-x86_64/install.sh index 6ec75f0..749d280 100644 --- a/release/binary-x86_64/install.sh +++ b/release/binary-x86_64/install.sh @@ -34,6 +34,7 @@ sdb push org.tizen.tbt-ime-1.0.0-x86_64.tpk /tmp sdb push org.tizen.tbtcoreapp-dali-1.0.0-x86_64.tpk /tmp sdb push org.tizen.tbtcoreapp-1.0.0-x86_64.tpk /tmp sdb push org.tizen.tbt_pushtestapp-1.0.0-x86_64.tpk /tmp +sdb push org.tizen.tbt_ui_viewmgr-1.0.0-x86_64.tpk /tmp sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_dataprovider-1.0.0-x86_64.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.coretbt_serviceapp-1.0.0-x86_64.tpk" $EXECUTION_USER @@ -44,6 +45,7 @@ sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-1.0.0-x86_64.tpk" sdb shell pkgcmd -i -t tpk -p /tmp/org.tizen.tbt-ime-1.0.0-x86_64.tpk sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbtcoreapp-dali-1.0.0-x86_64.tpk" $EXECUTION_USER sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_pushtestapp-1.0.0-x86_64.tpk" $EXECUTION_USER +sdb shell su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.tbt_ui_viewmgr-1.0.0-x86_64.tpk" $EXECUTION_USER sdb push dog_1024_960.gif /home/$EXECUTION_USER/media/Images sdb push SampleMP3.mp3 /home/$EXECUTION_USER/media/Sounds diff --git a/release/binary-x86_64/org.tizen.tbt_ui_viewmgr-1.0.0-x86_64.tpk b/release/binary-x86_64/org.tizen.tbt_ui_viewmgr-1.0.0-x86_64.tpk new file mode 100644 index 0000000..0e9f491 Binary files /dev/null and b/release/binary-x86_64/org.tizen.tbt_ui_viewmgr-1.0.0-x86_64.tpk differ diff --git a/release/binary-x86_64/org.tizen.tbtcoreapp-1.0.0-x86_64.tpk b/release/binary-x86_64/org.tizen.tbtcoreapp-1.0.0-x86_64.tpk index 61fdc20..3b65fc7 100644 Binary files a/release/binary-x86_64/org.tizen.tbtcoreapp-1.0.0-x86_64.tpk and b/release/binary-x86_64/org.tizen.tbtcoreapp-1.0.0-x86_64.tpk differ diff --git a/tbt_ui_viewmgr/.cproject b/tbt_ui_viewmgr/.cproject new file mode 100644 index 0000000..681d013 --- /dev/null +++ b/tbt_ui_viewmgr/.cproject @@ -0,0 +1,621 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tbt_ui_viewmgr/.exportMap b/tbt_ui_viewmgr/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/tbt_ui_viewmgr/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/tbt_ui_viewmgr/.gitignore b/tbt_ui_viewmgr/.gitignore new file mode 100644 index 0000000..ffab4a7 --- /dev/null +++ b/tbt_ui_viewmgr/.gitignore @@ -0,0 +1,3 @@ +/SA_Report +/Debug +/.sign diff --git a/tbt_ui_viewmgr/.project b/tbt_ui_viewmgr/.project new file mode 100644 index 0000000..15c9a82 --- /dev/null +++ b/tbt_ui_viewmgr/.project @@ -0,0 +1,46 @@ + + + tbt_ui_viewmgr + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + 1482294136104 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1482294136106 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/tbt_ui_viewmgr/.rds_delta b/tbt_ui_viewmgr/.rds_delta new file mode 100644 index 0000000..8ec6125 --- /dev/null +++ b/tbt_ui_viewmgr/.rds_delta @@ -0,0 +1,6 @@ +#delete +#add +#modify +author-signature.xml +signature1.xml +bin/tbt_ui_viewmgr diff --git a/tbt_ui_viewmgr/.sdk_delta.info b/tbt_ui_viewmgr/.sdk_delta.info new file mode 100644 index 0000000..513834e Binary files /dev/null and b/tbt_ui_viewmgr/.sdk_delta.info differ diff --git a/tbt_ui_viewmgr/.tproject b/tbt_ui_viewmgr/.tproject new file mode 100644 index 0000000..56660b2 --- /dev/null +++ b/tbt_ui_viewmgr/.tproject @@ -0,0 +1,12 @@ + + + + + mobile-3.0 + + + + + + + diff --git a/tbt_ui_viewmgr/inc/logger.h b/tbt_ui_viewmgr/inc/logger.h new file mode 100644 index 0000000..772ceab --- /dev/null +++ b/tbt_ui_viewmgr/inc/logger.h @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * 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. + *******************************************************************************/ + +/** + * @file logger.h + * @brief This file provide necessary macro for logging information. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include + +#define LOG_TAG_CORE "[TBT_CORE]_" + +#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) +#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) +#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) + +#define RETM_IF(expr, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return; \ + } \ +} + +#define RETVM_IF(expr, val, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ +} + +#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; + +#endif /* __LOGGER_H__ */ diff --git a/tbt_ui_viewmgr/inc/tbt_ui_viewmgr.h b/tbt_ui_viewmgr/inc/tbt_ui_viewmgr.h new file mode 100644 index 0000000..8dc143b --- /dev/null +++ b/tbt_ui_viewmgr/inc/tbt_ui_viewmgr.h @@ -0,0 +1,20 @@ +#ifndef __tbt_ui_viewmgr_H__ +#define __tbt_ui_viewmgr_H__ + +#include +#include +#include +#include "logger.h" + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "tbt_ui_viewmgr" + +#if !defined(PACKAGE) +#define PACKAGE "org.tizen.tbt_ui_viewmgr" +#endif + +void create_view1(); + +#endif /* __tbt_ui_viewmgr_H__ */ diff --git a/tbt_ui_viewmgr/shared/res/tbt_ui_viewmgr.png b/tbt_ui_viewmgr/shared/res/tbt_ui_viewmgr.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/tbt_ui_viewmgr/shared/res/tbt_ui_viewmgr.png differ diff --git a/tbt_ui_viewmgr/src/tbt_ui_viewmgr.c b/tbt_ui_viewmgr/src/tbt_ui_viewmgr.c new file mode 100644 index 0000000..e22bf5e --- /dev/null +++ b/tbt_ui_viewmgr/src/tbt_ui_viewmgr.c @@ -0,0 +1,73 @@ +#include "tbt_ui_viewmgr.h" + +static bool +app_create(void *user_data, void *event_info) +{ + /* Hook to take necessary actions before main event loop starts. + Initialize Application base resources. + If this function returns true, the main loop of application starts. */ + + create_view1(); + + return true; +} + +static bool +app_control(void *user_data, void *event_info) +{ + //app_control_h app_control = (app_control_h) event_info; + + /* Handle the launch request. */ + + return true; +} + +static bool +app_terminate(void *data, void *event_info) +{ + /* Release all application base resources. */ + + return true; +} + +int +main(int argc, char *argv[]) +{ + /* Application event callbacks. */ + ui_application_event_s events[]= { + {UI_APPLICATION_EVENT_CREATE, app_create}, + {UI_APPLICATION_EVENT_TERMINATE, app_terminate}, + {UI_APPLICATION_EVENT_CONTROL, app_control}, + }; + + int ret; + + //Initialize ui_app. + ret = ui_application_init(); + + if (ret != UI_VIEWMGR_ERROR_NONE) + { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_init() is failed, ret = %d", ret); + return ret; + } + + //Run ui_app. It runs application mainloop. + ret = ui_application_run(argc, argv, events, 2, NULL); + + if (ret != UI_VIEWMGR_ERROR_NONE) + { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_run() is failed, ret = %d", ret); + return ret; + } + + //Terminate ui_app. + ret = ui_application_term(); + + if (ret != UI_VIEWMGR_ERROR_NONE) + { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_term() is failed ret = %d", ret); + return ret; + } + + return 0; +} diff --git a/tbt_ui_viewmgr/src/view1.c b/tbt_ui_viewmgr/src/view1.c new file mode 100644 index 0000000..dfcc9bc --- /dev/null +++ b/tbt_ui_viewmgr/src/view1.c @@ -0,0 +1,185 @@ +#include "tbt_ui_viewmgr.h" +static Eo *content = NULL; +static bool +view1_back(ui_view *view, void *user_data) +{ + /* Page back is requested. */ + + return true; +} + +static void +ctxpopup_item_select_cb(void *data, Eo *obj, void *event_info) +{ + Elm_Object_Item *it = (Elm_Object_Item *) event_info; + DBG("Item (%s) is selected", elm_object_item_text_get(it)); + char str[256]; + snprintf(str,256,"%s",elm_object_item_text_get(it)); + elm_object_text_set(content,str); + elm_ctxpopup_dismiss(obj); +} + +static bool +view1_menu(ui_view *view, void *user_data) +{ + /* Page menu is requested. */ + //ui_menu *menu = ui_view_get_menu(view); + int ret; + Eo *base = NULL; + Elm_Ctxpopup *ctxpopup = NULL; + ui_menu *menu = ui_view_get_menu(view); + +//Get a base object from menu. + base = ui_menu_get_base(menu); + if (!base) { + DBG("failed to get a menu base object"); + return false; + } + +//Create and set a ctxpopup as a menu. + ctxpopup = elm_ctxpopup_add(base); + if (!ctxpopup) { + DBG("failed to create a ctxpopup."); + return false; + } + + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, NULL); + + ret = ui_menu_set_content(menu, ctxpopup); + if (ret != UI_VIEWMGR_ERROR_NONE) + { + DBG("ui_menu_set_content() is failed. err = %d", ret); + return false; + } + + return true; + +} + +static bool +view1_rotate(ui_view *view, void *user_data) +{ + /* Page is rotated. */ + + if (ui_view_get_orientation_mode(view) == UI_VIEW_ORIENTATION_MODE_PORTRAIT) + { + /* Portrait mode. */ + } + else + { + /* Landscape mode. */ + } + + return true; +} + +static bool +view1_destroy(ui_view *view, void *user_data) +{ + /* This page is destroyed. Free page resources here. */ + + return true; +} + +static bool +view1_unload(ui_view *view, void *user_data) +{ + /* Hook to take necessary actions when page is unloaded. */ + + return true; +} + +static bool +view1_load(ui_view *view, void *user_data) +{ + /* Hook to take necessary actions when page is loaded. + Create page contents here. */ + + + Eo *base = NULL; + int ret; + + //Get a base object from view. + base = ui_view_get_base(view); + + //Create and set a main content. + content = elm_label_add(base); + if (!content) return false; + + elm_object_text_set(content, "UI Viewmgr App"); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + //Set Main Content + ret = ui_view_set_content(view, content); + if (ret != UI_VIEWMGR_ERROR_NONE) + { + DBG("ui_view_set_content() is failed. err = %d", ret); + ui_view_destroy(view); + return false; + } + + return true; +} + +void +create_view1() +{ + int ret = 0; + ui_view *view = NULL; + int i; + + ui_view_event_type_e events[6] = { + UI_VIEW_EVENT_LOAD, + UI_VIEW_EVENT_UNLOAD, + UI_VIEW_EVENT_DESTROY, + UI_VIEW_EVENT_ROTATE, + UI_VIEW_EVENT_MENU, + UI_VIEW_EVENT_BACK + }; + + ui_view_event_cb event_cbs[6] = { + view1_load, + view1_unload, + view1_destroy, + view1_rotate, + view1_menu, + view1_back + }; + + //Create a view. + view = ui_view_create("view1"); + if (!view) + { + DBG("failed to create a view"); + return; + } + + //Set view event callbacks. + for (i = 0; i < 6; i++) + { + ret = ui_view_set_event_cb(view, events[i], event_cbs[i], NULL); + if (ret != UI_VIEWMGR_ERROR_NONE) + { + DBG("ui_view_set_event_cb() idx = %d is failed. err = %d", i, ret); + ui_view_destroy(view); + return; + } + } + + //Push a view. + ret = ui_viewmgr_push_view(view); + + if (ret != UI_VIEWMGR_ERROR_NONE) + { + DBG("ui_viewmgr_push_view() is failed. err = %d", ret); + ui_view_destroy(view); + } +} diff --git a/tbt_ui_viewmgr/tizen-manifest.xml b/tbt_ui_viewmgr/tizen-manifest.xml new file mode 100644 index 0000000..0af495d --- /dev/null +++ b/tbt_ui_viewmgr/tizen-manifest.xml @@ -0,0 +1,8 @@ + + + + + tbt_ui_viewmgr.png + + + diff --git a/tbtcoreapp/inc/model/tbt-info.h b/tbtcoreapp/inc/model/tbt-info.h index 6c34005..fac3747 100644 --- a/tbtcoreapp/inc/model/tbt-info.h +++ b/tbtcoreapp/inc/model/tbt-info.h @@ -252,6 +252,8 @@ typedef enum { TBT_APP_IOTCON_BASIC_SERVER, TBT_APP_IOTCON_BASIC_CLIENT, + TBT_APP_UI_VIEWMGR_MENU, + TBT_APP_DALI_ACTOR, //DALi APP include here TBT_APP_DALI_STAGE, diff --git a/tbtcoreapp/inc/utils/app_module_config.h b/tbtcoreapp/inc/utils/app_module_config.h index 7afa138..30f8843 100755 --- a/tbtcoreapp/inc/utils/app_module_config.h +++ b/tbtcoreapp/inc/utils/app_module_config.h @@ -249,6 +249,9 @@ #define TBT_MODULE_APP_IOTCON_BASIC_SERVER #define TBT_MODULE_APP_IOTCON_BASIC_CLIENT +#define TBT_MODULE_UI_VIEWMGR +#define TBT_MODULE_APP_UI_VIEWMGR_MENU + #define TBT_MODULE_DALI #define TBT_MODULE_APP_DALI_APP #define TBT_MODULE_APP_DALI_ACTOR diff --git a/tbtcoreapp/inc/utils/config.h b/tbtcoreapp/inc/utils/config.h index 21a0972..f08e053 100644 --- a/tbtcoreapp/inc/utils/config.h +++ b/tbtcoreapp/inc/utils/config.h @@ -86,6 +86,7 @@ extern bool __is_efl_test_running; #define PICK_VIEW_APP_PACKAGE_NAME "org.tizen.coretbt_uiapp"; #define PICK_VIEW_SERVICEAPP_PACKAGE_NAME "org.tizen.coretbt_serviceapp"; +#define UI_VIEWMGR_APP_PACKAGE_NAME "org.tizen.tbt_ui_viewmgr" #define PICK_VIEW_URL_HTTP "http://www.tizen.org" diff --git a/tbtcoreapp/inc/view/tbt-ui-viewmgr-view.h b/tbtcoreapp/inc/view/tbt-ui-viewmgr-view.h new file mode 100644 index 0000000..8d786e6 --- /dev/null +++ b/tbtcoreapp/inc/view/tbt-ui-viewmgr-view.h @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * 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. + * + *******************************************************************************/ +/** + * @file tbt-ui_viewmgr-view.h + * @brief covers location retrieval + * starts location service using ui_viewmgr method and continuously updates the current location + * @since_tizen 2.3 + * @author golam kayes(g.kayes@samsung.com) and salman rahman(salman.ran) + * @date October, 2014 + * @bug location manager does not start in device + * @credit + * + */ + +#ifndef __TBT_UI_VIEWMGR_VIEW_H__ +#define __TBT_UI_VIEWMGR_VIEW_H__ + +#include "utils/app_module_config.h" +#ifdef TBT_MODULE_UI_VIEWMGR + +#include +#include "model/tbt-list.h" + + +/** + * @typedef ui_viewmgr_viewer_view + * @since_tizen 2.3 + * @brief A ui_viewmgr viewer view handle. + */ +typedef struct _ui_viewmgr_view ui_viewmgr_view; + +/** + * @brief Create ui_viewmgr camera view + * @since_tizen 2.3 + * @param[in] navi Parent naviframe + * @param[in] custom structute to hold tbt application information + * @param[in] item of the main tbt menu + * @return Pointer of ui_viewmgr on success, otherwise NULL + */ +ui_viewmgr_view *ui_viewmgr_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item); + +#endif +#endif // __TBT_UI_VIEWMGR_VIEW_H__ diff --git a/tbtcoreapp/res/edje/3.0/mobile/ui_viewmgr_viewer.edc b/tbtcoreapp/res/edje/3.0/mobile/ui_viewmgr_viewer.edc new file mode 100644 index 0000000..f805705 --- /dev/null +++ b/tbtcoreapp/res/edje/3.0/mobile/ui_viewmgr_viewer.edc @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014 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. + */ + +#define TEXT_HEIGHT 0.08 + +collections +{ + base_scale: 1.8; + group + { + name: "ui_viewmgr_viewer"; + parts{ + part{ + name: "label"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.0; } + rel2 {relative: 1.0 TEXT_HEIGHT; } + } + } + part{ + name: "btn_launch"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.9; } + rel2 {relative: 1.0 1.0; } + } + } + } + } +} diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index 5a59802..cbee885 100755 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -2459,6 +2459,25 @@ static tbt_info tbtapps[] = }, #endif #endif + +#ifdef TBT_MODULE_UI_VIEWMGR + #ifdef TBT_MODULE_APP_UI_VIEWMGR_MENU + //ui viewmgr Menu + { + .name = "Menu", + .parent = "UI Viewmgr", + .apptype = TBT_APP_UI_VIEWMGR_MENU, + .icon_name = "dummy", + .info = "1. Press Run Launch UI Viewmgr button, UI viewmgr app will be opened.
" + "2. After ui viewmgr app opened press H/W Menu button, then a popup Menu will be shown.
" + "3. Select each list item and corresponding text will be shown in ui viewmgr app.
" + "4. Press back button to exit from ui viewmgr app.
" + "5. If everything works as above then Pass, Otherwise Fail. ", + .result = 0, + .required_features_count = 0, + }, + #endif +#endif #ifdef TBT_MODULE_DALI #ifdef TBT_MODULE_APP_DALI_ACTOR diff --git a/tbtcoreapp/src/view/tbt-genlist-view.c b/tbtcoreapp/src/view/tbt-genlist-view.c index 99586cb..6dd1255 100644 --- a/tbtcoreapp/src/view/tbt-genlist-view.c +++ b/tbtcoreapp/src/view/tbt-genlist-view.c @@ -97,6 +97,7 @@ #include "view/tbt-tts-view.h" #include "view/tbt-stt-view.h" #include "view/tbt-iotcon-view.h" +#include "view/tbt-ui-viewmgr-view.h" #include "view/tbt-dali-view.h" typedef struct @@ -1153,6 +1154,13 @@ static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void break; #endif #endif + #ifdef TBT_MODULE_UI_VIEWMGR + #ifdef TBT_MODULE_APP_UI_VIEWMGR_MENU + case TBT_APP_UI_VIEWMGR_MENU: + ui_viewmgr_view_add(view->navi, info, it); + break; + #endif + #endif #ifdef TBT_MODULE_DALI case TBT_APP_DALI_ACTOR: dali_view_add(view->navi, info, it, "TBT_APP_DALI_ACTOR"); diff --git a/tbtcoreapp/src/view/tbt-ui-viewmgr-view.c b/tbtcoreapp/src/view/tbt-ui-viewmgr-view.c new file mode 100644 index 0000000..c0d31fe --- /dev/null +++ b/tbtcoreapp/src/view/tbt-ui-viewmgr-view.c @@ -0,0 +1,210 @@ +/******************************************************************************* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * 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. + *******************************************************************************/ +/** + * @file tbt-ui_viewmgr-view.c + * @brief covers locationn retrieval + * starts location service using ui_viewmgr method and continuously updates the current location + * + * @author golam kayes(g.kayes@samsung.com) and salman rahman(salman.ran) + * @date October, 2014 + * @bug location manager does not start in device + * @credit + * + */ + +#include "utils/app_module_config.h" +#ifdef TBT_MODULE_UI_VIEWMGR + +#include +#include + +#include "utils/logger.h" +#include "utils/config.h" +#include "utils/ui-utils.h" +#include "view/tbt-ui-viewmgr-view.h" +#include "view/tbt-common-view.h" + +struct _ui_viewmgr_view +{ + common_view* view; + location_manager_h manager; + app_control_h service; + + Evas_Object *label; + Evas_Object *btn_launch; +}; + +static void _view_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); +static void _app_destroy_cb(void* this); +static char* get_app_control_error(int ret); +static void app_control_view_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data); + + +/** + * @function ui_viewmgr_view_add + * @since_tizen 2.3 + * @description Gps View Add + * @parameter Evas_Object*: Evas Object Pointer, tbt_info*: Tbt Info Pointer, Elm_Object_Item*: Elm Object Item Pointer + * @return ui_viewmgr_view* + */ +ui_viewmgr_view *ui_viewmgr_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item) +{ + RETVM_IF(NULL == navi, NULL, "navi is null"); + + ui_viewmgr_view *this = NULL; + this = calloc(1, sizeof(ui_viewmgr_view)); + RETVM_IF(!this, NULL, "calloc failed"); + this->view = calloc(1, sizeof(common_view)); + RETVM_IF(!this->view, NULL, "calloc failed"); + + tbt_info->layout_group = "ui_viewmgr_viewer"; + tbt_info->layout_file = get_edje_path("ui_viewmgr_viewer.edj"); + + common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); + + RETVM_IF(NULL == this->view, NULL, "navi is null"); + + this->label = ui_utils_label_add(this->view->layout, "Press Launch UI viewmgr button"); + elm_object_part_content_set(this->view->layout, "label", this->label); + + + this->btn_launch = ui_utils_push_button_add(this, this->view->layout, "Launch UI Viewmgr", _view_button_pressed_cb); + elm_object_part_content_set(this->view->layout, "btn_launch", this->btn_launch); + + return this; +} + +static void _view_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + RETM_IF(NULL == data, "data is NULL"); + + ui_viewmgr_view *view = NULL; + view = (ui_viewmgr_view*)data; + RETM_IF(NULL == view, "view is NULL"); + + char *appid = UI_VIEWMGR_APP_PACKAGE_NAME; + int ret = app_control_create(&view->service); + RETM_IF(APP_CONTROL_ERROR_NONE != ret, "app_control_create failed :%s", get_app_control_error(ret)); + RETM_IF(NULL == view->service, "Service NULL! "); + ret = app_control_set_app_id(view->service, appid); + RETM_IF(APP_CONTROL_ERROR_NONE != ret, "app_control_set_app_id failed :%s", get_app_control_error(ret)); + ret = app_control_send_launch_request(view->service , app_control_view_reply_cb, view); + RETM_IF(APP_CONTROL_ERROR_NONE != ret, "app_control_send_launch_request failed :%s", get_app_control_error(ret)); + ui_utils_label_set_text(view->label, "App launch requested.", "left"); +} + +static void app_control_view_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data) +{ + RETM_IF(NULL == data, "data is NULL"); + + ui_viewmgr_view *view = NULL; + view = (ui_viewmgr_view*)data; + RETM_IF(NULL == view, "view is NULL"); + + if(result == APP_CONTROL_RESULT_SUCCEEDED) + { + int result; + char *app_id; + + if(reply != NULL) + { + result = app_control_get_app_id(reply, &app_id); + RETM_IF(APP_CONTROL_ERROR_NONE != result, "app_control_create failed :%s", get_app_control_error(result)); + DBG("app_id is %s", app_id); + + ui_utils_label_set_text(view->label, "App launched successfully.", "left"); + } + } +} + + +/* + * @function _app_destroy_cb + * @since_tizen 2.3 + * @description App Destroy Cb + * @parameter void*: Void Pointer + * @return static void + */ +static void _app_destroy_cb(void* this) +{ + RETM_IF(NULL == this, "data is NULL"); + + ui_viewmgr_view *view = NULL; + view = (ui_viewmgr_view*)this; + RETM_IF(NULL == view, "view is NULL"); + + app_control_destroy(view->service); + + SAFE_DELETE(view->view); + SAFE_DELETE(view); +} + +static char* get_app_control_error(int ret) +{ + char* error = NULL; + + switch (ret) { + case APP_CONTROL_ERROR_NONE: + error = "APP_CONTROL_ERROR_NONE"; + break; + case APP_CONTROL_ERROR_INVALID_PARAMETER: + error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; + break; + case APP_CONTROL_ERROR_OUT_OF_MEMORY: + error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; + break; + case APP_CONTROL_ERROR_APP_NOT_FOUND: + error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_NOT_FOUND: + error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_REJECTED: + error = "APP_CONTROL_ERROR_KEY_REJECTED"; + break; + case APP_CONTROL_ERROR_INVALID_DATA_TYPE: + error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; + break; + case APP_CONTROL_ERROR_LAUNCH_REJECTED: + error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; + break; + case APP_CONTROL_ERROR_PERMISSION_DENIED: + error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; + break; + case APP_CONTROL_ERROR_LAUNCH_FAILED: + error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; + break; + case APP_CONTROL_ERROR_TIMED_OUT: + error = "APP_CONTROL_ERROR_TIMED_OUT"; + break; +#ifdef TIZEN_3_0 + case APP_CONTROL_ERROR_IO_ERROR: + error = "APP_CONTROL_ERROR_IO_ERROR"; + break; +#endif +#ifdef TIZEN_2_4 + case APP_CONTROL_ERROR_IO_ERROR: + error = "APP_CONTROL_ERROR_IO_ERROR"; + break; +#endif + default: + error = "Unknown Error"; + break; + } + return error; +} + +#endif