summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-12-14 04:49:17 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-12-14 04:49:17 (GMT)
commitd5e2f084be25e70fa9a089a9dc17e491fed4105d (patch)
tree4b2f3b587fc2950d3a8f62f5ad48375a90f79240
parentb4f181e2a2d95df6df53abc84054b5533c110797 (diff)
downloadair_mediahub-d5e2f084be25e70fa9a089a9dc17e491fed4105d.zip
air_mediahub-d5e2f084be25e70fa9a089a9dc17e491fed4105d.tar.gz
air_mediahub-d5e2f084be25e70fa9a089a9dc17e491fed4105d.tar.bz2
music: set default thumbnail image for album and artist itemrefs/changes/85/54185/1
Change-Id: I303e57628b99e8707bd3a3b84e17e95336ee6312 Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--include/define.h1
-rw-r--r--include/view/base.h2
-rw-r--r--res/edc/widgets/gengrid.edc20
-rw-r--r--res/images/ic_thumbnail_artist_default.pngbin0 -> 4738 bytes
-rw-r--r--res/images/ic_thumbnail_song_default.pngbin0 -> 2685 bytes
-rw-r--r--src/grid/grid_music.c84
-rw-r--r--src/view/detail.c23
7 files changed, 125 insertions, 5 deletions
diff --git a/include/define.h b/include/define.h
index 59c5923..f55eaec 100644
--- a/include/define.h
+++ b/include/define.h
@@ -74,6 +74,7 @@
#define PART_ELM_TEXT_COUNT "elm.text.count"
#define PART_ELM_SWALLOW_THUMBNAIL "elm.swallow.thumbnail"
#define PART_ELM_SWALLOW_PICTURE "elm.swallow.picture"
+#define PART_ELM_SWALLOW_ICON "elm.swallow.icon"
#define PART_ELM_SWALLOW_VIDEO "elm.swallow.video"
#define PART_ELM_SWALLOW_FAVORITE "elm.swallow.favorite"
#define PART_ELM_SWALLOW_BG "elm.swallow.bg"
diff --git a/include/view/base.h b/include/view/base.h
index d658f72..fa7bb0a 100644
--- a/include/view/base.h
+++ b/include/view/base.h
@@ -39,6 +39,8 @@
#define IMAGE_PREVIEW_PLAY "ic_preview_play.png"
#define IMAGE_THUMBNAIL_PICTURE IMAGEDIR"/ic_thumbnail_picture.png"
#define IMAGE_THUMBNAIL_SONG "ic_thumbnail_song.png"
+#define IMAGE_THUMBNAIL_SONG_ALBUM IMAGEDIR"/ic_thumbnail_song_default.png"
+#define IMAGE_THUMBNAIL_ARTIST IMAGEDIR"/ic_thumbnail_artist_default.png"
#define IMAGE_THUMBNAIL_PLAY IMAGEDIR"/ic_thumbnail_play.png"
#define IMAGE_THUMBNAIL_FAVORITE IMAGEDIR"/ic_thumbnail_favorite.png"
#define IMAGE_PLAY_INFO_FAVORITE "ic_title_favorite.png"
diff --git a/res/edc/widgets/gengrid.edc b/res/edc/widgets/gengrid.edc
index 16cac88..b8a3da5 100644
--- a/res/edc/widgets/gengrid.edc
+++ b/res/edc/widgets/gengrid.edc
@@ -18,7 +18,7 @@ group {
name: "elm/gengrid/item/album_item/default";
data.item: "selectraise" "on";
data.item: "texts" "elm.text.title";
- data.item: "contents" "elm.swallow.thumbnail elm.swallow.textbg";
+ data.item: "contents" "elm.swallow.thumbnail elm.swallow.icon elm.swallow.textbg";
data.item: "focus_highlight" "on";
parts {
part {
@@ -80,6 +80,24 @@ group {
}
}
part {
+ name: PART_ELM_SWALLOW_ICON;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_ELM_SWALLOW_THUMBNAIL;
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: PART_ELM_SWALLOW_THUMBNAIL;
+ relative: 0.5 0.5;
+ }
+ min: 128 128;
+ fixed: 1 1;
+ }
+ }
+ part {
name: "padding_favorite";
type: SPACER;
scale: 1;
diff --git a/res/images/ic_thumbnail_artist_default.png b/res/images/ic_thumbnail_artist_default.png
new file mode 100644
index 0000000..1c28312
--- /dev/null
+++ b/res/images/ic_thumbnail_artist_default.png
Binary files differ
diff --git a/res/images/ic_thumbnail_song_default.png b/res/images/ic_thumbnail_song_default.png
new file mode 100644
index 0000000..93c6c3f
--- /dev/null
+++ b/res/images/ic_thumbnail_song_default.png
Binary files differ
diff --git a/src/grid/grid_music.c b/src/grid/grid_music.c
index 12bd7af..d55e7c3 100644
--- a/src/grid/grid_music.c
+++ b/src/grid/grid_music.c
@@ -111,6 +111,63 @@ static char *_album_text_get(void *data, Evas_Object *obj, const char *part)
return strdup(ai->name);
}
+static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ Evas_Object *eo;
+ struct album_info *ai;
+ struct color_data bg;
+
+ if (!data)
+ return NULL;
+
+ ai = data;
+
+ eo = NULL;
+ if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_SONG_ALBUM);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_TEXTBG)) {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+ }
+
+ app_contents_get_color(ai->name, NULL, &bg);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+
+ if (eo)
+ evas_object_show(eo);
+
+ return eo;
+}
+
static char *_artist_text_get(void *data, Evas_Object *obj, const char *part)
{
struct album_info *ai;
@@ -123,7 +180,7 @@ static char *_artist_text_get(void *data, Evas_Object *obj, const char *part)
return strdup(ai->artist);
}
-static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
+static Evas_Object *_artist_content_get(void *data, Evas_Object *obj,
const char *part)
{
Evas_Object *eo;
@@ -137,7 +194,28 @@ static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
eo = NULL;
if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
- eo = util_add_image(obj, ai->album_art);
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_ARTIST);
if (!eo) {
_ERR("failed to create image object");
return NULL;
@@ -497,7 +575,7 @@ static struct grid_class _gclass[] = {
[E_MUSIC_ARTIST] = {
.item_style = STYLE_MUSIC_ARTIST,
.text_get = _artist_text_get,
- .content_get = _album_content_get
+ .content_get = _artist_content_get
},
[E_MUSIC_GENRE] = {
.item_style = STYLE_MUSIC_GENRE,
diff --git a/src/view/detail.c b/src/view/detail.c
index 05a0326..9a8e2a0 100644
--- a/src/view/detail.c
+++ b/src/view/detail.c
@@ -520,7 +520,28 @@ static Evas_Object *_album_content_get(void *data, Evas_Object *obj,
eo = NULL;
if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) {
- eo = util_add_image(obj, ai->album_art);
+ if (ai->album_art) {
+ eo = util_add_image(obj, ai->album_art);
+ if (!eo) {
+ _ERR("failed to create image object");
+ return NULL;
+ }
+ } else {
+ eo = evas_object_rectangle_add(obj);
+ if (!eo) {
+ _ERR("failed to create rectangle object");
+ return NULL;
+
+ }
+
+ app_contents_get_color(ai->name, &bg, NULL);
+ evas_object_color_set(eo, bg.r, bg.g, bg.b, bg.a);
+ }
+ } else if (!strcmp(part, PART_ELM_SWALLOW_ICON)) {
+ if (ai->album_art)
+ return NULL;
+
+ eo = util_add_image(obj, IMAGE_THUMBNAIL_SONG_ALBUM);
if (!eo) {
_ERR("failed to create image object");
return NULL;