From: hongkwon Date: Sun, 21 Oct 2012 06:33:41 +0000 (+0900) Subject: Update changed code to RSA X-Git-Tag: 2.1b_release~2^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=488ce0f83865f5f8f3710d8c85c9fa5556476ca1;p=apps%2Fnative%2Fvolume-app.git Update changed code to RSA --- diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 7569bb7..53d40e6 100755 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -6,9 +6,16 @@ ADD_CUSTOM_COMMAND(OUTPUT volume_popup.edj ${CMAKE_CURRENT_SOURCE_DIR}/volume_popup.edc ${CMAKE_BINARY_DIR}/volume_popup.edj DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/volume_popup.edc ) -ADD_CUSTOM_TARGET(edj_build DEPENDS volume_popup.edj) +ADD_CUSTOM_COMMAND(OUTPUT volume_app.edj + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images/private + ${CMAKE_CURRENT_SOURCE_DIR}/volume_app.edc ${CMAKE_BINARY_DIR}/volume_app.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/volume_app.edc +) + +ADD_CUSTOM_TARGET(edj_build DEPENDS volume_popup.edj volume_app.edj) ADD_DEPENDENCIES(${PROJECT_NAME} edj_build) INSTALL(FILES ${CMAKE_BINARY_DIR}/volume_popup.edj DESTINATION ${EDJDIR}) +INSTALL(FILES ${CMAKE_BINARY_DIR}/volume_app.edj DESTINATION ${EDJDIR}) # install images INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/public/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.png") diff --git a/data/images/private/00_popup_bg.png b/data/images/private/00_popup_bg.png new file mode 100755 index 0000000..e4bffb2 Binary files /dev/null and b/data/images/private/00_popup_bg.png differ diff --git a/data/images/private/00_popup_bottom_bg.png b/data/images/private/00_popup_bottom_bg.png new file mode 100755 index 0000000..c595eec Binary files /dev/null and b/data/images/private/00_popup_bottom_bg.png differ diff --git a/data/images/private/00_popup_title_bg.png b/data/images/private/00_popup_title_bg.png new file mode 100755 index 0000000..ac60214 Binary files /dev/null and b/data/images/private/00_popup_title_bg.png differ diff --git a/data/images/private/00_slider_handle.png b/data/images/private/00_slider_handle.png new file mode 100755 index 0000000..b58aac1 Binary files /dev/null and b/data/images/private/00_slider_handle.png differ diff --git a/data/images/private/00_slider_handle_dim.png b/data/images/private/00_slider_handle_dim.png new file mode 100755 index 0000000..0356aa4 Binary files /dev/null and b/data/images/private/00_slider_handle_dim.png differ diff --git a/data/images/private/00_winset_divider_line.png b/data/images/private/00_winset_divider_line.png new file mode 100755 index 0000000..b10e249 Binary files /dev/null and b/data/images/private/00_winset_divider_line.png differ diff --git a/data/images/private/00_winset_list_progress_bar.png b/data/images/private/00_winset_list_progress_bar.png new file mode 100755 index 0000000..9d979e2 Binary files /dev/null and b/data/images/private/00_winset_list_progress_bar.png differ diff --git a/data/images/private/00_winset_list_progress_bar_h.png b/data/images/private/00_winset_list_progress_bar_h.png new file mode 100755 index 0000000..365878f Binary files /dev/null and b/data/images/private/00_winset_list_progress_bar_h.png differ diff --git a/data/images/private/00_winset_list_progress_bg.png b/data/images/private/00_winset_list_progress_bg.png new file mode 100755 index 0000000..3cece50 Binary files /dev/null and b/data/images/private/00_winset_list_progress_bg.png differ diff --git a/data/images/private/00_winset_list_progress_bg_h.png b/data/images/private/00_winset_list_progress_bg_h.png new file mode 100755 index 0000000..c3555ac Binary files /dev/null and b/data/images/private/00_winset_list_progress_bg_h.png differ diff --git a/data/images/public/00_volume_icon.png b/data/images/public/00_volume_icon.png index ec84b75..d9bdd9b 100755 Binary files a/data/images/public/00_volume_icon.png and b/data/images/public/00_volume_icon.png differ diff --git a/data/images/public/00_volume_icon_Call.png b/data/images/public/00_volume_icon_Call.png new file mode 100755 index 0000000..922b246 Binary files /dev/null and b/data/images/public/00_volume_icon_Call.png differ diff --git a/data/images/public/00_volume_icon_Mute.png b/data/images/public/00_volume_icon_Mute.png index e17ef34..bb970b9 100755 Binary files a/data/images/public/00_volume_icon_Mute.png and b/data/images/public/00_volume_icon_Mute.png differ diff --git a/data/images/public/00_volume_icon_Vibrat.png b/data/images/public/00_volume_icon_Vibrat.png index 993ef9c..2528fff 100755 Binary files a/data/images/public/00_volume_icon_Vibrat.png and b/data/images/public/00_volume_icon_Vibrat.png differ diff --git a/data/images/public/00_volume_icon_headphone.png b/data/images/public/00_volume_icon_headphone.png new file mode 100755 index 0000000..0819ca0 Binary files /dev/null and b/data/images/public/00_volume_icon_headphone.png differ diff --git a/data/images/public/00_volume_icon_media.png b/data/images/public/00_volume_icon_media.png new file mode 100755 index 0000000..39b0abe Binary files /dev/null and b/data/images/public/00_volume_icon_media.png differ diff --git a/data/images/public/00_volume_icon_settings.png b/data/images/public/00_volume_icon_settings.png new file mode 100755 index 0000000..645d51b Binary files /dev/null and b/data/images/public/00_volume_icon_settings.png differ diff --git a/data/images/public/00_volume_icon_settings_pressed.png b/data/images/public/00_volume_icon_settings_pressed.png new file mode 100755 index 0000000..71cdb7b Binary files /dev/null and b/data/images/public/00_volume_icon_settings_pressed.png differ diff --git a/data/images/public/00_winset_divider_line.png b/data/images/public/00_winset_divider_line.png new file mode 100755 index 0000000..e287978 Binary files /dev/null and b/data/images/public/00_winset_divider_line.png differ diff --git a/data/volume_app.edc b/data/volume_app.edc new file mode 100755 index 0000000..85a19bc --- /dev/null +++ b/data/volume_app.edc @@ -0,0 +1,703 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.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.tizenopensource.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. + */ +collections { + + #define SLIDER_INDICATOR_TEXT_COLOR_INC 42 109 140 255 + #define SLIDER_UNITS_TEXT_COLOR_INC 100 100 100 255 + #define SLIDER_UNITS_TEXT_SIZE_INC 30 + #define SLIDER_INDICATOR_TEXT_SIZE_INC 40 + #define SLIDER_BASE_HEIGHT_INC 16 + #define SLIDER_BASE_MIN_WIDTH_INC 375 + #define SLIDER_BASE_HEIGHT_INC 16 + #define SLIDER_SWALLOW_BAR_MIN_WIDTH_INC 58 + #define SLIDER_SWALLOW_BAR_HEIGHT_INC 58 + #define SLIDER_INDICATOR_MAX_WIDTH_INC 90 + #define SLIDER_INDICATOR_WIDTH_INC 58 + #define SLIDER_INDICATOR_HEIGHT_INC 58 + #define SLIDER_DISABLER_PART_COLOR_INC 185 185 185 100 + + group { name: "elm/slider/horizontal/indicator/default"; + alias: "elm/slider/horizontal/indicator/disabled"; + alias: "elm/slider/vertical/indicator/default"; + alias: "elm/slider/vertical/indicator/disabled"; + alias: "elm/slider/horizontal/indicator/tap_to_drag"; + images { + image: "00_slider_handle.png" COMP; + image: "00_slider_handle_dim.png" COMP; + } + + parts { + part { name: "button_events"; + type: RECT; + mouse_events: 1; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + min: 2*SLIDER_INDICATOR_WIDTH_INC 1.5*SLIDER_INDICATOR_HEIGHT_INC; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + color: 0 0 0 0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + + part { name: "button0"; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + min: SLIDER_INDICATOR_WIDTH_INC SLIDER_INDICATOR_HEIGHT_INC; + max: SLIDER_INDICATOR_MAX_WIDTH_INC SLIDER_INDICATOR_HEIGHT_INC; + rel1 { + to: "elm.indicator"; + offset: -2 -2; + } + rel2 { + to: "elm.indicator"; + offset: 2 2; + } + image { + normal: "00_slider_handle.png"; + border: 3 3 3 3; + border_scale: 1; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + image { + normal: "00_slider_handle_dim.png"; + } + } + } /* "button0" end */ + + part { name: "elm.indicator"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 1; + color: SLIDER_INDICATOR_TEXT_COLOR_INC; + text { + font: "SLP:style=Medium"; + size: SLIDER_INDICATOR_TEXT_SIZE_INC; + min: 1 1; + align: 0.5 0.5; + text_class: "slp_medium"; + } + } + description { state: "hide" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } /* "elm.indicator" end */ + } /* parts of "elm/slider/horizontal/indicator/default" end */ + + programs { + program { name: "set_val_show"; + signal: "elm,state,val,show"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.indicator"; + } + program { name: "set_val_hide"; + signal: "elm,state,val,hide"; + source: "elm"; + action: STATE_SET "hide" 0.0; + target: "elm.indicator"; + } + program { name: "slider_disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "button0"; + target: "button_events"; + } + program { name: "slider_enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "button0"; + target: "button_events"; + } + } + } + /* END group "elm/slider/horizontal/indicator/default" */ + + group { name: "elm/slider/horizontal/volumeHorizontalSlider"; + images { + image: "00_winset_list_progress_bg.png" COMP; + image: "00_winset_list_progress_bar.png" COMP; + image: "00_winset_divider_line.png" COMP; + } + + script { + public invert_on = 0; + public set_invert_on() { + set_state(PART:"level", "inverted", 0.0); + set_state(PART:"level2", "inverted", 0.0); + set_int(invert_on, 1); + } + public set_invert_off() { + set_state(PART:"level", "default", 0.0); + set_state(PART:"level2", "default", 0.0); + set_int(invert_on, 0); + } + public thumb_down() { + if(get_int(invert_on) == 0) + set_state(PART:"level", "pressed", 0.0); + else if(get_int(invert_on) == 1) + set_state(PART:"level2", "pressed", 0.0); + } + public thumb_up() { + if(get_int(invert_on) == 0) + set_state(PART:"level", "default", 0.0); + else if(get_int(invert_on) == 1) + set_state(PART:"level2", "inverted", 0.0); + } + } + + parts { + part { name: "base"; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + min: 402 16; + max: 99999 16; + rel1.to: "bg"; + rel2.to: "bg"; + image.normal: "00_winset_list_progress_bg.png"; + image.border: 0 0 4 4; + image.border_scale: 1; + } + } /* "base" end */ + + part { name: "level"; + mouse_events: 0; + scale: 1; + clip_to: "clipper"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "base"; + rel2 { + to_y: "base"; + to_x: "elm.dragable.slider"; + relative: 0.5 1.0; + } + image.normal: "00_winset_list_progress_bar.png"; + image.border: 0 0 4 4; + image.border_scale: 1; + } + description { state: "inverted" 0.0; + inherit: "default" 0.0; + visible: 0; + } + description { state: "pressed" 0.0; + inherit: "default" 0.0; + image.normal: "00_winset_list_progress_bar.png"; + } + } /* "level" end */ + + part { name: "level2"; + mouse_events: 0; + scale: 1; + clip_to: "clipper"; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + rel1 { + to_y: "base"; + to_x: "elm.dragable.slider"; + relative: 0.5 0.0; + } + rel2.to: "base"; + image.normal: "00_winset_list_progress_bar.png"; + image.border: 0 0 4 4; + image.border_scale: 1; + } + description { state: "inverted" 0.0; + inherit: "default" 0.0; + visible: 1; + } + description { state: "pressed" 0.0; + inherit: "default" 0.0; + visible: 1; + image.normal: "00_winset_list_progress_bar.png"; + } + } /* "level" end */ + + part { name: "bg"; + type: RECT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 0; + rel1.to: "elm.swallow.bar"; + rel2.to: "elm.swallow.bar"; + } + } /* "bg" end */ + + part { name: "elm.swallow.bar"; + type: SWALLOW; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + min: 58 58; + max: 402 58; + align: 1.0 0.5; + rel1 { + to_x: "bar_left_padding"; + relative: 1.0 0.0; + } + rel2 { + to_x: "bar_right_padding"; + relative: 0.0 1.0; + } + } + } /* "elm.swallow.bar" end */ + + part { name: "bar_left_padding"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + visible: 1; + min: 28 0; + fixed: 1 1; + color : 255 0 0 255; + rel1 { + relative: 1.0 0.5; + to_x: "elm.text"; + } + rel2 { + relative: 1.0 0.5; + to_x: "elm.text"; + } + align: 0.0 0.5; + } + } /* "bar_left_padding" end */ + + part { + name: "bar_right_padding"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + visible: 1; + min: 28 0; + fixed: 1 1; + color : 0 255 0 255; + rel1 { + relative: 0.0 0.5; + to_x: "divider"; + } + rel2 { + relative: 0.0 0.5; + to_x: "divider"; + } + align: 1.0 0.5; + } + } /* "bar_right_padding" end */ + + part { name: "divider"; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + min: 2 64; + max: 2 64; + align: 1.0 0.5; + rel1 { + relative: 0.0 0.5; + to_x: "bar_right_right_padding"; + } + rel2 { + relative: 0.0 0.5; + to_x: "bar_right_right_padding"; + } + image { + normal: "00_winset_divider_line.png"; + border: 0 0 18 0; + border_scale: 1; + } + } + } /* "divider" end */ + + part { + name: "bar_right_right_padding"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + visible: 0; + min: 28 0; + fixed: 1 1; + rel1 { + relative: 0.0 0.5; + to_x: "elm.swallow.end"; + } + rel2 { + relative: 0.0 0.5; + to_x: "elm.swallow.end"; + } + align: 1.0 0.5; + } + } /* "bar_right_right_padding" end */ + + part { name: "elm.swallow.icon"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + visible: 0; + align: 0.0 0.5; + rel1 { + to_y: "elm.swallow.bar"; + } + rel2 { + relative: 0.0 1.0; + to_y: "elm.swallow.bar"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + } + } /* "elm.swallow.icon" end */ + + part { name: "elm.text"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 0; + fixed: 1 1; + align: 0.0 0.5; + rel1.to_x: "elm.swallow.icon"; + rel1.relative: 1.0 0.0; + rel2.to_x: "elm.swallow.icon"; + color: SLIDER_UNITS_TEXT_COLOR_INC; + text { + font: "SLP:style=Medium"; + size: SLIDER_UNITS_TEXT_SIZE_INC; + min: 0 0; + align: 0.0 0.5; + text_class: "slp_medium"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + text.min: 1 1; + } + } /* "elm.text" end */ + + part { name: "elm.swallow.end"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + visible: 0; + align: 1.0 0.5; + rel1 { + relative: 1.0 0.0; + to_y: "elm.swallow.bar"; + } + rel2 { + relative: 1.0 1.0; + to_y: "elm.swallow.bar"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + } + } /* "elm.swallow.end" end */ + + part { name: "elm.dragable.slider"; + type: GROUP; + source: "elm/slider/horizontal/indicator/default"; + mouse_events: 1; + scale: 1; + dragable { + x: 1 1 0; + y: 0 0 0; + confine: "bg"; + } + description { state: "default" 0.0; + min: SLIDER_INDICATOR_WIDTH_INC SLIDER_INDICATOR_HEIGHT_INC; + fixed: 1 1; + align: 0.5 0.5; + color: 0 0 0 0; + } + } /* "elm.dragable.slider" end */ + + part { name: "disabler"; + type: RECT; + mouse_events: 1; + repeat_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 0; + color: 0 0 0 0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } /* "disabler" end */ + + part { name: "clipper"; + type: RECT; + description { state: "default" 0.0; + color: 255 255 255 255; + } + description { state: "disabled" 0.0; + color: 255 255 255 102; + } + } + } /* "clipper" end */ + + programs { + program { name: "text_show"; + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text"; + } + program { name: "text_hide"; + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "icon_show"; + signal: "elm,state,icon,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.icon"; + } + program { name: "icon_hide"; + signal: "elm,state,icon,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.icon"; + } + program { name: "end_show"; + signal: "elm,state,end,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.end"; + } + program { name: "end_hide"; + signal: "elm,state,end,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.end"; + } + program { name: "invert_on"; + signal: "elm,state,inverted,on"; + source: "elm"; + script { + set_invert_on(); + } + } + program { name: "invert_off"; + signal: "elm,state,inverted,off"; + source: "elm"; + script { + set_invert_off(); + } + } + program { name: "val_show"; + signal: "mouse,down,*"; + source: "elm.dragable.slider"; + script { + thumb_down(); + } + } + program { name: "val_hide"; + signal: "mouse,up,*"; + source: "elm.dragable.slider"; + script { + thumb_up(); + } + } + program { name: "slider_disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "disabler"; + target: "clipper"; + } + program { name: "slider_enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disabler"; + target: "clipper"; + } + } + } + /* END group "elm/slider/horizontal/volumeHorizontalSlider" */ + + group { name : "block_events"; + parts{ + part { name : "blockevent"; + type : RECT; + description { + color : 0 0 0 0; + } + } + } + programs{ + program{ + name : "clicked"; + source : "blockevent"; + signal : "mouse,clicked,1"; + action : SIGNAL_EMIT "clicked" "*"; + } + } + } + /* END group "block_events" */ + + group { name : "volumeLayout"; + images { + image: "00_popup_bg.png" COMP; + } + parts{ + part { name : "base"; + type : IMAGE; + scale : 1; + description { state: "default" 0.0; + image { + normal: "00_popup_bg.png"; + border: 15 15 15 15; + border_scale: 1; + } + min: 700 146; + max: 700 1120; + align: 0.5 0.5; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale : 1; + description { state: "default" 0.0; + min: 700 0; + fixed: 1 0; + rel1 { + relative: 0.5 0.0; + to: "base"; + } + rel2 { + relative: 0.5 1.0; + to: "base"; + } + } + } + } + } + /* END group "volumeLayout" */ + + group { name : "volumeLayoutContent"; + parts{ + part { name : "pad_t"; + type : RECT; + scale : 1; + mouse_events : 0; + description { state: "default" 0.0; + align: 0.5 0.0; + min: 0 31; + fixed: 0 1; + visible: 0; + rel1 { + relative: 1.0 0.0; + to_x: "pad_l"; + } + rel2 { + relative: 0.0 0.0; + to_x: "pad_r"; + } + } + } /* "pad_t" end */ + + part { name : "pad_l"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + min : 32 0; + fixed: 1 0; + rel2.relative: 0.0 1.0; + visible: 0; + align: 0.0 0.0; + } + } /* "pad_l" end */ + + part { name: "pad_r"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + min : 32 0; + fixed: 1 0; + rel1.relative: 1.0 0.0; + visible: 0; + align: 1.0 0.0; + } + } /* "pad_r" end */ + + part{ name:"elm.swallow.content"; + type: SWALLOW; + scale : 1; + description { state: "default" 0.0; + min: 616 0; + fixed: 1 0; + rel1 { + relative: 0.5 1.0; + to: "pad_t"; + } + rel2 { + relative: 0.5 0.0; + to: "pad_b"; + } + } + } /* "elm.swallow.content" end */ + + part { name: "pad_b"; + type: RECT; + scale : 1; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.5 1.0; + min: 0 31; + fixed: 0 1; + visible: 0; + rel1 { + relative: 0.0 1.0; + to_x: "pad_l"; + } + rel2.to_x: "pad_r"; + } + } + } + } + /* END group "volumeLayoutContent" */ + +} diff --git a/data/volume_popup.edc b/data/volume_popup.edc index b3649e0..b2009a4 100755 --- a/data/volume_popup.edc +++ b/data/volume_popup.edc @@ -1,123 +1,123 @@ /* * Copyright 2012 Samsung Electronics Co., Ltd - * + * * Licensed under the Flora License, Version 1.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.tizenopensource.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. */ -collections { - group { name: "popup_slider_text_style_with_warn_label"; - parts{ - part { name: "pad_t"; - scale : 1; - mouse_events: 0; - repeat_events: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - min: 0 0; - fixed: 0 1; - rel1 { - relative: 1.0 0.0; - to_x: "pad_l"; - } - rel2 { - relative: 0.0 0.0; - to_x: "pad_r"; - } - } - } - part { name: "pad_l"; - scale: 1; - description { state: "default" 0.0; - min : 38 0; - fixed: 1 0; - rel1 { - relative: 0.0 0.0; - } - rel2 { - relative: 0.0 1.0; - } - align: 0.0 0.0; - } - } - part { name: "pad_r"; - scale: 1; - description { state: "default" 0.0; - min : 38 0; - fixed: 1 0; - rel1 { - relative: 1.0 0.0; - } - rel2 { - relative: 1.0 1.0; - } - align: 1.0 0.0; - } - } - part{ name:"elm.swallow.slider1"; - type: SWALLOW; - scale : 1; - description { state: "default" 0.0; - min: 0 0; - align: 0.0 0.5; - fixed: 1 0; - rel1 { - relative: 0.0 1.0; - to: "pad_t"; - } - rel2 { - relative: 1.0 0.0; - to: "pad_b"; - } - } - } - part { name: "pad_b"; - scale : 1; - mouse_events: 0; - repeat_events: 1; - description { state: "default" 0.0; - align: 0.0 1.0; - min: 0 101; - fixed: 0 1; - rel1 { - relative: 1.0 1.0; - to_x: "pad_l"; - } - rel2 { - relative: 0.0 1.0; - to_x: "pad_r"; - } - } - } - - part { name : "elm.swallow.warn_label"; - type: SWALLOW; - scale : 1; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - align : 0.0 0.5; - fixed : 0 1; - rel1{ - relative: 0.0 0.5; - to: "pad_b"; - } - rel2{ - relative: 1.0 0.5; - to : "pad_b"; - } - } - - } - } - } -} - +collections { + group { name: "popup_slider_text_style_with_warn_label"; + parts{ + part { name: "pad_t"; + scale : 1; + mouse_events: 0; + repeat_events: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + min: 0 0; + fixed: 0 1; + rel1 { + relative: 1.0 0.0; + to_x: "pad_l"; + } + rel2 { + relative: 0.0 0.0; + to_x: "pad_r"; + } + } + } + part { name: "pad_l"; + scale: 1; + description { state: "default" 0.0; + min : 38 0; + fixed: 1 0; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 0.0 1.0; + } + align: 0.0 0.0; + } + } + part { name: "pad_r"; + scale: 1; + description { state: "default" 0.0; + min : 38 0; + fixed: 1 0; + rel1 { + relative: 1.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + align: 1.0 0.0; + } + } + part{ name:"elm.swallow.slider1"; + type: SWALLOW; + scale : 1; + description { state: "default" 0.0; + min: 0 0; + align: 0.0 0.5; + fixed: 1 0; + rel1 { + relative: 0.0 1.0; + to: "pad_t"; + } + rel2 { + relative: 1.0 0.0; + to: "pad_b"; + } + } + } + part { name: "pad_b"; + scale : 1; + mouse_events: 0; + repeat_events: 1; + description { state: "default" 0.0; + align: 0.0 1.0; + min: 0 101; + fixed: 0 1; + rel1 { + relative: 1.0 1.0; + to_x: "pad_l"; + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r"; + } + } + } + + part { name : "elm.swallow.warn_label"; + type: SWALLOW; + scale : 1; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + align : 0.0 0.5; + fixed : 0 1; + rel1{ + relative: 0.0 0.5; + to: "pad_b"; + } + rel2{ + relative: 1.0 0.5; + to : "pad_b"; + } + } + + } + } + } +} + diff --git a/src/_button.c b/src/_button.c index 6275934..05513dd 100755 --- a/src/_button.c +++ b/src/_button.c @@ -25,12 +25,15 @@ static void button_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv) { - Evas_Object *base; - Evas_Object *win; + Evas_Object *base = NULL; + Evas_Object *win = NULL; base = ug_get_layout(ug); win = ug_get_window(); + retm_if(ug == NULL, "ug_get_layout API is failed\n"); + retm_if(ug == NULL, "ug_get_window API is failed\n"); + switch (mode) { case UG_MODE_FULLVIEW: evas_object_size_hint_weight_set(base, @@ -47,7 +50,6 @@ static void button_ug_destroy_cb(ui_gadget_h ug, void *priv) { _D("%s\n", __func__); struct appdata *ad = (struct appdata *)priv; - retm_if(ug == NULL, "Invalid argument: ug is NULL\n"); ug_destroy(ug); @@ -94,3 +96,4 @@ int _open_ug(void *data) return 0; } + diff --git a/src/_logic.c b/src/_logic.c index 030b135..bf33499 100755 --- a/src/_logic.c +++ b/src/_logic.c @@ -1,12 +1,12 @@ /* * Copyright 2012 Samsung Electronics Co., Ltd - * + * * Licensed under the Flora License, Version 1.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.tizenopensource.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. @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "volume.h" #include "_util_log.h" @@ -30,6 +32,7 @@ #include "_button.h" #define STRBUF_SIZE 128 +#define PATHBUF_SIZE 256 enum { IDLELOCK_OFF = 0x0, @@ -39,24 +42,6 @@ enum { void _ungrab_key(struct appdata *ad); -static void _sound_cb(keynode_t *node, void *data) -{ -} - -static void _vibration_cb(keynode_t *node, void *data) -{ -} - -int _init_vconf(struct appdata *ad) -{ - int ret; - ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, _sound_cb, ad); - retvm_if(ret < 0, -1, "Failed to notify sound status\n"); - ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, _vibration_cb, ad); - retvm_if(ret < 0, -1, "Failed to notifi vibration status\n"); - return 0; -} - int _close_volume(void *data) { struct appdata *ad = (struct appdata *)data; @@ -74,8 +59,6 @@ int _close_volume(void *data) DEL_TIMER(ad->ldtimer) DEL_TIMER(ad->ptimer) - if (ad->pu) - evas_object_hide(ad->pu); if (ad->win) evas_object_hide(ad->win); appcore_flush_memory(); @@ -94,7 +77,7 @@ Eina_Bool popup_timer_cb(void *data) Eina_Bool _lu_timer_cb(void *data) { - int val; + int val = -1; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, 0, "Invalid argument: appdata is NULL\n"); if (ad->win == NULL || evas_object_visible_get(ad->win) == EINA_FALSE){ @@ -119,7 +102,7 @@ Eina_Bool _su_timer_cb(void *data) Eina_Bool _ld_timer_cb(void *data) { - int val; + int val = 0; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, 0, "Invalid argument: appdata is NULL\n"); if (ad->win == NULL || evas_object_visible_get(ad->win) == EINA_FALSE){ @@ -220,11 +203,12 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event) _D("up key released and del timer\n"); DEL_TIMER(ad->sutimer) DEL_TIMER(ad->lutimer) - + DEL_TIMER(ad->luwarmtimer) } else if (!strcmp(ev->keyname, KEY_VOLUMEDOWN)) { _D("down key released and del timer\n"); DEL_TIMER(ad->sdtimer) DEL_TIMER(ad->ldtimer) + DEL_TIMER(ad->ldwarmtimer) } ad->flag_pressing = EINA_FALSE; @@ -240,9 +224,9 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event) int _grab_key(struct appdata *ad) { - Ecore_X_Window xwin; - Ecore_X_Display *disp; - int ret; + Ecore_X_Window xwin = 0; + Ecore_X_Display *disp = NULL; + int ret = -1; retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); @@ -267,8 +251,8 @@ int _grab_key(struct appdata *ad) void _ungrab_key(struct appdata *ad) { - Ecore_X_Window xwin; - Ecore_X_Display *disp; + Ecore_X_Window xwin = 0; + Ecore_X_Display *disp = NULL; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); retm_if(ad->win == NULL, "Invalid argument: ad->win is NULL\n"); @@ -287,9 +271,9 @@ void _ungrab_key(struct appdata *ad) int _get_vconf_idlelock(void) { - int ret, lock; + int ret = -1; + int lock = IDLELOCK_OFF; - lock = IDLELOCK_OFF; ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock); retvm_if(ret < 0, -1, "Failed to get vconf %s\n", VCONFKEY_IDLE_LOCK_STATE); @@ -300,7 +284,7 @@ int _get_vconf_idlelock(void) volume_type_t _get_volume_type(void) { - int ret; + int ret = MM_ERROR_NONE; volume_type_t type = -1; ret = mm_sound_volume_get_current_playing_type(&type); @@ -315,8 +299,6 @@ volume_type_t _get_volume_type(void) fprintf(stderr, "Failed to get sound type(errno:%x)\n", ret); return -1; } - if(type == VOLUME_TYPE_SYSTEM) - type = VOLUME_TYPE_RINGTONE; return type; } @@ -341,12 +323,154 @@ int _check_status(int *lock, int *type) int _app_create(struct appdata *ad) { - _init_vconf(ad); _init_svi(ad); return 0; } +int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom, + Atom type, unsigned int *val, + unsigned int len) +{ + unsigned char *prop_ret = NULL; + Atom type_ret = -1; + unsigned long bytes_after = 0; + unsigned long num_ret = -1; + int format_ret = -1; + unsigned int i = 0; + int num = 0; + + prop_ret = NULL; + if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False, + type, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) + return -1; + + if (type_ret != type || format_ret != 32) + num = -1; + else if (num_ret == 0 || !prop_ret) + num = 0; + else { + if (num_ret < len) + len = num_ret; + for (i = 0; i < len; i++) { + val[i] = ((unsigned long *)prop_ret)[i]; + } + num = len; + } + + if (prop_ret) + XFree(prop_ret); + + return num; +} + +int _x_rotation_get(Display *dpy, void *data) +{ + Window active_win = 0; + Window root_win = 0; + int rotation = -1; + int ret = -1; + + Atom atom_active_win; + Atom atom_win_rotate_angle; + + root_win = XDefaultRootWindow(dpy); + + atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); + ret = __utilx_ss_get_window_property(dpy, root_win, atom_active_win, + XA_WINDOW, + (unsigned int *)&active_win, 1); + + if(ret < 0) + return ret; + + atom_win_rotate_angle = XInternAtom(dpy, "_E_ILLUME_ROTATE_ROOT_ANGLE", False); + ret = __utilx_ss_get_window_property(dpy, root_win, + atom_win_rotate_angle, XA_CARDINAL, + (unsigned int *)&rotation, 1); + + if(ret != -1) + return rotation; + + return -1; +} + +int _volume_popup_resize(void *data, int angle) +{ + int rotation = 0; + int offx=0, offy=0; + Evas_Coord minw = -1, minh = -1; + Evas_Coord w = 0, h = 0; + struct appdata *ad = (struct appdata *)data; + retvm_if(ad->win == NULL, -1, "Invalid argument: window is NULL\n"); + retvm_if(ad->block_events == NULL, -1, "Invalid argument: notify is NULL\n"); + + if(angle == -1) + rotation = ad->angle; + else + rotation = angle; + + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + + switch(rotation){ + case 90 : + case 270 : + evas_object_resize(ad->block_events, h, w); + edje_object_size_min_get(ad->block_events, &minw, &minh); + edje_object_size_min_restricted_calc(ad->block_events, &minw, &minh, minw, minh); + offx = (h - minw) / 2; + offy = (w - minh) / 5; + break; + case 0 : + case 180 : + default : + evas_object_resize(ad->block_events, w, h); + edje_object_size_min_get(ad->block_events, &minw, &minh); + edje_object_size_min_restricted_calc(ad->block_events, &minw, &minh, minw, minh); + offx = (w - minw) / 2; + offy = (h - minh) / 5; + break; + } + _D("w(%d) h(%d) offx(%d) offy(%d)\n", w, h, offx, offy); + evas_object_move(ad->ly, offx, offy); + return 1; +} + +int _efl_rotate(Display *dpy, void *data) +{ + int rotation = -1; + struct appdata *ad = (struct appdata *)data; + + rotation = _x_rotation_get(dpy, ad); + + if(rotation == -1) + rotation = 0; + + if(rotation >= 0){ + elm_win_rotation_set(ad->win, rotation); + ad->angle = rotation; + return _volume_popup_resize(data, rotation); + } + + return 0; +} + +int _rotate_func(void *data) +{ + struct appdata *ad = (struct appdata *)data; + Display *d = NULL; + int ret = 0; + + retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); + + d = XOpenDisplay(NULL); + ret = _efl_rotate(d, ad); + XCloseDisplay(d); + + return ret; +} + int myterm(bundle *b, void *data) { return 0; @@ -364,20 +488,21 @@ syspopup_handler handler = { void _set_level(int type) { - int val; + int val = 0; _get_sound_level(type, &val); _set_sound_level(type, val); _D("type(%d) val(%d)\n", type, val); } -static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _block_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source) { + _D("%s\n", __func__); _close_volume(data); } Eina_Bool _slider_timer_cb(void *data) { - double val; + double val = 0; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, 0, "Invalid argument: appdata is NULL\n"); if (ad->sl) { @@ -394,7 +519,7 @@ Eina_Bool _slider_timer_cb(void *data) static void _slider_start_cb(void *data, Evas_Object *obj, void *event_info) { _D("%s\n", __func__); - int snd=0; + int snd= 0 ; struct appdata *ad = (struct appdata *)data; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); @@ -421,7 +546,7 @@ static void _slider_start_cb(void *data, Evas_Object *obj, void *event_info) static void _slider_changed_cb(void *data, Evas_Object *obj, void *event_info) { - double val; + double val = 0; struct appdata *ad = (struct appdata *)data; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); @@ -442,7 +567,7 @@ static void _slider_changed_cb(void *data, Evas_Object *obj, void *event_info) static void _slider_stop_cb(void *data, Evas_Object *obj, void *event_info) { _D("func\n"); - double val; + double val = 0; struct appdata *ad = (struct appdata *)data; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); @@ -476,56 +601,74 @@ Eina_Bool _ld_warmup_timer_cb(void *data) { struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument: appdata is NULL\n"); - _D("add long down timer\n"); ADD_TIMER(ad->ldtimer, 0.0, _ld_timer_cb, ad) return ECORE_CALLBACK_CANCEL; } -int _handle_bundle(bundle *b, struct appdata *ad) +void _init_press_timers(void *data) { - const char *bval; + struct appdata *ad = (struct appdata *)data; + retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument: appdata is NULL\n"); + DEL_TIMER(ad->sdtimer) + DEL_TIMER(ad->ldtimer) + DEL_TIMER(ad->ldwarmtimer) + DEL_TIMER(ad->sutimer) + DEL_TIMER(ad->lutimer) + DEL_TIMER(ad->luwarmtimer) +} +int _handle_bundle(bundle *b, struct appdata *ad) +{ + const char *bval = NULL; retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); bval = bundle_get_val(b, "LONG_PRESS"); if (bval) { _D("val(%s)\n", bval); Ecore_X_Display* disp = ecore_x_display_get(); - Utilx_Key_Status upstat, downstat; if (!strncmp(bval, "VOLUME_UP", strlen("LONG_PRESS"))) { - upstat = utilx_get_key_status(disp, KEY_VOLUMEUP); - if (upstat == UTILX_KEY_STATUS_PRESSED ) { - _D("volume up long press\n"); - DEL_TIMER(ad->ptimer) - ecore_timer_add(0.5, _lu_warmup_timer_cb, ad); - } + _D("volume up long press\n"); + DEL_TIMER(ad->ptimer) + ADD_TIMER(ad->luwarmtimer, 0.5, _lu_warmup_timer_cb, ad); } else if (!strncmp(bval, "VOLUME_DOWN", strlen("LONG_PRESS"))) { - downstat = utilx_get_key_status(disp, KEY_VOLUMEDOWN); - if (downstat == UTILX_KEY_STATUS_PRESSED ) { - _D("volume down long press\n"); - DEL_TIMER(ad->ptimer) - ecore_timer_add(0.5, _ld_warmup_timer_cb, ad); - } + _D("volume down long press\n"); + DEL_TIMER(ad->ptimer) + ADD_TIMER(ad->ldwarmtimer, 0.5, _ld_warmup_timer_cb, ad); } else { ADD_TIMER(ad->ptimer, 3.0, popup_timer_cb, ad) } } else { ADD_TIMER(ad->ptimer, 3.0, popup_timer_cb, ad) + _init_press_timers(ad); } return 0; } -static void _button_cb(void *data, Evas_Object *obj, void *event_info) +static void _button_mouse_down_cb(void *data, Evas_Object *obj, void *event_info) { _D("%s\n", __func__); struct appdata *ad = (struct appdata *)data; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); - - DEL_TIMER(ad->ptimer) - _open_ug(ad); + char buf[PATHBUF_SIZE] = {0, }; + snprintf(buf, sizeof(buf), "%s%s", IMAGEDIR, IMG_VOLUME_ICON_SETTINGS_PRESSED); + elm_icon_file_set(ad->ic_settings, buf, NULL); } +static void _button_cb(void *data, Evas_Object *obj, void *event_info) +{ + _D("%s\n", __func__); + struct appdata *ad = (struct appdata *)data; + retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); + char buf[PATHBUF_SIZE] = {0, }; + snprintf(buf, sizeof(buf), "%s%s", IMAGEDIR, IMG_VOLUME_ICON_SETTINGS); + elm_icon_file_set(ad->ic_settings, buf, NULL); + if(evas_object_visible_get(ad->win)){ + DEL_TIMER(ad->ptimer) + _open_ug(ad); + } +} +/* Eina_Bool _unset_layout(void *data) { struct appdata *ad = (struct appdata *)data; @@ -539,7 +682,7 @@ Eina_Bool _unset_layout(void *data) } return ECORE_CALLBACK_CANCEL; } - +*/ int _lang_changed(void *data){ _D("%s\n", __func__); struct appdata *ad = (struct appdata *)data; @@ -548,8 +691,7 @@ int _lang_changed(void *data){ retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); retvm_if(ad->win == NULL, -1, "Invalid argument: window is NULL\n"); - elm_object_text_set(ad->bt, S_("IDS_COM_BODY_SETTINGS")); - snprintf(buf, sizeof(buf), "%s", + snprintf(buf, sizeof(buf), "%s", T_("IDS_COM_BODY_HIGH_VOLUMES_MAY_HARM_YOUR_HEARING_IF_YOU_LISTEN_FOR_A_LONG_TIME")); elm_object_text_set(ad->warn_lb, buf); return 0; @@ -557,11 +699,17 @@ int _lang_changed(void *data){ int _app_reset(bundle *b, void *data) { - int ret, status; - int lock, type, val; - Evas_Object *win, *pu, *ic, *sl, *bt; - Evas_Object *label, *warn_ly; - char buf[STRBUF_SIZE] = {0, }; + int ret = -1, status = -1, val = 0; + int type = MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY; + int lock = IDLELOCK_ON; + int w, h; + Evas_Object *win, *sl, *ic, *ic_settings; + /* volume-app layout */ + Elm_Theme *th; + Evas_Object *outer, *inner, *block; + /* warn message layout */ + //Evas_Object *label, *warn_ly; + char buf[PATHBUF_SIZE] = {0, }; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); @@ -569,19 +717,19 @@ int _app_reset(bundle *b, void *data) _init_mm_sound(ad); status = _check_status(&lock, &type); - mm_sound_volume_get_value(type, (unsigned int*)(&val)); ad->type = type; + mm_sound_volume_get_value(type, (unsigned int*)(&val)); if (status == 0) { if(ad->win){ _grab_key(ad); _handle_bundle(b, ad); - _unset_layout(data); - evas_object_show(ad->pu); + _rotate_func(data); evas_object_show(ad->win); _mm_func(data); - if(syspopup_has_popup(b)) + if (syspopup_has_popup(b)) syspopup_reset(b); + ad->flag_launching = EINA_FALSE; return 0; } ad->step = _get_step(type); @@ -594,55 +742,84 @@ int _app_reset(bundle *b, void *data) _grab_key(ad); - pu = _add_popup(win, "volumebarstyle"); - retvm_if(pu == NULL, -1, "Failed to add popup\n"); - evas_object_smart_callback_add(pu, "block,clicked", _block_clicked_cb, ad); - _get_title(type, buf, sizeof(buf)); - elm_object_part_text_set(pu, "title,text", buf); - ad->pu = pu; - - /* Make a Slider bar */ - sl = _add_slider(ad->pu, 0, ad->step, val); + th = elm_theme_new(); + elm_theme_ref_set(th, NULL); + elm_theme_extension_add(th, EDJ_APP); + + block = _add_layout(win, EDJ_APP, GRP_VOLUME_BLOCKEVENTS); + ecore_x_window_size_get( + ecore_x_window_root_first_get(), + &w, &h); + evas_object_resize(block, w, h); + evas_object_show(block); + edje_object_signal_callback_add(elm_layout_edje_get(block), "clicked", "*", _block_clicked_cb, ad); + outer = _add_layout(win, EDJ_APP, GRP_VOLUME_LAYOUT); + inner = _add_layout(win, EDJ_APP, GRP_VOLUME_CONTENT); + ad->block_events = block; + ad->ly = outer; + + elm_object_part_content_set(outer, "elm.swallow.content", inner); + + sl = _add_slider(win, 0, ad->step, val); + elm_object_theme_set(sl, th); + elm_object_style_set(sl, GRP_VOLUME_SLIDER_HORIZONTAL); evas_object_smart_callback_add(sl, "slider,drag,start", _slider_start_cb, ad); evas_object_smart_callback_add(sl, "changed", _slider_changed_cb, ad); evas_object_smart_callback_add(sl, "slider,drag,stop", _slider_stop_cb, ad); + + ic_settings = elm_icon_add(win); + evas_object_size_hint_aspect_set(ic_settings, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_icon_resizable_set(ic_settings, EINA_FALSE, EINA_FALSE); + snprintf(buf, sizeof(buf), "%s%s", IMAGEDIR, IMG_VOLUME_ICON_SETTINGS); + elm_icon_file_set(ic_settings, buf, NULL); + elm_object_part_content_set(sl, "end", ic_settings); + evas_object_event_callback_add(ic_settings, EVAS_CALLBACK_MOUSE_DOWN, _button_mouse_down_cb, ad); + evas_object_smart_callback_add(ic_settings, "clicked", _button_cb, ad); + evas_object_show(ic_settings); + ad->ic_settings = ic_settings; + ad->sl = sl; + elm_object_part_content_set(inner, "elm.swallow.content", sl); - ic = elm_icon_add(ad->pu); + ic = elm_icon_add(win); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); elm_object_part_content_set(ad->sl, "icon", ic); ad->ic = ic; _set_icon(ad, val); - elm_object_content_set(ad->pu, ad->sl); - /* Make a Layout for volume slider with warning text. */ - snprintf(buf, sizeof(buf), "%s", + /* + snprintf(buf, sizeof(buf), "%s", T_("IDS_COM_BODY_HIGH_VOLUMES_MAY_HARM_YOUR_HEARING_IF_YOU_LISTEN_FOR_A_LONG_TIME")); - label = _add_label(ad->pu, "popup/default", buf); + label = _add_label(inner, "popup/default", buf); + //elm_object_part_content_set(inner, "elm.swallow.warn_label", label); + elm_object_part_content_set(outer, "elm.swallow.warn_label", label); + evas_object_show(label); ad->warn_lb = label; - evas_object_hide(ad->warn_lb); + _D("%s\n", buf);*/ - warn_ly = _add_layout(ad->pu, EDJ_THEME, GRP_VOLUME_SLIDER_WITH_WARNING); + /*warn_ly = _add_layout(ad->pu, EDJ_THEME, GRP_VOLUME_SLIDER_WITH_WARNING); elm_object_part_content_set(warn_ly, "elm.swallow.warn_label", ad->warn_lb); ad->warn_ly = warn_ly; - evas_object_hide(ad->warn_ly); - - /* Make a setting button */ - bt = _add_button(ad->pu, "popup_button/default", S_("IDS_COM_BODY_SETTINGS")); - evas_object_smart_callback_add(bt, "clicked", _button_cb, ad); - elm_object_part_content_set(ad->pu, "button1", bt); - ad->bt = bt; + evas_object_hide(ad->warn_ly);*/ ret = syspopup_create(b, &handler, ad->win, ad); retvm_if(ret < 0, -1, "Failed to create syspopup\n"); _handle_bundle(b, ad); + _rotate_func(ad); evas_object_show(ad->win); - } + if(evas_object_visible_get(ad->win)) + _D("window is visible\n"); + else{ + _D("window is invisible, close volume\n"); + _close_volume(ad); + } + } + ad->flag_launching = EINA_FALSE; return 0; } diff --git a/src/_logic.h b/src/_logic.h index ca5732e..4413e57 100755 --- a/src/_logic.h +++ b/src/_logic.h @@ -24,10 +24,13 @@ int _close_volume(void *data); int _app_create(struct appdata *ad); int _app_pause(struct appdata *ad); +int _rotate_func(void *data); int _app_reset(bundle *b, void *data); Eina_Bool popup_timer_cb(void *data); Eina_Bool _unset_layout(void *data); int _lang_changed(void *data); +void _init_press_timers(void *data); #endif + /* __VOLUME_LOGIC_H__ */ diff --git a/src/_sound.c b/src/_sound.c index 323fa32..f450f1b 100755 --- a/src/_sound.c +++ b/src/_sound.c @@ -43,7 +43,7 @@ void _play_sound(int type, int handle) int _init_svi(void *data) { - int ret, handle; + int ret = -1, handle = -1; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, -1, "Invaild argument: appdata is NULL\n"); @@ -78,47 +78,57 @@ int _set_icon(void *data, int val) { int snd=0, vib=0; char buf[PATHBUF_SIZE] = {0, }; - char *img; + char *img = NULL; struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); + system_audio_route_device_t device = 0; + mm_sound_route_get_playing_device(&device); + vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &snd); vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib); - if (val == 0) { - if (vib) { - if (ad->type == VOLUME_TYPE_MEDIA) { - _D("media and mute\n"); - img = "00_volume_icon_Mute.png"; - } else { - _D("Not media and vib\n"); - img = "00_volume_icon_Vibrat.png"; - _play_vib(ad->sh); + switch(ad->type){ + case VOLUME_TYPE_RINGTONE: + img = IMG_VOLUME_ICON_CALL; + if(val == 0){ + if(vib) + img = IMG_VOLUME_ICON_VIB; + else + img = IMG_VOLUME_ICON_MUTE; } - } else { - _D("vib\n"); - img = "00_volume_icon_Mute.png"; - } - } else { - _D("default volume\n"); - img = "00_volume_icon.png"; - } - - if(!snd){ - if(ad->type != VOLUME_TYPE_MEDIA){ - _D("Not media and mute\n"); - img = "00_volume_icon_Mute.png"; - } + if(!snd){ + img = IMG_VOLUME_ICON_MUTE; + if(vib)img = IMG_VOLUME_ICON_VIB; + } + break; + case VOLUME_TYPE_MEDIA: + if(device == SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE) + img = IMG_VOLUME_ICON_HEADPHONE; + else + img = IMG_VOLUME_ICON_MEDIA; + break; + default: + img = IMG_VOLUME_ICON; + if(val == 0){ + if(vib) + img = IMG_VOLUME_ICON_VIB; + else + img = IMG_VOLUME_ICON_MUTE; + } + if(!snd){ + img = IMG_VOLUME_ICON_MUTE; + if(vib)img = IMG_VOLUME_ICON_VIB; + } + break; } - - - snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, img); + snprintf(buf, sizeof(buf), "%s%s", IMAGEDIR, img); if (ad->ic ) { elm_icon_file_set(ad->ic, buf, NULL); } return 1; } - +/* void _set_device_warning(void *data, int val, int device) { struct appdata *ad = (struct appdata *)data; @@ -147,7 +157,7 @@ void _set_device_warning(void *data, int val, int device) break; } } - +*/ int _get_title(volume_type_t type, char *label, int size) { char *text = NULL; @@ -190,29 +200,9 @@ int _get_title(volume_type_t type, char *label, int size) return 0; } -void _set_popup_title(void *data, int type, int device) -{ - char buf[STRBUF_SIZE] = {0, }; - char name[STRBUF_SIZE] = {0, }; - struct appdata *ad = (struct appdata *)data; - retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); - - _get_title(type, buf, sizeof(buf)); - - switch (device) { - case SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE: - snprintf(name, sizeof(name), "%s (%s)", buf, T_("IDS_COM_OPT_HEADPHONES_ABB")); - elm_object_part_text_set(ad->pu, "title,text", name); - break; - default: - elm_object_part_text_set(ad->pu, "title,text", buf); - break; - } -} - int _get_step(int type) { - int ret, step; + int ret = -1, step = 0; ret = mm_sound_volume_get_step(type, &step); retvm_if(ret < 0, -1, "Failed to get step\n"); step -= 1; @@ -222,7 +212,7 @@ int _get_step(int type) void _mm_func(void *data) { _D("%s\n", __func__); - int val; + int val = 0; system_audio_route_device_t device = 0; struct appdata *ad = (struct appdata *)data; retm_if(ad == NULL, "Invalid argument: appdata is NULL\n"); @@ -235,8 +225,6 @@ void _mm_func(void *data) mm_sound_route_get_playing_device(&device); _set_slider_value(ad, val); - _set_popup_title(ad, ad->type, device); - _set_device_warning(ad, val, device); _set_icon(ad, val); _D("type(%d) val(%d)\n", ad->type, val); } @@ -322,3 +310,4 @@ int _set_sound_level(volume_type_t type, int val) mm_sound_volume_set_value(type, val); return 0; } + diff --git a/src/_util_efl.c b/src/_util_efl.c index 5f49083..ea4e725 100755 --- a/src/_util_efl.c +++ b/src/_util_efl.c @@ -23,8 +23,8 @@ Evas_Object *_add_window(const char *name) { - Evas_Object *eo; - int w, h; + Evas_Object *eo = NULL; + int w = -1, h = -1; eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION); if (eo) { elm_win_title_set(eo, name); @@ -33,6 +33,10 @@ Evas_Object *_add_window(const char *name) ecore_x_window_size_get( ecore_x_window_root_first_get(), &w, &h); + if(w == -1 || h == -1){ + _E("ecore_x_window_seiz_get() is failed\n"); + return NULL; + } evas_object_resize(eo, w, h); } return eo; @@ -40,7 +44,7 @@ Evas_Object *_add_window(const char *name) Evas_Object *_add_slider(Evas_Object *parent, int min, int max, int val) { - Evas_Object *sl; + Evas_Object *sl = NULL; sl = elm_slider_add(parent); retvm_if(sl == NULL, NULL, "Failed to add slider\n"); elm_slider_horizontal_set(sl, EINA_TRUE); @@ -56,8 +60,8 @@ Evas_Object *_add_slider(Evas_Object *parent, int min, int max, int val) Evas_Object *_add_layout(Evas_Object *parent, const char *file, const char *group) { - Evas_Object *eo; - int r; + Evas_Object *eo = NULL; + int r = -1; retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); retvm_if(file == NULL, NULL, "Invalid argument: file is NULL\n"); @@ -81,7 +85,7 @@ Evas_Object *_add_layout(Evas_Object *parent, const char *file, Evas_Object *_add_button(Evas_Object *parent, const char *style, const char *text) { - Evas_Object *bt; + Evas_Object *bt = NULL; bt = elm_button_add(parent); retvm_if(bt == NULL, NULL, "Failed to add button\n"); if (style) elm_object_style_set(bt, style); @@ -93,7 +97,7 @@ Evas_Object *_add_button(Evas_Object *parent, const char *style, const char *tex Evas_Object *_add_popup(Evas_Object *parent, const char *style) { - Evas_Object *pu; + Evas_Object *pu = NULL; pu = elm_popup_add(parent); retvm_if(pu == NULL, NULL, "[Error] Failed to add popup\n"); evas_object_size_hint_weight_set(pu, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -103,7 +107,7 @@ Evas_Object *_add_popup(Evas_Object *parent, const char *style) } Evas_Object *_add_label(Evas_Object *parent, const char *style, const char *text) { - Evas_Object *lb; + Evas_Object *lb = NULL; lb = elm_label_add(parent); retvm_if(lb == NULL, NULL, "Failed to add label\n"); elm_object_style_set(lb, style); diff --git a/src/volume.c b/src/volume.c index 13e738b..324af38 100755 --- a/src/volume.c +++ b/src/volume.c @@ -32,6 +32,22 @@ static int lang_changed(void *data) return _lang_changed(data); } +static Eina_Bool rotate_cb(void *data, int type, void *event) +{ + struct appdata *ad = data; + Ecore_X_Event_Client_Message *ev = event; + + retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); + if (!event){ + return ECORE_CALLBACK_RENEW; + } + + if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE && ad->ug == NULL){ + _rotate_func(data); + } + return ECORE_CALLBACK_RENEW; +} + static int app_create(void *data) { struct appdata *ad = data; @@ -46,6 +62,10 @@ static int app_create(void *data) appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, lang_changed, ad); + /* add rotation event callback */ + ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, + rotate_cb, (void *)data); + /* appcore measure time example */ printf("from AUL to %s(): %d msec\n", __func__, appcore_measure_time_from("APP_START_TIME")); @@ -77,15 +97,18 @@ static int app_resume(void *data) static int app_reset(bundle *b, void *data) { + _D("%s\n", __func__); struct appdata *ad = data; + retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); - if (ad->flag_launching == EINA_TRUE) { + if(ad->flag_launching == EINA_TRUE || evas_object_visible_get(ad->win)) + { + _init_press_timers(ad); return 0; } ad->flag_launching = EINA_TRUE; _app_reset(b, data); - /* appcore measure time example */ printf("from AUL to %s(): %d msec\n", __func__, appcore_measure_time_from("APP_START_TIME")); @@ -95,8 +118,6 @@ static int app_reset(bundle *b, void *data) if (ad->win) elm_win_activate(ad->win); - ad->flag_launching = EINA_FALSE; - return 0; } @@ -111,9 +132,8 @@ int main(int argc, char *argv[]) .reset = app_reset, }; - /* appcore measure time example */ - printf("from AUL to %s(): %d msec\n", __func__, - appcore_measure_time_from("APP_START_TIME")); + /*elm_init(argc, argv); + elm_config_preferred_engine_set("opengl_x11");*/ memset(&ad, 0x0, sizeof(struct appdata)); ops.data = &ad; @@ -121,3 +141,4 @@ int main(int argc, char *argv[]) return appcore_efl_main(PACKAGE, &argc, &argv, &ops); } + diff --git a/src/volume.h b/src/volume.h index dbdb578..7707d79 100755 --- a/src/volume.h +++ b/src/volume.h @@ -30,7 +30,7 @@ #endif #if !defined(RESDIR) -# define RESDIR "/opt/apps/org.tizen.volume/res" +# define RESDIR "/opt/apps/com.samsung.volume/res" #endif #if !defined(LOCALEDIR) @@ -41,11 +41,24 @@ # define EDJDIR RESDIR"/edje" #endif -#define EDJ_FILE EDJDIR"/"PACKAGE".edj" -#define GRP_MAIN "main" #define EDJ_THEME EDJDIR"/volume_popup.edj" #define GRP_VOLUME_SLIDER "popup_slider_style" #define GRP_VOLUME_SLIDER_WITH_WARNING "popup_slider_text_style_with_warn_label" +#define EDJ_APP EDJDIR"/volume_app.edj" +#define GRP_VOLUME_BLOCKEVENTS "block_events" +#define GRP_VOLUME_LAYOUT "volumeLayout" +#define GRP_VOLUME_CONTENT "volumeLayoutContent" +#define GRP_VOLUME_SLIDER_HORIZONTAL "volumeHorizontalSlider" + +#define IMG_VOLUME_ICON "/00_volume_icon.png" +#define IMG_VOLUME_ICON_CALL "/00_volume_icon_Call.png" +#define IMG_VOLUME_ICON_MUTE "/00_volume_icon_Mute.png" +#define IMG_VOLUME_ICON_VIB "/00_volume_icon_Vibrat.png" +#define IMG_VOLUME_ICON_HEADPHONE "/00_volume_icon_headphone.png" +#define IMG_VOLUME_ICON_MEDIA "/00_volume_icon_media.png" +#define IMG_VOLUME_ICON_SETTINGS "/00_volume_icon_settings.png" +#define IMG_VOLUME_ICON_SETTINGS_PRESSED "/00_volume_icon_settings_pressed.png" +#define IMG_VOLUME_WINSET_DIVIDER_LINE "/00_winset_divider_line.png" #define S_(str) dgettext("sys_string", str) #define T_(str) dgettext(PACKAGE, str) @@ -61,15 +74,16 @@ struct appdata { - Evas_Object *win, *pu, *bt, *sl, *ic, *warn_lb, *warn_ly; + Evas_Object *win, *block_events, *ly, *sl, *ic, *ic_settings, *warn_lb; Ecore_Timer *ptimer; Ecore_Timer *stimer; /* slider timer */ Ecore_Timer *sutimer, *sdtimer, *lutimer, *ldtimer; /* long press */ Ecore_Timer *warntimer; /* warning message timer */ + Ecore_Timer *luwarmtimer, *ldwarmtimer; volume_type_t type; int step; - int before_mute[32]; + int angle; /* ug handler */ ui_gadget_h ug; @@ -78,7 +92,7 @@ struct appdata int sh; /* svi handle */ int flag_pressing; /* to set hard key press */ int flag_touching; - int flag_launching; /* to block double launching by double click */ + int flag_launching; int flag_deleting; int flag_warning; /* set device warning flag */ }; diff --git a/volume.manifest b/volume.manifest new file mode 100644 index 0000000..dcd49c0 --- /dev/null +++ b/volume.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + +