2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "vcui-application.h"
19 #include "vcui-view-common.h"
20 #include "vcui-view-single-call.h"
21 #include "vcui-view-elements.h"
23 static int __vc_ui_view_single_call_oncreate(voice_call_view_data_t *view_data, int param1, void *param2, void *param3);
24 static int __vc_ui_view_single_call_onupdate(voice_call_view_data_t *view_data, void *update_data1, void *update_data2);
25 static int __vc_ui_view_single_call_onhide(voice_call_view_data_t *view_data);
26 static int __vc_ui_view_single_call_onshow(voice_call_view_data_t *view_data);
27 static int __vc_ui_view_single_call_ondestroy(voice_call_view_data_t *view_data);
29 static voice_call_view_data_t s_view = {
30 .type = VIEW_INCALL_ONECALL_VIEW,
33 .onCreate = __vc_ui_view_single_call_oncreate,
34 .onUpdate = __vc_ui_view_single_call_onupdate,
35 .onHide = __vc_ui_view_single_call_onhide,
36 .onShow = __vc_ui_view_single_call_onshow,
37 .onDestroy = __vc_ui_view_single_call_ondestroy,
41 voice_call_view_data_t *_vc_ui_view_single_call_new(vcui_app_call_data_t *ad)
44 s_view.priv = calloc(1, sizeof(incall_one_view_priv_t));
47 CALL_UI_DEBUG("ERROR!!!!!!!!!!!");
53 static void __vc_ui_view_single_call_draw_screen(Evas_Object *eo, void *data)
57 voice_call_view_data_t *vd = (voice_call_view_data_t *)data;
58 incall_one_view_priv_t *priv = (incall_one_view_priv_t *)vd->priv;
59 vcui_app_call_data_t *ad = vd->app_data;
61 if (priv->now_data == NULL) {
62 CALL_UI_DEBUG("Now Data is NULL");
66 /* ============ Check valid Evas Object ============= */
68 CALL_UI_KPI("_vcui_check_valid_eo ONEVIEW start");
69 valid = _vcui_check_valid_eo(priv->contents, "ONEVIEW");
70 CALL_UI_KPI("_vcui_check_valid_eo ONEVIEW done");
72 CALL_UI_DEBUG("[========== ONEVIEW : Invalid Evas Object, priv->contents : %p ==========]", priv->contents);
75 /* ============ Check valid Evas Object ============= */
78 if (strcmp((char *)priv->now_data->call_file_path, NOIMG_ICON) == 0) {
79 _vcui_show_wallpaper_image(priv->contents);
81 CALL_UI_DEBUG("some image case!!");
82 _vcui_show_wallpaper_image(priv->contents);
83 priv->ic = _vcui_show_contact_image(priv->contents, vd->app_data->win_main, priv->now_data->call_file_path);
84 if (priv->now_data->caller_status == CALL_HOLD) {
85 double scale_factor = 0.0;
86 scale_factor = elm_config_scale_get();
87 CALL_UI_DEBUG("scale_factor %f", scale_factor);
89 if (scale_factor == 1.0) {
90 edje_object_signal_emit(_EDJ(priv->contents), "SHOW_DIM_HD", "CID_HD");
92 edje_object_signal_emit(_EDJ(priv->contents), "SHOW_DIM_WVGA", "CID_WVGA");
95 edje_object_signal_emit(_EDJ(priv->contents), "HIDE_DIM", "CID");
99 /* call name (if nothing, call number) */
100 CALL_UI_KPI("edje_object_part_text_set start");
101 if (strlen((char *)priv->now_data->call_display) == 0) {
102 edje_object_part_text_set(_EDJ(eo), "txt_call_name", (char *)priv->now_data->call_num);
104 edje_object_part_text_set(_EDJ(eo), "txt_call_name", (char *)priv->now_data->call_display);
105 edje_object_part_text_set(_EDJ(eo), "txt_contact_phone_type", (char *)priv->now_data->call_num);
107 CALL_UI_KPI("edje_object_part_text_set done");
109 CALL_UI_KPI("_vcui_view_common_set_each_time start");
110 _vcui_view_common_set_each_time(priv->now_data->start_time);
111 CALL_UI_KPI("_vcui_view_common_set_each_time done");
113 CALL_UI_KPI("_vcui_create_top_left_button start");
114 _vcui_create_top_left_button(vd);
115 CALL_UI_KPI("_vcui_create_top_left_button done");
117 CALL_UI_KPI("_vcui_create_top_right_button start");
118 _vcui_create_top_right_button(vd);
119 CALL_UI_KPI("_vcui_create_top_right_button done");
121 CALL_UI_KPI("_vcui_create_bottom_left_button start");
122 _vcui_create_bottom_left_button(vd);
123 CALL_UI_KPI("_vcui_create_bottom_left_button done");
125 CALL_UI_KPI("_vcui_create_bottom_middle_button start");
126 _vcui_create_bottom_middle_button(vd);
127 CALL_UI_KPI("_vcui_create_bottom_middle_button done");
129 if ((_vcui_is_phonelock_status() == EINA_TRUE)&&(_vcui_is_idle_lock() == EINA_TRUE)) {
130 CALL_UI_KPI("_vcui_create_top_middle_button start");
131 _vcui_create_top_middle_button_disabled(vd);
132 CALL_UI_KPI("_vcui_create_top_middle_button done");
134 CALL_UI_KPI("_vcui_create_bottom_right_button start");
135 _vcui_create_bottom_right_button_disabled(vd);
136 CALL_UI_KPI("_vcui_create_bottom_right_button done");
138 CALL_UI_KPI("_vcui_create_top_middle_button start");
139 _vcui_create_top_middle_button(vd);
140 CALL_UI_KPI("_vcui_create_top_middle_button done");
142 _vcui_create_bottom_right_button(vd);
145 CALL_UI_KPI("_vcui_create_button_bigend start");
146 _vcui_create_button_bigend(vd);
147 CALL_UI_KPI("_vcui_create_button_bigend done");
149 CALL_UI_KPI("edje_object_signal_emit effect start");
150 if (ad->beffect_needed == EINA_TRUE) {
151 edje_object_signal_emit(_EDJ(priv->contents), "SHOW_EFFECT", "ALLBTN");
152 ad->beffect_needed = EINA_FALSE;
154 edje_object_signal_emit(_EDJ(priv->contents), "SHOW_NO_EFFECT", "ALLBTN");
156 CALL_UI_KPI("edje_object_signal_emit effect done");
158 CALL_UI_KPI("evas_object_show start");
159 evas_object_show(eo);
160 CALL_UI_KPI("evas_object_show done");
163 static Evas_Object *__vc_ui_view_single_call_create_contents(void *data)
166 CALL_UI_DEBUG("ERROR");
169 voice_call_view_data_t *vd = (voice_call_view_data_t *)data;
170 Evas_Object *eo = NULL;
173 eo = _vcui_load_edj(vd->app_data->win_main, EDJ_NAME, GRP_INCALL);
180 static Evas_Object *__vc_ui_view_single_call_create_layout_main(Evas_Object *parent)
182 if (parent == NULL) {
183 CALL_UI_DEBUG("ERROR");
188 ly = elm_layout_add(parent);
189 retvm_if(ly == NULL, NULL, "Failed elm_layout_add.");
191 elm_layout_theme_set(ly, "standard", "window", "integration");
192 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
193 elm_win_resize_object_add(parent, ly);
195 edje_object_signal_emit(_EDJ(ly), "elm,state,show,indicator", "elm");
196 edje_object_signal_emit(_EDJ(ly), "elm,state,show,content", "elm");
197 evas_object_show(ly);
202 static int __vc_ui_view_single_call_oncreate(voice_call_view_data_t *view_data, int param1, void *param2, void *param3)
204 CALL_UI_DEBUG("incall view create");
205 voice_call_view_data_t *vd = view_data;
206 incall_one_view_priv_t *priv = (incall_one_view_priv_t *)vd->priv;
208 priv->now_data = _vcui_doc_get_first();
209 if (priv->now_data == NULL) {
210 CALL_UI_DEBUG("call data is null");
216 CALL_UI_KPI("__vc_ui_view_single_call_create_layout_main start");
217 vd->layout = __vc_ui_view_single_call_create_layout_main(vd->app_data->win_main);
218 CALL_UI_KPI("__vc_ui_view_single_call_create_layout_main done");
219 if (vd->layout == NULL) {
220 CALL_UI_DEBUG("ERROR");
224 CALL_UI_KPI("__vc_ui_view_single_call_create_contents start");
225 priv->contents = __vc_ui_view_single_call_create_contents(vd);
226 elm_object_part_content_set(vd->layout, "elm.swallow.content", priv->contents);
227 CALL_UI_KPI("__vc_ui_view_single_call_create_contents done");
229 CALL_UI_KPI("evas_object_name_set start");
230 evas_object_name_set(priv->contents, "ONEVIEW");
231 CALL_UI_KPI("evas_object_name_set done");
232 CALL_UI_DEBUG("[========== ONEVIEW: priv->contents Addr : [%p] ==========]", priv->contents);
235 CALL_UI_DEBUG("[UI]ad->layout_incall==NULL case ");
236 evas_object_show(vd->layout);
239 __vc_ui_view_single_call_onshow(view_data);
243 static int __vc_ui_view_single_call_onupdate(voice_call_view_data_t *view_data, void *update_data1, void *update_data2)
245 CALL_UI_DEBUG("incall view update");
247 __vc_ui_view_single_call_onshow(view_data);
252 static int __vc_ui_view_single_call_onhide(voice_call_view_data_t *view_data)
254 CALL_UI_DEBUG("incall view hide");
256 evas_object_hide(view_data->layout);
260 static int __vc_ui_view_single_call_onshow(voice_call_view_data_t *view_data)
262 CALL_UI_DEBUG("incall view show");
263 CALL_UI_KPI("__vc_ui_view_single_call_onshow start");
264 incall_one_view_priv_t *priv = (incall_one_view_priv_t *)view_data->priv;
266 priv->now_data = _vcui_doc_get_first();
267 if (priv->now_data == NULL) {
268 CALL_UI_DEBUG("call data is null");
271 CALL_UI_KPI("__vc_ui_view_single_call_draw_screen start");
272 __vc_ui_view_single_call_draw_screen(priv->contents, view_data);
273 CALL_UI_KPI("__vc_ui_view_single_call_draw_screen done");
276 CALL_UI_KPI("incall-one-view hide start");
277 evas_object_hide(view_data->layout);
278 CALL_UI_KPI("incall-one-view hide done");
279 CALL_UI_KPI("incall-one-view show start");
280 evas_object_show(view_data->layout);
281 CALL_UI_KPI("incall-one-view show done");
282 CALL_UI_KPI("__vc_ui_view_single_call_onshow done");
286 static int __vc_ui_view_single_call_ondestroy(voice_call_view_data_t *view_data)
288 CALL_UI_DEBUG("incall view destroy");
290 vcui_app_call_data_t *ad = _vcui_get_app_data();
292 voice_call_view_data_t *vd = ad->view_st[VIEW_INCALL_ONECALL_VIEW];
293 incall_one_view_priv_t *priv = (incall_one_view_priv_t *)vd->priv;
296 if (priv->contents) {
297 evas_object_del(priv->contents);
298 priv->contents = NULL;
305 if (vd->layout != NULL) {
306 evas_object_hide(vd->layout);
307 evas_object_del(vd->layout);
311 ad->view_st[VIEW_INCALL_ONECALL_VIEW] = NULL;
314 CALL_UI_DEBUG("complete destroy one view");