modify photo layout to resize only photo image 73/46273/1
authorSoohye Shin <soohye.shin@samsung.com>
Wed, 19 Aug 2015 02:35:04 +0000 (11:35 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Wed, 19 Aug 2015 02:35:04 +0000 (11:35 +0900)
Change-Id: I7b4555c0098f00f7cad33d03a2981b5b5f738a91
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
edje/view/useredit.edc
src/view/view_user_edit.c

index 7db08e3..ecf6169 100644 (file)
@@ -678,6 +678,11 @@ group {
                                min, 294 294;
                                color, 194 194 194 255;
                        }
+                       description {
+                               state, "focus" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
+                       }
                }
                part {
                        name, "bg.photo";
@@ -719,8 +724,6 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               rel1.to, "bg.photo";
-                               rel2.to, "bg.photo";
                                fixed, 1 1;
                        }
                }
@@ -730,10 +733,6 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               rel1.relative, 0.5 0.5;
-                               rel2.relative, 0.5 0.5;
-                               fixed, 1 1;
-                               min, 290 290;
                                color, 0 119 246 255;
                                visible, 0;
                        }
@@ -743,7 +742,6 @@ group {
                                visible, 1;
                        }
                }
-
                part {
                        name, PART_USER_EDIT_PHOTO_FOCUS;
                        type, SWALLOW;
@@ -751,8 +749,6 @@ group {
                        clip_to, "clip";
                        description {
                                state, "default" 0.0;
-                               rel1.to, PART_USER_EDIT_PHOTO;
-                               rel2.to, PART_USER_EDIT_PHOTO;
                                fixed, 1 1;
                        }
                }
@@ -764,6 +760,7 @@ group {
                        source, SRC_PROG;
                        action, STATE_SET "focus" 0.0;
                        target, "bg.photo";
+                       target, "bg";
                        target, "clip";
                        after, "sig,focus,1";
                }
@@ -786,6 +783,7 @@ group {
                        action, STATE_SET "default" 0.0;
                        transition, TRANSITION_LINEAR;
                        target, "bg.photo";
+                       target, "bg";
                        target, "clip";
                }
        }
index 29e0a5c..e645253 100644 (file)
@@ -30,6 +30,7 @@
 #define CTXPOPUP_X 294
 #define CTXPOPUP_Y 310
 #define MAX_BUF 128
+#define MAX_PHOTO 160
 
 enum input_handler_type {
        INPUT_HANDLER_TYPE_PHOTO,
@@ -242,16 +243,41 @@ static bool _add_btns(struct _priv *priv)
        return true;
 }
 
+static Evas_Object *_add_icon(Evas_Object *photo, const char *file,
+               const char *part)
+{
+       Evas_Object *icon;
+       int w, h;
+
+       icon = elm_image_add(photo);
+       if (!icon) {
+               _ERR("failed to add image");
+               return NULL;
+       }
+
+       elm_image_file_set(icon, file, NULL);
+       elm_image_object_size_get(icon, &w, &h);
+
+       if (w > MAX_PHOTO && h > MAX_PHOTO)
+               elm_image_fill_outside_set(icon, EINA_TRUE);
+       else
+               elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+
+       elm_object_part_content_set(photo, part, icon);
+
+       return icon;
+}
+
 static void _load_user_icon(struct _priv *priv, const char *file,
                const char *focus_file)
 {
        Evas_Object *icon, *focus_icon;
 
-       icon = utils_add_icon(priv->photo, file, PART_USER_EDIT_PHOTO);
+       icon = _add_icon(priv->photo, file, PART_USER_EDIT_PHOTO);
        if (!icon)
                _ERR("failed to add icon");
 
-       focus_icon = utils_add_icon(priv->photo, focus_file,
+       focus_icon = _add_icon(priv->photo, focus_file,
                        PART_USER_EDIT_PHOTO_FOCUS);
        if (!focus_icon)
                _ERR("failed to add focus icon");