#if USE_LV_WATCH_SETTING_VOLUME != 0
+#ifdef __MMI_USER_PROFILE_SUPPORT__
+
+static uint8_t s_user_profile_volume_setting_index = 0;
+static uint8_t s_user_profile_volume_value = 0;
+
+
+HAL_SPEAKER_GAIN query_current_volume(void)
+{
+ return 0;
+}
+
+uint8_t setting_get_ring_volume(void)
+{
+ return 0;
+}
+
+void setting_set_ring_volume(uint8_t volume, bool writenvm, bool play)
+{
+ return ;
+}
+
+void setting_tone_play_onetime_cb(void *para)
+{
+ printf("%s has been called\n", __FUNCTION__);
+ Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_7);
+}
+void setting_tone_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority)
+{
+ printf("%s,priority is %d\n", __FUNCTION__,priority);
+ Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_7);
+}
+
+uint8_t mmi_user_profile_volume_setting_volume_get(void)
+{
+ uint8_t volume = 0;
+
+ switch(s_user_profile_volume_setting_index)
+ {
+ case 0:
+ volume = mmi_user_profile_current_mode_incoming_call_volume_get();
+ break;
+
+ case 1:
+ volume = mmi_user_profile_current_mode_new_sms_volume_get();
+ break;
+
+ case 2:
+ volume = mmi_user_profile_current_mode_alarm_volume_get();
+ break;
+
+ case 3:
+ volume = mmi_user_profile_current_mode_remind_volume_get();
+ break;
+
+ default:
+ break;
+ }
+
+ return volume;
+}
+
+void mmi_user_profile_volume_setting_volume_save(uint8_t volume)
+{
+ switch(s_user_profile_volume_setting_index)
+ {
+ case 0:
+ mmi_user_profile_current_mode_incoming_call_volume_set(volume);
+ break;
+
+ case 1:
+ mmi_user_profile_current_mode_new_sms_volume_set(volume);
+ break;
+
+ case 2:
+ mmi_user_profile_current_mode_alarm_volume_set(volume);
+ break;
+
+ case 3:
+ mmi_user_profile_current_mode_remind_volume_set(volume);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void mmi_user_profile_volume_setting_volume_set(bool write_nvm, bool play)
+{
+ uint8_t volume = s_user_profile_volume_value;
+
+ // nv write
+ if(write_nvm)
+ {
+ mmi_user_profile_volume_setting_volume_save(volume);
+ }
+
+ // hal api
+ if(play)
+ {
+ if(AUDIO_CTRL_PRIORITY_7 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_7,setting_tone_audio_ctrl_callback))
+ {
+ LV_AUDIO_DECLARE(audio_msg);
+ Hal_NFFS_File_Play_Onetime(AUDIO_SETTING_AUDIO_MSG, (HAL_SPEAKER_GAIN)volume, setting_tone_play_onetime_cb, 0);
+ }
+ else
+ {
+ Hal_Audio_SetVolume((uint16_t)volume);
+ }
+ }
+}
+
+lv_obj_t * setting_volume_bar_content_create(lv_obj_t * par)
+{
+ lv_obj_t * content;
+ lv_obj_t * img[10];
+ uint8_t i;
+
+ if(!par) {
+ par = lv_scr_act();
+ }
+
+ content = lv_cont_create(par, NULL);
+ lv_cont_set_fit(content, LV_FIT_TIGHT);
+ lv_cont_set_layout(content, LV_LAYOUT_ROW_BOTTOM);
+ LV_ASSERT_MEM(content);
+ if(NULL == content)
+ return NULL;
+
+ lv_obj_set_click(content, false);
+ lv_watch_obj_add_element(content);
+
+ for(i = 0; i < 10; i++)
+ {
+ img[i] = lv_img_create(content, NULL);
+ LV_ASSERT_MEM(img[i]);
+ if(NULL == img[i])
+ return NULL;
+
+ if(i < s_user_profile_volume_value)
+ {
+ lv_img_set_src(img[i], ICON_SUB_BOX_BLUE);
+ }
+ else
+ {
+ lv_img_set_src(img[i], ICON_SUB_BOX_GRAY);
+ }
+ lv_watch_set_free_num(img[i], i);
+ lv_watch_obj_add_element(img[i]);
+ }
+
+ return content;
+}
+
+void setting_volume_prepare_destory(lv_obj_t * activity_obj)
+{
+ mmi_user_profile_volume_setting_volume_set(true, false);
+ lv_watch_png_cache_all_free();
+}
+
+void setting_volume_decrease_btn_action(lv_obj_t * btn, lv_event_t event)
+{
+ lv_obj_t * par;
+ lv_obj_t * child = NULL;
+ lv_obj_t * content;
+ lv_obj_t * img = NULL;
+ uint8_t i;
+
+ if(LV_EVENT_PRESSED != event)
+ return;
+
+ content = lv_obj_get_parent(btn);
+ par = lv_obj_get_parent(content);
+
+ for(i = 0; i < 3; i++)
+ {
+ child = lv_obj_get_child(par, child);
+ if(1 == lv_obj_get_user_data(child).user_num) {
+ break;
+ }
+ }
+
+ for(i = 0; i < 10; i++)
+ {
+ img = lv_obj_get_child(child, img);
+ if(s_user_profile_volume_value <= lv_obj_get_user_data(img).user_num)
+ {
+ continue;
+ }
+ else
+ {
+ lv_img_set_src(img, ICON_SUB_BOX_GRAY);
+ s_user_profile_volume_value--;
+ mmi_user_profile_volume_setting_volume_set(false, true);
+ break;
+ }
+ }
+
+ return;
+}
+
+void setting_volume_increase_btn_action(lv_obj_t * btn, lv_event_t event)
+{
+ lv_obj_t * par;
+ lv_obj_t * child = NULL;
+ lv_obj_t * content;
+ lv_obj_t * img = NULL;
+ uint8_t i;
+
+ if(LV_EVENT_PRESSED != event)
+ return;
+
+ content = lv_obj_get_parent(btn);
+ par = lv_obj_get_parent(content);
+
+ for(i = 0; i < 3; i++)
+ {
+ child = lv_obj_get_child(par, child);
+ if(1 == lv_obj_get_user_data(child).user_num) {
+ break;
+ }
+ }
+
+ for(i = 0; i < 10; i++)
+ {
+ img = lv_obj_get_child_back(child, img);
+ if(s_user_profile_volume_value > lv_obj_get_user_data(img).user_num)
+ {
+ continue;
+ }
+ else
+ {
+ lv_img_set_src(img, ICON_SUB_BOX_BLUE);
+ s_user_profile_volume_value++;
+ mmi_user_profile_volume_setting_volume_set(false, true);
+ break;
+ }
+ }
+}
+
+lv_obj_t * setting_volume_button_content_create(lv_obj_t * par)
+{
+ lv_obj_t * content;
+ lv_obj_t * btn1;
+ lv_obj_t * btn2;
+ lv_obj_t * img;
+
+ if(!par) {
+ par = lv_scr_act();
+ }
+
+ content = lv_cont_create(par, NULL);
+ lv_cont_set_fit(content, LV_FIT_TIGHT);
+ lv_cont_set_layout(content, LV_LAYOUT_ROW_MID);
+ LV_ASSERT_MEM(content);
+ if(NULL == content) {
+ return NULL;
+ }
+
+ lv_obj_set_click(content, true);
+ lv_watch_obj_add_element(content);
+
+ btn1 = lv_imgbtn_create(content, NULL);
+ lv_imgbtn_set_src(btn1, LV_BTN_STATE_RELEASED, ICON_DECREASE);
+ lv_imgbtn_set_src(btn1, LV_BTN_STATE_PRESSED, ICON_DECREASE);
+ lv_obj_set_event_cb(btn1, setting_volume_decrease_btn_action);
+ lv_watch_obj_add_element(btn1);
+
+ img = lv_img_create(content, NULL);
+ LV_ASSERT_MEM(img);
+ if(NULL == img) {
+ return NULL;
+ }
+ lv_img_set_src(img, ICON_SPEAKER);
+ lv_watch_obj_add_element(img);
+
+
+ btn2 = lv_imgbtn_create(content, NULL);
+ lv_imgbtn_set_src(btn2, LV_BTN_STATE_RELEASED, ICON_INCREASE);
+ lv_imgbtn_set_src(btn2, LV_BTN_STATE_PRESSED, ICON_INCREASE);
+ lv_obj_set_event_cb(btn2, setting_volume_increase_btn_action);
+ lv_watch_obj_add_element(btn2);
+
+ return content;
+}
+
+lv_obj_t * setting_volume_create(lv_obj_t * activity_obj)
+{
+ lv_obj_t * obj;
+ lv_obj_t * label;
+ lv_obj_t * bar_content;
+ lv_obj_t * button_content;
+
+ if(NULL == activity_obj) {
+ lv_watch_activity_ext_t activity_ext;
+ memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t));
+ activity_ext.actId = ACT_ID_SETTING_VOLUME;
+ activity_ext.create = setting_volume_create;
+ activity_ext.prepare_destory = setting_volume_prepare_destory;
+ activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+ LV_ASSERT_MEM(activity_obj);
+ if(NULL == activity_obj) {
+ return NULL;
+ }
+ }
+
+ obj = lv_watch_obj_create(activity_obj);
+ LV_ASSERT_MEM(obj);
+ if(NULL == obj) {
+ return NULL;
+ }
+
+ uint32_t text_id[] = {WATCH_TEXT_ID_INCOMING_CALL_VOLUME,
+ WATCH_TEXT_ID_NEW_SMS_VOLUME,
+ WATCH_TEXT_ID_ALARM_VOLUME,
+ WATCH_TEXT_ID_REMIND_VOLUME
+ };
+
+ label = lv_label_create(obj, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_obj_set_click(label, false);
+ lv_label_set_text_id(label, text_id[s_user_profile_volume_setting_index]);
+ lv_obj_align(label, obj, LV_ALIGN_IN_TOP_MID, 0, 10);
+ lv_watch_set_free_num(label, 0);
+
+ bar_content = setting_volume_bar_content_create(obj);
+ lv_obj_add_style(bar_content, LV_CONT_PART_MAIN, &lv_watch_style_transp);
+ lv_obj_align(bar_content, obj, LV_ALIGN_IN_BOTTOM_MID, 0, -(LV_VER_RES * 3 / 5));
+ lv_watch_set_free_num(bar_content, 1);
+
+ button_content = setting_volume_button_content_create(obj);
+ lv_obj_add_style(button_content, LV_CONT_PART_MAIN, &lv_watch_style_transp);
+ lv_obj_align(button_content, obj, LV_ALIGN_IN_BOTTOM_MID, 0, -(LV_VER_RES / 4));
+ lv_watch_set_free_num(button_content, 2);
+
+ return obj;
+}
+
+void mmi_user_profile_volume_setting_event_cb(lv_obj_t * btn, lv_event_t event)
+{
+ if(LV_EVENT_CLICKED != event)
+ return;
+
+ s_user_profile_volume_setting_index = lv_watch_get_free_num(btn);
+ s_user_profile_volume_value = mmi_user_profile_volume_setting_volume_get();
+
+ lv_watch_png_cache_all_free();
+ setting_volume_create(NULL);
+}
+
+static void mmi_user_profile_volume_prepare_destory(lv_obj_t * activity_obj)
+{
+ lv_watch_png_cache_all_free();
+}
+
+static lv_obj_t * mmi_user_profile_volume_create(lv_obj_t * activity_obj)
+{
+ if(activity_obj == NULL)
+ {
+ lv_watch_activity_ext_t activity_ext = {0};
+
+ activity_ext.actId = ACT_ID_WATCH_SETTING_COMMON;
+ activity_ext.create = mmi_user_profile_volume_create;
+ activity_ext.prepare_destory = mmi_user_profile_volume_prepare_destory;
+ activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+ if(NULL == activity_obj)
+ return NULL;
+ }
+
+ lv_obj_t * watch_obj = lv_watch_obj_create(activity_obj);
+ if(NULL == watch_obj)
+ return NULL;
+
+ lv_obj_t * cont = lv_cont_create(watch_obj, NULL);
+ lv_cont_set_fit(cont, LV_FIT_NONE);
+ lv_obj_set_size(cont, LV_HOR_RES, LV_VER_RES); // lv_obj_get_width(obj), lv_obj_get_height(obj));
+ //lv_obj_add_style(cont,LV_OBJ_PART_MAIN, &lv_watch_style_transp);
+ lv_obj_set_style_local_bg_color(cont, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_cont_set_layout(cont, LV_LAYOUT_OFF);
+ lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+ lv_obj_set_click(cont, false);
+
+ if(true == mmi_user_profile_is_vib_only_mode() || true == mmi_user_profile_is_silent_mode())
+ {
+ lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+ lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_BREAK);
+ lv_obj_set_width(label_prompt, LV_HOR_RES - 40);
+ lv_obj_add_style(label_prompt, LV_OBJ_PART_MAIN, &lv_watch_font26);
+ lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+ lv_obj_set_click(label_prompt, false);
+ lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_NO_VOLUME_MODIFY);
+ lv_obj_align(label_prompt, NULL, LV_ALIGN_CENTER, 0, -10);
+ }
+ else
+ {
+ lv_obj_t * label_title = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_title, LV_LABEL_PART_MAIN, &lv_watch_font20_gray);
+ lv_label_set_align(label_title, LV_LABEL_ALIGN_CENTER);
+ lv_label_set_text_id(label_title, WATCH_TEXT_ID_VOLUME_ADJUST);
+ lv_obj_align(label_title, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
+
+ lv_obj_t * list = lv_list_create(cont, NULL);
+ lv_obj_set_size(list, LV_HOR_RES - 40, LV_VER_RES - 40 - 40);
+ lv_obj_align(list, NULL, LV_ALIGN_IN_TOP_MID, 0, 40);
+ lv_page_set_edge_flash(list, false);
+ lv_page_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_OFF);
+ lv_watch_obj_add_element(list);
+ lv_watch_obj_add_element(lv_page_get_scrl(list));
+
+ lv_obj_add_style(list, LV_LIST_PART_BG, &lv_watch_style_transp);
+ lv_obj_add_style(list, LV_LIST_PART_SCROLLBAR, &lv_watch_cont_opa1);
+ lv_obj_set_style_local_bg_opa(list, LV_LIST_PART_SCROLLABLE, LV_STATE_DEFAULT, LV_OPA_TRANSP);
+ lv_obj_set_style_local_pad_inner(list, LV_LIST_PART_SCROLLABLE, LV_STATE_DEFAULT, 10);
+ lv_obj_set_style_local_pad_left(list, LV_LIST_PART_SCROLLABLE, LV_STATE_DEFAULT, 5);
+ lv_obj_set_style_local_pad_right(list, LV_LIST_PART_SCROLLABLE, LV_STATE_DEFAULT, 5);
+
+ uint8_t i = 0;
+ uint32_t text_id[] = {WATCH_TEXT_ID_INCOMING_CALL_VOLUME,
+ WATCH_TEXT_ID_NEW_SMS_VOLUME,
+ WATCH_TEXT_ID_ALARM_VOLUME,
+ WATCH_TEXT_ID_REMIND_VOLUME
+ };
+
+ for(i = 0; i < sizeof(text_id) / sizeof(text_id[0]); i++)
+ {
+ lv_obj_t * btn = lv_btn_create(list, NULL);
+
+ /*Set the default styles*/
+ lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_opa(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
+ lv_obj_set_style_local_radius(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15);
+ lv_obj_set_style_local_pad_left(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_pad_right(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_pad_top(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_pad_bottom(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_pad_inner(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_line_width(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_opa(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, LV_OPA_20);
+ lv_obj_set_style_local_radius(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 15);
+ lv_obj_set_style_local_pad_left(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+ lv_obj_set_style_local_pad_right(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+ lv_obj_set_style_local_pad_top(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+ lv_obj_set_style_local_pad_bottom(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+ lv_obj_set_style_local_pad_inner(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+ lv_obj_set_style_local_line_width(btn, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 0);
+
+ lv_page_glue_obj(btn, true);
+ lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST);
+
+ lv_obj_set_size(btn, 200, 46);
+ lv_obj_set_event_cb(btn, mmi_user_profile_volume_setting_event_cb);
+ lv_watch_set_free_num(btn, i);
+ lv_watch_obj_add_element(btn);
+
+ lv_obj_t * label = lv_label_create(btn, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_label_set_text_id(label, text_id[i]);
+ lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
+ }
+ }
+
+ return watch_obj;
+}
+
+void setting_volume_create_btn_action(lv_obj_t * btn, lv_event_t event)
+{
+ if(LV_EVENT_CLICKED != event)
+ return;
+
+ lv_watch_png_cache_all_free();
+ mmi_user_profile_volume_create(NULL);
+}
+
+#else
+
/*********************
* DEFINES
*********************/
/**********************
* STATIC FUNCTIONS
**********************/
+#endif
#endif /*USE_LV_WATCH_SETTING_VOLUME*/
lv_style_t lv_watch_chat_list_btn_pr_style;
#ifdef __MMI_ZHSX_SUPPORT__
-lv_style_t lv_watch_font22;
-lv_style_t lv_watch_font22_black;
-lv_style_t lv_watch_font22_gray;
-lv_style_t lv_watch_font22_yellow;
+lv_style_t lv_watch_font18;
+lv_style_t lv_watch_font18_black;
lv_style_t lv_watch_font24;
lv_style_t lv_watch_font24_black;
lv_style_t lv_watch_font24_gray;
lv_font_t lv_font_ttf_14;
lv_font_t lv_font_ttf_40;
#ifdef __MMI_ZHSX_SUPPORT__
-lv_font_t lv_font_ttf_22;
+lv_font_t lv_font_ttf_18;
lv_font_t lv_font_ttf_24;
lv_font_t lv_font_ttf_26;
lv_font_t lv_font_ttf_28;
lv_style_set_text_font(&lv_watch_font40_yellow, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_40);
#ifdef __MMI_ZHSX_SUPPORT__
- style_init_reset(&lv_watch_font22);
- lv_style_set_text_color(&lv_watch_font22, LV_STATE_DEFAULT, LV_COLOR_WHITE);
- lv_style_set_text_font(&lv_watch_font22, LV_STATE_DEFAULT, &lv_font_ttf_22);
+ style_init_reset(&lv_watch_font18);
+ lv_style_set_text_color(&lv_watch_font18, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_style_set_text_font(&lv_watch_font18, LV_STATE_DEFAULT, &lv_font_ttf_18);
- style_init_reset(&lv_watch_font22_yellow);
- lv_style_set_text_color(&lv_watch_font22_yellow, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
- lv_style_set_text_font(&lv_watch_font22_yellow, LV_STATE_DEFAULT, &lv_font_ttf_22);
-
- style_init_reset(&lv_watch_font22_black);
- lv_style_set_text_color(&lv_watch_font22_black, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- lv_style_set_text_font(&lv_watch_font22_black, LV_STATE_DEFAULT, &lv_font_ttf_22);
-
- style_init_reset(&lv_watch_font22_gray);
- lv_style_set_text_color(&lv_watch_font22_gray, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_style_set_text_font(&lv_watch_font22_gray, LV_STATE_DEFAULT, &lv_font_ttf_22);
+ style_init_reset(&lv_watch_font18_black);
+ lv_style_set_text_color(&lv_watch_font18_black, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_style_set_text_font(&lv_watch_font18_black, LV_STATE_DEFAULT, &lv_font_ttf_18);
style_init_reset(&lv_watch_font24);
lv_style_set_text_color(&lv_watch_font24, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_freetype_font_init(&lv_font_ttf_14, LV_FONT_TTF, 14);
lv_freetype_font_init(&lv_font_ttf_40, LV_FONT_TTF, 40);
#ifdef __MMI_ZHSX_SUPPORT__
- lv_freetype_font_init(&lv_font_ttf_22, LV_FONT_TTF, 22);
+ lv_freetype_font_init(&lv_font_ttf_18, LV_FONT_TTF, 18);
lv_freetype_font_init(&lv_font_ttf_24, LV_FONT_TTF, 24);
lv_freetype_font_init(&lv_font_ttf_26, LV_FONT_TTF, 26);
lv_freetype_font_init(&lv_font_ttf_28, LV_FONT_TTF, 28);