[UI] Using a popup to display the clock view. 58/127458/2
authorMichal Skorupinski <m.skorupinsk@samsung.com>
Wed, 26 Apr 2017 10:45:43 +0000 (12:45 +0200)
committerMichal Skorupinski <m.skorupinsk@samsung.com>
Thu, 27 Apr 2017 15:04:00 +0000 (17:04 +0200)
Change-Id: Ib9247896542edcb856c7d8b6174f90a4b92061ef
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
res/settings-theme.edc
res/view/system/clock.edc
res/widget/popup.edc [new file with mode: 0644]
src/view/common/view_datetime.c
src/view/system/view_clock.c

index f5ffb73..65dc721 100644 (file)
@@ -49,4 +49,5 @@ collections {
        #include "widget/radio.edc"
        #include "widget/spinner.edc"
        #include "widget/datetime.edc"
+       #include "widget/popup.edc"
 }
index ed98408..6da7d2f 100755 (executable)
 #define CONTROLS_X1 0.36
 #define LABELS_X2 0.32
 
-#define DATE_ITEM_Y1 0.25
-#define DATE_ITEM_Y2 0.35
+#define DATE_ITEM_Y1 0.15
+#define DATE_ITEM_Y2 0.40
 #define DATE_ITEM_X2 0.80
 
-#define TIME_ITEM_Y1 0.50
-#define TIME_ITEM_Y2 0.60
+#define TIME_ITEM_Y1 0.45
+#define TIME_ITEM_Y2 0.70
 #define TIME_ITEM_X2 0.80
 
-#define _24HOUR_ITEM_Y1 0.70
-#define _24HOUR_ITEM_Y2 0.80
+#define _24HOUR_ITEM_Y1 0.75
+#define _24HOUR_ITEM_Y2 0.85
 #define _24HOUR_ITEM_X2 0.55
 
