set photo image in user edit view whitch is selected from photo viewer 53/43853/6
authorSoohye Shin <soohye.shin@samsung.com>
Tue, 14 Jul 2015 13:14:16 +0000 (22:14 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Wed, 15 Jul 2015 03:39:02 +0000 (12:39 +0900)
- modify photo edc for focus handling

Change-Id: I74355d8e3ca9b33e9aeb7848af90474ecf2f5889
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
12 files changed:
edje/view/useredit.edc
include/view.h [moved from include/view_user_edit.h with 68% similarity]
include/view_home.h [deleted file]
include/view_photo.h [deleted file]
include/view_recent.h [deleted file]
include/view_user.h [deleted file]
src/main.c
src/view/view_home.c
src/view/view_photo.c
src/view/view_recent.c
src/view/view_user.c
src/view/view_user_edit.c

index efc89d1..76da959 100644 (file)
@@ -717,6 +717,9 @@ group {
                        description {
                                state, "focus" 0.0;
                                inherit, "default" 0.0;
+                               rel1.relative, 0.5 0.5;
+                               rel2.relative, 0.5 0.5;
+                               min, 284 284;
                                color, 255 255 255 255;
                        }
                }
@@ -726,18 +729,31 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               min, 284 284;
-                               rel1 {
-                                       to, "bg.photo";
-                                       relative, 0.5 0.5;
-                               }
-                               rel2 {
-                                       to, "bg.photo";
-                                       relative, 0.5 0.5;
-                               }
+                               rel1.to, "bg.photo";
+                               rel2.to, "bg.photo";
+                               fixed, 1 1;
+                       }
+               }
+               part {
+                       name, "pad";
+                       type, RECT;
+                       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;
+                       }
+                       description {
+                               state, "focus" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
                        }
                }
+
                part {
                        name, PART_USER_EDIT_PHOTO_FOCUS;
                        type, SWALLOW;
@@ -747,6 +763,7 @@ group {
                                state, "default" 0.0;
                                rel1.to, PART_USER_EDIT_PHOTO;
                                rel2.to, PART_USER_EDIT_PHOTO;
+                               fixed, 1 1;
                        }
                }
        }
