add initial gallery and music view 46/41846/2
authorJehun Lim <jehun.lim@samsung.com>
Thu, 18 Jun 2015 07:41:08 +0000 (16:41 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Thu, 18 Jun 2015 14:09:46 +0000 (23:09 +0900)
Change-Id: Iff418e86900d0a16ca1cc0a5888442163a36f483
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
13 files changed:
CMakeLists.txt
include/define.h
include/view.h
include/view/gallery.h [new file with mode: 0644]
include/view/music.h [new file with mode: 0644]
res/edc/mediahub.edc
res/edc/view/gallery.edc [new file with mode: 0644]
res/edc/view/movie.edc [moved from res/edc/view/movie_view.edc with 100% similarity]
res/edc/view/music.edc [new file with mode: 0644]
src/main.c
src/view/gallery.c [new file with mode: 0644]
src/view/movie.c [moved from src/view/movie_view.c with 100% similarity]
src/view/music.c [new file with mode: 0644]

index 5163127..9aef68f 100644 (file)
@@ -48,7 +48,9 @@ ENDIF(NOT DEFINED PACKAGEDIR)
 
 SET(SRCS
 src/main.c
-src/view/movie_view.c
+src/view/movie.c
+src/view/gallery.c
+src/view/music.c
 src/view/viewer.c
 src/layout/menu_layout.c
 )
index 5faf611..82d8927 100644 (file)
@@ -19,6 +19,8 @@
 
 /* views */
 #include "view/movie.h"
+#include "view/gallery.h"
+#include "view/music.h"
 #include "view/viewer.h"
 
 /* layouts */
index 5428cfe..c28e0d1 100644 (file)
 /* movie */
 view_class *view_movie_get_vclass(void);
 
+/* gallery */
+view_class *view_gallery_get_vclass(void);
+
+/* music */
+view_class *view_music_get_vclass(void);
+
 /* viewer */
 view_class *view_viewer_get_vclass(void);
 
diff --git a/include/view/gallery.h b/include/view/gallery.h
new file mode 100644 (file)
index 0000000..830899f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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_MEDIAHUB_VIEW_GALLERY_H__
+#define __AIR_MEDIAHUB_VIEW_GALLERY_H__
+
+#define VIEW_GALLERY "VIEW_GALLERY"
+
+#define GRP_GALLERY_VIEW "group.gallery_view"
+
+#endif /* __AIR_MEDIAHUB_VIEW_GALLERY_H__ */
diff --git a/include/view/music.h b/include/view/music.h
new file mode 100644 (file)
index 0000000..d727a59
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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_MEDIAHUB_VIEW_MUSIC_H__
+#define __AIR_MEDIAHUB_VIEW_MUSIC_H__
+
+#define VIEW_MUSIC "VIEW_MUSIC"
+
+#define GRP_MUSIC_VIEW "group.music_view"
+
+#endif /* __AIR_MEDIAHUB_VIEW_MUSIC_H__ */
index a80e853..bacbbec 100644 (file)
@@ -17,7 +17,9 @@
 #include "../../include/define.h"
 
 collections {
-       #include "view/movie_view.edc"
+       #include "view/movie.edc"
+       #include "view/gallery.edc"
+       #include "view/music.edc"
        #include "view/viewer.edc"
        #include "layout/menu_layout.edc"
 }
diff --git a/res/edc/view/gallery.edc b/res/edc/view/gallery.edc
new file mode 100644 (file)
index 0000000..cd292a7
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+group {
+       name: GRP_GALLERY_VIEW;
+       parts {
+               part {
+                       name: "bg";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 255 255 255 255;
+                       }
+               }
+               part {
+                       name: PART_MENU_LAYOUT;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel2.relative: 1.0 0.0;
+                               align: 0.5 0.0;
+                       }
+               }
+               part {
+                       name: "padding_content_layout";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: PART_MENU_LAYOUT;
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: PART_MENU_LAYOUT;
+                               min: 0 71;
+                               align: 0.5 0.0;
+                               color: 223 223 223 255;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: PART_CONTENT_LAYOUT;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "padding_content_layout";
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: "padding_content_layout";
+                               min: 0 678;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+       }
+}
diff --git a/res/edc/view/music.edc b/res/edc/view/music.edc
new file mode 100644 (file)
index 0000000..946f756
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+group {
+       name: GRP_MUSIC_VIEW;
+       parts {
+               part {
+                       name: "bg";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 255 255 255 255;
+                       }
+               }
+               part {
+                       name: PART_MENU_LAYOUT;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel2.relative: 1.0 0.0;
+                               align: 0.5 0.0;
+                       }
+               }
+               part {
+                       name: "padding_content_layout";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: PART_MENU_LAYOUT;
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: PART_MENU_LAYOUT;
+                               min: 0 71;
+                               align: 0.5 0.0;
+                               color: 223 223 223 255;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: PART_CONTENT_LAYOUT;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "padding_content_layout";
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: "padding_content_layout";
+                               min: 0 678;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+       }
+}
index 9fd990e..538d955 100644 (file)
@@ -74,6 +74,8 @@ static bool _create(void *data)
        }
 
        viewmgr_add_view(view_movie_get_vclass(), NULL);