-
 group {
        name, GRP_VIEW_CLOCK;
 
@@ -43,10 +42,12 @@ group {
                part {
                        name, "bg";
                        type, RECT;
+                       mouse_events: 1;
                        scale, 1;
                        description {
                                state, "default" 0.0;
                                color, 244 244 244 255;
+                               min: 1920*0.60 1080*0.60;
                        }
                }
 
diff --git a/res/widget/popup.edc b/res/widget/popup.edc
new file mode 100644 (file)
index 0000000..0a1f301
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#define EASY_EASE(duration) CUBIC_BEZIER (duration) 0.33 0.1 0.67 1.0
+#define EASE_IN1(duration) CUBIC_BEZIER (duration) 0.16 0.02 0.0 0.33
+#define EASE_IN2(duration) CUBIC_BEZIER (duration) 0.33 0.33 0.67 0.16
+#define GLIDE_OUT(duration) CUBIC_BEZIER (duration) 0.15 0.0 0.3 1.0
+#define GLIDE_EASE_OUT(duration) CUBIC_BEZIER (duration) 0.25 0.46 0.45 1.0
+#define POPUP_DEFAULT_VI_INC 12
+
+group { "elm/popup/base/settings";
+       nomouse;
+       data.item: "hide_finished_signal" "on";
+       parts {
+       swallow { "elm.swallow.content";
+               mouse;
+               scale;
+               desc { "default";
+                       rel1.relative: 0.3 0.0;
+                       rel2.relative: 0.7 1.0;
+               }
+       }
+}
index a5f0af5..f554e0d 100644 (file)
@@ -216,14 +216,10 @@ static void  _datetime_btn_keydown_cb(int id, void *data, Evas *e, Evas_Object *
 
        switch (ev->keycode) {
                case KEY_ID_BACK:
+               case KEY_ID_ENTER:
                        elm_object_focus_set(obj, EINA_FALSE);
                        evas_object_focus_set(dt, EINA_TRUE);
                        dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] btn PRESSED [KEY_ID_BACK]", __FILE__, __LINE__);
-
-                       Evas_Object *parent = elm_object_focused_object_get(elm_object_parent_widget_get(dt));
-                       dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] %d %s", __FILE__, __LINE__,
-                                       elm_object_focus_get(dt),
-                                       evas_object_type_get(parent));
                        break;
                case KEY_ID_UP:
                        elm_spinner_value_set(spinner, value + 1);
@@ -268,6 +264,7 @@ static void _datetime_keydown_cb(int id, void *data, Evas *e, Evas_Object *obj,
        switch (ev->keycode) {
        case KEY_ID_ENTER:
                neighbour = elm_object_focus_next_object_get(obj, ELM_FOCUS_NEXT);
+               elm_object_focus_set(neighbour, EINA_TRUE);
                break;
        default:
                break;
@@ -275,7 +272,4 @@ static void _datetime_keydown_cb(int id, void *data, Evas *e, Evas_Object *obj,
 
        dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] Datetime %p keydown %s neighbour: %s(%p)", __FILE__, __LINE__,
                        obj, ev->key, evas_object_type_get(neighbour), neighbour);
-
-       evas_object_focus_set(neighbour, EINA_TRUE);
-       elm_object_focus_set(neighbour, EINA_TRUE);
 }
index 7d5dc79..7b2a8d0 100755 (executable)
@@ -31,7 +31,6 @@
 
 #define DEFAULT_KEYPAD_POS             636
 #define PADDING_VKEYBOARD              30
-#define LAYOUT_SIZE_MULTIPLIER 0.6
 
 enum setup_type {
        TYPE_MANUAL = 0,
@@ -41,6 +40,7 @@ enum setup_type {
 
 typedef struct {
        Evas_Object *win;
+       Evas_Object *popup;
        Evas_Object *base;
        Evas_Object *conformant;
        Evas_Object *done;
@@ -275,17 +275,6 @@ static bool _add_clock_setting(clock_view_priv_data *priv)
        return true;
 }
 
-static void _resize(Evas_Object *win, Evas_Object *base)
-{
-       int w = 0;
-       int h = 0;
-       float move_offset = (1.0 - LAYOUT_SIZE_MULTIPLIER) * 0.5;
-
-       evas_object_geometry_get(win, NULL, NULL, &w, &h);
-       evas_object_resize(base, LAYOUT_SIZE_MULTIPLIER * w, LAYOUT_SIZE_MULTIPLIER * h);
-       evas_object_move(base, move_offset * w, move_offset * h);
-}
-
 static Evas_Object *_create(Evas_Object *win, void *data)
 {
        SETTING_TRACE_BEGIN;
@@ -314,6 +303,21 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
+       priv->popup = elm_popup_add(win);
+       if (!priv->popup) {
+               dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] priv->popup == NULL", __FILE__, __LINE__);
+               return NULL;
+       }
+
+       elm_object_style_set(priv->popup, "settings");
+
+       Evas_Object *parent = evas_object_smart_parent_get(priv->popup);
+       const char *type1 = evas_object_type_get(parent);
+       parent = elm_object_parent_widget_get(priv->popup);
+       const char *type2 = evas_object_type_get(parent);
+
+       dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] SMP: %s P: %s", __FILE__, __LINE__, type1, type2);
+
        base = utils_add_layout(win, GRP_VIEW_CLOCK, EINA_FALSE);
        if (!base) {
                _ERR("Add layout failed.");
@@ -321,7 +325,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       _resize(win, base);
+       elm_object_content_set(priv->popup, base);
 
        priv->win = win;
        priv->base = base;
@@ -333,7 +337,6 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        evas_object_smart_callback_add(priv->conformant, "virtualkeypad,state,on", _keypad_up_cb, priv);
        evas_object_smart_callback_add(priv->conformant, "virtualkeypad,state,off", _keypad_down_cb, priv);
 
-
        if (!_add_clock_setting(priv)) {
                _ERR("failed to add clock setting layout");
                evas_object_del(base);
@@ -395,7 +398,7 @@ static void _show(void *data)
        elm_datetime_value_set(priv->date_part, (Elm_Datetime_Time *)&current_time);
        elm_datetime_value_set(priv->time_part, (Elm_Datetime_Time *)&current_time);
 
-       evas_object_show(priv->base);
+       evas_object_show(priv->popup);
        elm_object_focus_set(priv->time_part, EINA_TRUE);
        ecore_idler_add(_show_timer_cb, priv);
 
@@ -413,7 +416,7 @@ static void _hide(void *data)
                return;
        }
        priv = (clock_view_priv_data *)data;
-       evas_object_hide(priv->base);
+       evas_object_hide(priv->popup);
 }
 
 static void _destroy(void *data)