add initial view_photo 32/42432/1
authorSoohye Shin <soohye.shin@samsung.com>
Mon, 29 Jun 2015 07:17:57 +0000 (16:17 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Mon, 29 Jun 2015 07:17:57 +0000 (16:17 +0900)
Change-Id: Iaa3a60bdcb3624de7c4a76f139c8a3787fd134b4
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
edje/home.edc
edje/view/photo.edc [new file with mode: 0644]
include/defs.h
include/view_photo.h [new file with mode: 0644]
src/view/view_photo.c [new file with mode: 0644]
src/view/view_user_edit.c

index 546b4df..bfdffcc 100644 (file)
@@ -47,6 +47,7 @@ SET(SRCS
                src/data/data_home.c
                src/data/data_recent.c
                src/data/data_user.c
+               src/view/view_photo.c
                src/view/view_user_edit.c
                src/view/view_user.c
                src/view/view_recent.c
index 0cf5ac2..1d06e76 100644 (file)
@@ -22,4 +22,5 @@ collections {
        #include "view/recent.edc"
        #include "view/user.edc"
        #include "view/useredit.edc"
+       #include "view/photo.edc"
 }
diff --git a/edje/view/photo.edc b/edje/view/photo.edc
new file mode 100644 (file)
index 0000000..28ab518
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+#include "../../include/defs.h"
+group {
+       name, GRP_PHOTO;
+       parts {
+       }
+}
index b412957..cf2a209 100644 (file)
@@ -21,6 +21,7 @@
 #define VIEW_RECENT "VIEW_RECENT"
 #define VIEW_USER "VIEW_USER"
 #define VIEW_USER_EDIT "VIEW_USER_EDIT"
+#define VIEW_PHOTO "VIEW_PHOTO"
 
 #define SRC_PROG "prog"
 #define SRC_EDJE "edje"
@@ -44,6 +45,7 @@
 #define GRP_USER_EDIT_ICON_LIST "group.user.edit.icon.list"
 #define GRP_USER_EDIT_ICON_LIST_ITEM "group.user.edit.icon.list.item"
 #define GRP_BAR_ITEM "group.bar.item"
+#define GRP_PHOTO "group.photo"
 
 #define PART_HOME_MENU_BAR "part.home.menu.bar"
 #define PART_HOME_UP_ARROW "part.home.up.arrow"
diff --git a/include/view_photo.h b/include/view_photo.h
new file mode 100644 (file)
index 0000000..9dd7b14
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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/src/view/view_photo.c b/src/view/view_photo.c
new file mode 100644 (file)
index 0000000..e3a0319
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+
+ * 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.
+ */
+
+#include <Elementary.h>
+#include <app_debug.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+
+#include "defs.h"
+#include "view_photo.h"
+#include "utils.h"
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+
+       if (!win) {
+               _ERR("Invalid argument");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to calloc priv");
+               return NULL;
+       }
+
+       base = utils_add_layout(win, GRP_PHOTO, false, NULL);
+       if (!base) {
+               _ERR("failed to create base");
+               free(priv);
+               return NULL;
+       }
+       evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       priv->win = win;
+       priv->base = base;
+
+       viewmgr_set_view_data(VIEW_PHOTO, priv);
+
+       return base;
+}
+
+static void _show(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_show(priv->base);
+}
+
+static void _hide(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_del(priv->base);
+       free(priv);
+}
+
+static view_class vclass = {
+       .view_id = VIEW_PHOTO,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy
+};
+
+view_class *view_photo_get_vclass(void)
+{
+       return &vclass;
+}
+
index a4350ac..89bdc30 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "view_user_edit.h"
+#include "view_photo.h"
 #include "datamgr.h"
 #include "utils.h"
 
@@ -139,6 +140,7 @@ static void _eo_key_down(int id, void *data, Evas *e, Evas_Object *obj,
                        !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
                /* It should be implemented later */
                evas_object_del(data);
+               viewmgr_push_view(VIEW_PHOTO);
        }
 }
 
@@ -358,6 +360,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        }
 
        viewmgr_set_view_data(VIEW_USER_EDIT, priv);
+       viewmgr_add_view(view_photo_get_vclass(), NULL);
 
        return base;
 }
@@ -429,6 +432,7 @@ static void _destroy(void *data)
        inputmgr_remove_callback(priv->photo, &photo_handler);
        inputmgr_remove_callback(priv->done, &done_handler);
        inputmgr_remove_callback(priv->cancel, &cancel_handler);
+       viewmgr_remove_view(VIEW_PHOTO);
        evas_object_del(priv->base);
        free(priv);
 }