+       viewmgr_add_view(view_gallery_get_vclass(), NULL);
+       viewmgr_add_view(view_music_get_vclass(), NULL);
        viewmgr_add_view(view_viewer_get_vclass(), NULL);
 
        elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
@@ -96,6 +98,8 @@ static void _terminate(void *data)
        ad = data;
 
        viewmgr_remove_view(VIEW_MOVIE);
+       viewmgr_remove_view(VIEW_GALLERY);
+       viewmgr_remove_view(VIEW_MUSIC);
        viewmgr_remove_view(VIEW_VIEWER);
 
        viewmgr_destroy();
diff --git a/src/view/gallery.c b/src/view/gallery.c
new file mode 100644 (file)
index 0000000..970ca82
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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 <layoutmgr.h>
+
+#include "define.h"
+#include "layout.h"
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+
+       layoutmgr *lmgr;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+       layoutmgr *lmgr;
+
+       if (!win) {
+               _ERR("failed to get win object");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to allocate priv");
+               return NULL;
+       }
+
+       base = elm_layout_add(win);
+       if (!base) {
+               _ERR("failed to create base object");
+               free(priv);
+               return NULL;
+       }
+
+       elm_layout_file_set(base, EDJEFILE, GRP_GALLERY_VIEW);
+
+       evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       lmgr = layoutmgr_create(base);
+       layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL);
+       layoutmgr_show_layout(lmgr, LAYOUT_MENU);
+
+       priv->win = win;
+       priv->base = base;
+       priv->lmgr = lmgr;
+
+       viewmgr_set_view_data(VIEW_GALLERY, priv);
+
+       return base;
+}
+
+static void _show(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_show(priv->base);
+}
+
+static void _hide(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       layoutmgr_destroy(priv->lmgr);
+       evas_object_del(priv->base);
+
+       free(priv);
+}
+
+static view_class _vclass = {
+       .view_id = VIEW_GALLERY,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy,
+};
+
+view_class *view_gallery_get_vclass(void)
+{
+       return &_vclass;
+}
similarity index 100%
rename from src/view/movie_view.c
rename to src/view/movie.c
diff --git a/src/view/music.c b/src/view/music.c
new file mode 100644 (file)
index 0000000..4280f66
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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 <layoutmgr.h>
+
+#include "define.h"
+#include "layout.h"
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+
+       layoutmgr *lmgr;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+       layoutmgr *lmgr;
+
+       if (!win) {
+               _ERR("failed to get win object");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to allocate priv");
+               return NULL;
+       }
+
+       base = elm_layout_add(win);
+       if (!base) {
+               _ERR("failed to create base object");
+               free(priv);
+               return NULL;
+       }
+
+       elm_layout_file_set(base, EDJEFILE, GRP_MUSIC_VIEW);
+
+       evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       lmgr = layoutmgr_create(base);
+       layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL);
+       layoutmgr_show_layout(lmgr, LAYOUT_MENU);
+
+       priv->win = win;
+       priv->base = base;
+       priv->lmgr = lmgr;
+
+       viewmgr_set_view_data(VIEW_MUSIC, priv);
+
+       return base;
+}
+
+static void _show(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_show(priv->base);
+}
+
+static void _hide(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       layoutmgr_destroy(priv->lmgr);
+       evas_object_del(priv->base);
+
+       free(priv);
+}
+
+static view_class _vclass = {
+       .view_id = VIEW_MUSIC,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy,
+};
+
+view_class *view_music_get_vclass(void)
+{
+       return &_vclass;
+}