@@ -756,15 +773,27 @@ group {
                        signal, SIG_FOCUS;
                        source, SRC_PROG;
                        action, STATE_SET "focus" 0.0;
-                       transition, LINEAR 0.2;
                        target, "bg.photo";
                        target, "clip";
+                       after, "sig,focus,1";
+               }
+               program {
+                       name, "sig,focus,1";
+                       action, STATE_SET "focus" 0.0;
+                       transition, LINEAR 0.2;
+                       target, "pad";
                }
                program {
                        name, "sig,unfocus";
                        signal, SIG_UNFOCUS;
                        source, SRC_PROG;
                        action, STATE_SET "default" 0.0;
+                       target, "pad";
+                       after, "sig,unfocus,1";
+               }
+               program {
+                       name, "sig,unfocus,1";
+                       action, STATE_SET "default" 0.0;
                        transition, LINEAR 0.2;
                        target, "bg.photo";
                        target, "clip";
similarity index 68%
rename from include/view_user_edit.h
rename to include/view.h
index 088b7cf..58f2a07 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __AIR_HOME_VIEW_USER_EDIT_H__
-#define __AIR_HOME_VIEW_USER_EDIT_H__
+#ifndef __AIR_HOME_VIEW_H__
+#define __AIR_HOME_VIEW_H__
 
+enum update_type {
+       UPDATE_TYPE_EDIT,
+       UPDATE_TYPE_PHOTO
+};
+
+view_class *view_home_get_vclass(void);
+view_class *view_user_get_vclass(void);
 view_class *view_user_edit_get_vclass(void);
+view_class *view_photo_get_vclass(void);
+view_class *view_recent_get_vclass(void);
 
-#endif /* __AIR_HOME_VIEW_USER_EDIT_H__ */
+#endif /* __AIR_HOME_VIEW_H__ */
diff --git a/include/view_home.h b/include/view_home.h
deleted file mode 100644 (file)
index d8b811d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#ifndef __AIR_HOME_VIEW_HOME_H__
-#define __AIR_HOME_VIEW_HOME_H__
-
-view_class *view_home_get_vclass(void);
-
-#endif /* __AIR_HOME_VIEW_HOME_H__ */
diff --git a/include/view_photo.h b/include/view_photo.h
deleted file mode 100644 (file)
index 9dd7b14..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#ifndef __AIR_HOME_VIEW_PHOTO_H__
-#define __AIR_HOME_VIEW_PHOTO_H__
-
-view_class *view_photo_get_vclass(void);
-
-#endif /* __AIR_HOME_VIEW_PHOTO_H__ */
diff --git a/include/view_recent.h b/include/view_recent.h
deleted file mode 100644 (file)
index fcf0768..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#ifndef __AIR_HOME_VIEW_RECENT_H__
-#define __AIR_HOME_VIEW_RECENT_H__
-
-view_class *view_recent_get_vclass(void);
-
-#endif /* __AIR_HOME_VIEW_RECENT_H__ */
diff --git a/include/view_user.h b/include/view_user.h
deleted file mode 100644 (file)
index c9c622c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#ifndef __AIR_HOME_VIEW_USER_H__
-#define __AIR_HOME_VIEW_USER_H__
-
-view_class *view_user_get_vclass(void);
-
-#endif /* __AIR_HOME_VIEW_USER_H__ */
index e00a82c..9338fed 100644 (file)
@@ -20,9 +20,7 @@
 #include <viewmgr.h>
 
 #include "defs.h"
-#include "view_home.h"
-#include "view_recent.h"
-#include "view_user.h"
+#include "view.h"
 
 SET_TAG(PACKAGE);
 
index 83e4e75..05dffa8 100644 (file)
@@ -21,7 +21,7 @@
 #include <inputmgr.h>
 
 #include "defs.h"
-#include "view_home.h"
+#include "view.h"
 #include "data_home.h"
 #include "datamgr.h"
 #include "utils.h"
index 74d5c61..845fc3f 100644 (file)
@@ -21,7 +21,7 @@
 #include <inputmgr.h>
 
 #include "defs.h"
-#include "view_photo.h"
+#include "view.h"
 #include "data_photo.h"
 #include "utils.h"
 
@@ -209,12 +209,18 @@ static void _done_key_down(int id, void *data, Evas *e, Evas_Object *obj,
                Evas_Event_Key_Down *ev)
 {
        struct _priv *priv = data;
+       char *thumb;
 
        if (!strcmp(ev->keyname, KEY_ENTER) ||
                        !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
                _delete_popup(priv, &done_handler, obj);
                elm_object_focus_allow_set(priv->grid, EINA_TRUE);
-               elm_object_focus_set(priv->grid, EINA_TRUE);
+               thumb = elm_object_item_data_get(priv->cur);
+               if (thumb) {
+                       viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_PHOTO,
+                                       thumb);
+                       viewmgr_pop_view();
+               }
        } else if (!strcmp(ev->keyname, KEY_BACK) ||
                        !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
                _delete_popup(priv, &done_handler, obj);
index a993ac0..f8fe89c 100644 (file)
@@ -21,7 +21,7 @@
 #include <inputmgr.h>
 
 #include "defs.h"
-#include "view_recent.h"
+#include "view.h"
 #include "data_recent.h"
 #include "datamgr.h"
 #include "utils.h"
index 1a31ae3..604c99b 100644 (file)
@@ -21,8 +21,7 @@
 #include <inputmgr.h>
 
 #include "defs.h"
-#include "view_user.h"
-#include "view_user_edit.h"
+#include "view.h"
 #include "data_user.h"
 #include "datamgr.h"
 #include "utils.h"
@@ -103,7 +102,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj,
                        return;
                }
 
-               viewmgr_update_view(VIEW_USER_EDIT, 0, NULL);
+               viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, NULL);
                datamgr_select_item(priv->dm, priv->foc->di);
        } else if (!strcmp(ev->keyname, KEY_BACK) ||
                        !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
@@ -112,7 +111,8 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj,
                if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH)
                        return;
 
