summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraman.jeph <aman.jeph@samsung.com>2020-07-04 02:58:43 +0530
committeraman.jeph <aman.jeph@samsung.com>2020-07-04 03:13:39 +0530
commitb011acaa5c51a8bcb4d8c88766133cb104188701 (patch)
treed85e8a4024cc4cb1be281b755d6fcff633aa27b1
parent5e449c1c5133729a45d37f3723eadbeec897e516 (diff)
downloadquickpanel-b011acaa5c51a8bcb4d8c88766133cb104188701.tar.gz
quickpanel-b011acaa5c51a8bcb4d8c88766133cb104188701.tar.bz2
quickpanel-b011acaa5c51a8bcb4d8c88766133cb104188701.zip
Implement mini-control layout according to new gui guideline
Change-Id: I99ca03ec0c20dd915736b984d8d16b45dfe15d5b Signed-off-by: aman.jeph <aman.jeph@samsung.com>
-rwxr-xr-xinc/quickpanel_def.h3
-rwxr-xr-xres/edje/quickpanel_minictrl.edc239
-rwxr-xr-xsrc/minictrl/minictrl.c62
3 files changed, 85 insertions, 219 deletions
diff --git a/inc/quickpanel_def.h b/inc/quickpanel_def.h
index 3671d61..32606b2 100755
--- a/inc/quickpanel_def.h
+++ b/inc/quickpanel_def.h
@@ -48,6 +48,9 @@
#define NOTI_VIEW_CONTENT_TEXT_FONT_SIZE 18
#define NOTI_VIEW_CONTENT_TEXT_HEIGHT 22
+#define NOTI_VIEW_MINI_CTRL_CONTENT_HEIGHT 112
+#define NOTI_VIEW_MINI_CTRL_LAYOUT_HEIGHT (NOTI_VIEW_MINI_CTRL_CONTENT_HEIGHT + NOTI_VIEW_SEPARATOR_LINE_HEIGHT) //
+
/** quickpanel notification list */
diff --git a/res/edje/quickpanel_minictrl.edc b/res/edje/quickpanel_minictrl.edc
index 93fd378..1d6ddc1 100755
--- a/res/edje/quickpanel_minictrl.edc
+++ b/res/edje/quickpanel_minictrl.edc
@@ -18,209 +18,54 @@
//#define DEBUG
//#define DEBUG_TEXT
- group {
- name: "quickpanel/minictrl/default";
- data.item: "bgcolor" QP_THEME_BANDED_COLOR;
- parts {
- part {
- name: "base";
- type: SPACER;
- repeat_events: 1;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 480 QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT;
- fixed: 0 1;
- rel1 {
- relative: 0.0 0.0;
- }
- rel2 {
- relative: 1.0 1.0;
- }
- align: 0.0 0.0;
- }
- }
- part {
- name: "elm.padding.top";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 20 + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT;
- fixed: 0 1;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 0.0 0.0;
- rel2.relative: 1.0 0.0;
- align: 0.0 0.0;
- }
+images {
+ image: "notification_separator_line.png" COMP;
+}
+group { name: "quickpanel/minictrl/container/default";
+ parts {
+ part { name: "base";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 NOTI_VIEW_MINI_CTRL_LAYOUT_HEIGHT;
+ max: -1 NOTI_VIEW_MINI_CTRL_LAYOUT_HEIGHT;
}
- part {
- name: "elm.padding.left.bg";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 1.0;
- align: 0.0 0.0;
- }
- }
- part {
- name: "elm.padding.right.bg";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 1.0 0.0;
- rel2.relative: 1.0 1.0;
- align: 1.0 0.0;
- }
- }
- part {
- name: "elm.padding.top.bg";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT;
- fixed: 0 1;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 0.0 0.0;
- rel2.relative: 1.0 0.0;
- align: 0.0 0.0;
- }
- }
- part {
- name: "elm.content.bg";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- to_x:"elm.padding.left.bg";
- to_y:"elm.padding.top.bg";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x:"elm.padding.right.bg";
- to_y:"elm.padding.bottom";
- relative: 0.0 1.0;
- }
- align: 0.0 0.0;
- visible: 1;
- color: 255 255 255 235;
- color_class: QP_THEME_ITEM_BG_COLOR;
- }
- description {
- state: "show" 0.0;
- inherit: "default" 0.0;
- }
- description {
- state: "hide" 0.0;
- inherit: "default" 0.0;
- color: 0 0 0 0;
- }
- }
- part {
- name: "bgcolor";
- type: "RECT";
- mouse_events: 0;
- description {
- state: "default" 0.0;
- rel1.to:"base";
- rel2.to:"base";
- color_class: QP_THEME_BANDED_COLOR;
- visible: 1;
- }
- }
- QUICKPANEL_FOCUS_OBJECT("focus", "elm.content.bg", "elm.content.bg")
- part {
- name: "elm.padding.left";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 18 0;
- fixed: 1 0;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 1.0;
- align: 0.0 0.0;
- }
- }
- part {
- name: "elm.padding.right";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 12 0;
- fixed: 1 0;
- rel1.to:"base";
- rel2.to:"base";
- rel1.relative: 1.0 0.0;
- rel2.relative: 1.0 1.0;
- align: 1.0 0.0;
- }
- }
- part {
- name: "elm.icon";
- type: SWALLOW;
- mouse_events: 1;
- scale: 1;
- description {
- state: "default" 0.0;
- align: 0.0 0.0;
- min: 480 QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT;
- rel1 {
- to: "elm.content.bg";
- }
- rel2 {
- to_x: "elm.content.bg";
- to_y: "elm.padding.bottom";
- relative: 1.0 0.0;
- }
+ }
+ part { name: "mini_ctrl.swallow";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 NOTI_VIEW_MINI_CTRL_CONTENT_HEIGHT;
+ max: -1 NOTI_VIEW_MINI_CTRL_CONTENT_HEIGHT;
+ rel1 {
+ to: "base";
+ relative: 0.0 0.0;
}
- }
- part {
- name: "elm.padding.bottom";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- align: 0.0 1.0;
+ rel2 {
+ to: "base";
+ relative: 1.0 0.0;
}
+ align: 0.0 0.0;
+ //color: 255 0 0 255;
}
}
- programs {
- program{
- name: "bg.show";
- signal: "bg.show";
- source: "prog";
- action: STATE_SET "show" 0.0;
- target: "elm.content.bg";
+ QUICKPANEL_FOCUS_OBJECT("focus", "mini_ctrl.swallow", "mini_ctrl.swallow")
+ part { name: "seprator.line";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 NOTI_VIEW_SEPARATOR_LINE_HEIGHT;
+ fixed: 0 1;
+ rel1 { to: "base"; relative: 0.0 1.0; offset: 40 0;}
+ rel2 { to_x: "base"; to_y: "mini_ctrl.swallow"; relative: 1.0 1.0; offset: -40 0; }
+ align: 0.0 1.0;
+ image.normal: "notification_separator_line.png";
+ visible: 1;
}
- program{
- name: "bg.hide";
- signal: "bg.hide";
- source: "prog";
- action: STATE_SET "hide" 0.0;
- target: "elm.content.bg";
+ description { state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
}
}
}
+}
diff --git a/src/minictrl/minictrl.c b/src/minictrl/minictrl.c
index 11c16c7..605cba0 100755
--- a/src/minictrl/minictrl.c
+++ b/src/minictrl/minictrl.c
@@ -54,6 +54,18 @@
#define BUNDLE_BUFFER_LENGTH 100
+#define MINCONTROL_CONTAINER_SWALLOW "mini_ctrl.swallow"
+
+//SLIDER AREA
+#define SLIDER_START_W 790
+#define SLIDER_END_W 1160
+#define SLIDER_START_H 400
+#define SLIDER_END_H 432
+
+//Max Size of Mini-Controller
+#define MINICONTROL_MAX_WIDTH 1200
+#define MINICONTROL_MAX_HEIGHT 112
+
typedef enum _gesture_state_type {
STATE_NORMAL = 0,
STATE_GESTURE_WAIT,
@@ -135,7 +147,7 @@ static Evas_Object *_get_minictrl_obj(Evas_Object *layout)
return NULL;
}
- return elm_object_part_content_get(layout, "elm.icon");
+ return elm_object_part_content_get(layout, MINCONTROL_CONTAINER_SWALLOW);
}
static void _viewer_set_size(Evas_Object *layout, void *data, int width, int height)
@@ -143,7 +155,7 @@ static void _viewer_set_size(Evas_Object *layout, void *data, int width, int hei
Evas_Object *viewer;
struct appdata *ad;
int max_width;
- int resized_width;
+ int max_height;
int is_landscape;
if (!layout || !data || width < 0 || height < 0) {
@@ -164,17 +176,15 @@ static void _viewer_set_size(Evas_Object *layout, void *data, int width, int hei
else
is_landscape = 1;
+ INFO("Size Provided by Viewer is %s[ %d X %d ]",
+ ((width > MINICONTROL_MAX_WIDTH || height > MINICONTROL_MAX_HEIGHT) ? "bigger than max size, so resizing to max size[1200X112]": ""),
+ width, height);
- if (width > ad->win_width)
- DBG("MC Size is not valid. it is larger than window size: %dx%d (%dx%d) %d", width, height, ad->win_width, ad->win_height, ad->angle);
-
- max_width = is_landscape ? ad->win_height : ad->win_width;
- resized_width = (width > max_width) ? max_width : width;
+ max_width = ((width > MINICONTROL_MAX_WIDTH) ? MINICONTROL_MAX_WIDTH : width);
+ max_height = ((height > MINICONTROL_MAX_HEIGHT) ? MINICONTROL_MAX_HEIGHT : height);
- DBG("minicontroller view is resized to w:%d/%d(%d) h:%d Landscape[%d]", resized_width, max_width, width, height, is_landscape);
-
- evas_object_size_hint_min_set(viewer, resized_width, height);
- evas_object_size_hint_max_set(viewer, resized_width, height);
+ evas_object_size_hint_min_set(viewer, max_width, max_height);
+ evas_object_size_hint_max_set(viewer, max_width, max_height);
}
static void _viewer_item_free(struct _viewer_item *item)
@@ -214,12 +224,28 @@ static void _mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_in
Evas_Event_Mouse_Down *ev;
struct _viewer_item *vit;
+ struct appdata *ad = data;
if (s_info.mouse_event_blocker == EINA_TRUE)
s_info.mouse_event_blocker = EINA_FALSE;
+ ev = (Evas_Event_Mouse_Down *)event_info;
+
+ /** this is done to stop the flick animation when dragging the slider in mini-controller
+ * as the slider is not created by quickpanel it is part of widget viewer..quickpanel doesn't have access to slider object.
+ * so we have to estimate the slider area, whenever the drag start from slider we freeze the scroller to stop animation.
+ * co-ordinate provided by the mouse event are relative to window/screen.
+ * if position of slider object is changed than we need to update slider area accordingly.
+ */
+
+ if(ev->canvas.x >= SLIDER_START_W && ev->canvas.x <= SLIDER_END_W && ev->canvas.y >= SLIDER_START_H && ev->canvas.y <= SLIDER_END_H)
+ {
+ s_info.mouse_event_blocker = EINA_TRUE;
+ elm_object_scroll_freeze_push(ad->scroller);
+ INFO("mouse click is in slider area..skipping scroll animation");
+ return;
+ }
vit = evas_object_data_get(obj, MINICONTROL_VIEW_DATA);
- ev = (Evas_Event_Mouse_Down *)event_info;
if (!ev || !vit) {
ERR("ev %p, vit %p", ev, vit);
@@ -258,7 +284,6 @@ static void _mouse_move_cb(void* data, Evas* e, Evas_Object* obj, void* event_in
if (s_info.mouse_event_blocker == EINA_TRUE)
return;
-
ad = data;
ev = event_info;
vit = evas_object_data_get(obj, MINICONTROL_VIEW_DATA);
@@ -371,7 +396,6 @@ static void _mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
if (s_info.mouse_event_blocker == EINA_FALSE)
s_info.mouse_event_blocker = EINA_TRUE;
-
ad = data;
vit = evas_object_data_get(obj, MINICONTROL_VIEW_DATA);
if (!vit || !ad) {
@@ -461,7 +485,7 @@ static Evas_Object *_minictrl_create_view(struct appdata *ad, const char *name)
return NULL;
}
- elm_layout_file_set(layout, util_get_res_file_path(DEFAULT_EDJ), "quickpanel/minictrl/default");
+ elm_layout_file_set(layout, util_get_res_file_path(DEFAULT_EDJ), "quickpanel/minictrl/container/default");
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(layout);
@@ -473,7 +497,7 @@ static Evas_Object *_minictrl_create_view(struct appdata *ad, const char *name)
return NULL;
}
elm_object_focus_allow_set(viewer, EINA_TRUE);
- elm_object_part_content_set(layout, "elm.icon", viewer);
+ elm_object_part_content_set(layout, MINCONTROL_CONTAINER_SWALLOW, viewer);
evas_object_event_callback_add(viewer, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, ad);
evas_object_event_callback_add(viewer, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, ad);
@@ -545,9 +569,6 @@ static void _minictrl_add(const char *name, unsigned int width, unsigned int hei
}
_viewer_set_size(viewer, ad, width, height);
- quickpanel_uic_initial_resize(viewer,
- (height > QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT)
- ? height : QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT);
vit = malloc(sizeof(*vit));
if (!vit) {
@@ -602,9 +623,6 @@ static void _minictrl_update(const char *name, unsigned int width, unsigned int
if (found->viewer) {
_viewer_set_size(found->viewer, ad, width, height);
- quickpanel_uic_initial_resize(found->viewer,
- (height > QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT)
- ? height : QP_THEME_LIST_ITEM_MINICONTRL_HEIGHT + QP_THEME_LIST_ITEM_SEPERATOR_HEIGHT);
}
}