3 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 void _internal_decrypt_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
23 dlog_print(DLOG_DEBUG, LOG_TAG, "_internal_decrypt_next_btn_clicked_cb start");
25 appdata_s *ad = (appdata_s *) data;
26 ode_confirm_decrypt_device_create_view(ad);
29 static void update_internal_decrypt_next_button_status(appdata_s *ad)
31 dlog_print(DLOG_DEBUG, LOG_TAG, "update_internal_decrypt_next_button_status start");
32 if (ad->device_info.next_button == NULL) {
33 dlog_print(DLOG_ERROR, LOG_TAG, "[Encrypt Device] next button is null");
37 if (ad->device_info.battery_status && ad->device_info.charger_status) {
38 elm_object_disabled_set(ad->device_info.next_button, EINA_FALSE);
40 elm_object_disabled_set(ad->device_info.next_button, EINA_TRUE);
44 static void dec_battery_charger_changed_cb(runtime_info_key_e key, void *data)
46 appdata_s *ad = (appdata_s *) data;
47 if (key == RUNTIME_INFO_KEY_CHARGER_CONNECTED) {
48 battery_icon_status_update(ad);
49 update_internal_decrypt_next_button_status(ad);
53 static void dec_battery_changed_cb(device_callback_e type, void *value, void *user_data)
55 appdata_s *ad = (appdata_s *) user_data;
56 if (type == DEVICE_CALLBACK_BATTERY_CAPACITY) {
57 battery_icon_status_update(ad);
58 update_internal_decrypt_next_button_status(ad);
62 void ode_check_decrypt_device_create_view(appdata_s *ad)
64 Evas_Object *navi_bar = ad->navi_bar;
65 Evas_Object *base_layout = NULL;
66 Evas_Object *check_msg = NULL;
67 Evas_Object *encryption_check_layout = NULL;
68 Evas_Object *genlist = NULL;
69 Elm_Genlist_Item_Class *itc;
71 dlog_print(DLOG_DEBUG, LOG_TAG, "start ode_check_decrypt_device_create_view");
72 char string[PATH_MAX] = "";
73 char *check_text[] = {
74 "IDS_ST_BODY_DECRYPTING_YOUR_DEVICE_WILL_DECRYPT_THE_APPS_DATA_AND_OTHER_CONTENT_ON_YOUR_DEVICE",
75 "IDS_ST_BODY_THIS_MAY_TAKE_A_LONG_TIME_DEPENDING_ON_THE_AMOUNT_OF_DATA_INTERRUPTING_THIS_PROCESS_MAY_CAUSE_MSG",
76 "IDS_ST_HEADER_TO_DECRYPT_YOUR_DEVICE_C_ABB"
79 char *status_text[] = {
80 "IDS_ST_BODY_CHARGE_THE_BATTERY_TO_AT_LEAST_PDP",
81 "IDS_ST_BODY_CONNECT_THE_DEVICE_TO_A_CHARGER",
82 "IDS_ST_BODY_SET_THE_SCREEN_LOCK_TYPE_TO_PASSWORD"
87 if (navi_bar == NULL) {
88 dlog_print(DLOG_ERROR, LOG_TAG, "navi_bar is null");
92 base_layout = ode_create_layout(navi_bar, ad->edj_path, "base_layout");
93 encryption_check_layout = ode_create_layout(base_layout, ad->edj_path, "encrypt_device_check_layout");
94 ad->encryption_layout = encryption_check_layout;
96 snprintf(string, sizeof(string), "%s<br><br>%s", __(check_text[0]), __(check_text[1]));
98 check_msg = ode_create_textblock(encryption_check_layout, string, MSG_TEXT_STYLE);
99 elm_object_part_content_set(encryption_check_layout, "msg_content", check_msg);
101 /* add group index */
102 genlist = elm_genlist_add(encryption_check_layout);
103 elm_object_style_set(genlist, "solid/default");
104 elm_layout_content_set(encryption_check_layout, "genlist_base", genlist);
105 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
107 itc = ode_create_genlist_item_class("group_index", ode_group_text_get, NULL);
108 ode_append_genlist_item(genlist, itc, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY, check_text[2]);
110 set_next_btn(base_layout, ad->edj_path, __("IDS_ST_BUTTON_NEXT"), _internal_decrypt_next_btn_clicked_cb, ad);
112 /* get battery info */
113 ret = battery_icon_status_update(ad);
115 dlog_print(DLOG_ERROR, LOG_TAG, "battery_status_update failed");
119 ret = battery_cb_register(dec_battery_charger_changed_cb, dec_battery_changed_cb, ad);
121 dlog_print(DLOG_ERROR, LOG_TAG, "battery_cb_register failed");
124 update_internal_decrypt_next_button_status(ad);
125 snprintf(string, sizeof(string), __(status_text[0]), NEEDED_BATTERY_PERCENT);
126 check_msg = ode_create_textblock(encryption_check_layout, string, MSG_TEXT_STYLE);
127 elm_object_part_content_set(encryption_check_layout, "battery_text", check_msg);
129 snprintf(string, sizeof(string), "%s", __(status_text[1]));
130 check_msg = ode_create_textblock(encryption_check_layout, string, MSG_TEXT_STYLE);
131 elm_object_part_content_set(encryption_check_layout, "charge_text", check_msg);
133 elm_object_part_content_set(base_layout, "content_layout", encryption_check_layout);
135 sw_back_btn_set(navi_bar, __("IDS_ST_HEADER_DECRYPT_DEVICE"), base_layout);