-               viewmgr_update_view(VIEW_USER_EDIT, 0, priv->foc->di);
+               viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT,
+                               priv->foc->di);
                viewmgr_push_view(VIEW_USER_EDIT);
        }
 }
index 9e83732..45d8dd6 100644 (file)
@@ -21,8 +21,7 @@
 #include <inputmgr.h>
 
 #include "defs.h"
-#include "view_user_edit.h"
-#include "view_photo.h"
+#include "view.h"
 #include "datamgr.h"
 #include "utils.h"
 
@@ -69,6 +68,8 @@ struct _priv {
        Evas_Object *popup;
        Evas_Object *lock_icon;
 
+       char *selected_photo;
+
        struct datamgr *dm;
        struct datamgr_item *di;
 };
@@ -298,11 +299,13 @@ static void _load_user_icon(struct _priv *priv, const char *file,
        icon = utils_add_icon(priv->photo, file, PART_USER_EDIT_PHOTO);
        if (!icon)
                _ERR("failed to add icon");
+       elm_image_fill_outside_set(icon, EINA_TRUE);
 
        focus_icon = utils_add_icon(priv->photo, focus_file,
                        PART_USER_EDIT_PHOTO_FOCUS);
        if (!focus_icon)
                _ERR("failed to add focus icon");
+       elm_image_fill_outside_set(focus_icon, EINA_TRUE);
 
        priv->icon = icon;
        priv->focus_icon = focus_icon;
@@ -736,17 +739,26 @@ static void _show(void *data)
                                MESSAGE_EDIT_USER);
                elm_entry_entry_set(priv->name, priv->di->title);
                elm_entry_entry_set(priv->pin, "");
-               photo = utils_get_photo_from_icon(priv->di->icon);
-               focus_photo = utils_get_focus_photo_from_photo(photo);
-               _load_user_icon(priv, photo, focus_photo);
+               if (priv->selected_photo) {
+                       _load_user_icon(priv, priv->selected_photo,
+                                       priv->selected_photo);
+                } else {
+                       photo = utils_get_photo_from_icon(priv->di->icon);
+                       focus_photo = utils_get_focus_photo_from_photo(photo);
+                       _load_user_icon(priv, photo, focus_photo);
+               }
                _load_del_btn(priv);
        } else {
                elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE,
                                MESSAGE_ADD_USER);
                elm_entry_entry_set(priv->name, MESSAGE_ENTRY_NAME);
                elm_entry_entry_set(priv->pin, MESSAGE_ENTRY_PIN);
-               _load_user_icon(priv, IMAGE_USER_CURRENT_DEFAULT,
-                               IMAGE_USER_CURRENT_DEFAULT_FOCUS);
+               if (priv->selected_photo)
+                       _load_user_icon(priv, priv->selected_photo,
+                                       priv->selected_photo);
+               else
+                       _load_user_icon(priv, IMAGE_USER_CURRENT_DEFAULT,
+                                       IMAGE_USER_CURRENT_DEFAULT_FOCUS);
        }
 
        _load_lock_icon(priv);
@@ -775,6 +787,7 @@ static void _hide(void *data)
                priv->lock_icon = NULL;
        }
 
+       priv->selected_photo = NULL;
        evas_object_hide(priv->base);
 }
 
@@ -808,7 +821,18 @@ static void _update(void *view_data, int update_type, void *data)
        }
 
        priv = view_data;
-       priv->di = data;
+
+       switch (update_type) {
+       case UPDATE_TYPE_EDIT:
+               priv->di = data;
+               break;
+       case UPDATE_TYPE_PHOTO:
+               priv->selected_photo = data;
+               break;
+       default:
+               _ERR("Invalid type");
+               return;
+       }
 }
 
 static view_class vclass = {