From 3a36cbe025c0ecd56d05926fc55c5e838b2f9421 Mon Sep 17 00:00:00 2001
From: Piotr Pruski
Date: Thu, 3 Mar 2016 15:32:05 +0100
Subject: [PATCH] [UI] Added Favorite stars to UI elements
@TODO Connect UI with favorite button in live panel
Change-Id: I526062b955c1308bb23c405ecf691f81dcfabcf9
Signed-off-by: Piotr Pruski
---
CMakeLists.txt | 1 +
include/common/favoritemgr.h | 22 ++++++++++++++++++++++
include/common/menumgr.h | 1 +
include/define.h | 5 +++++
res/images/star_icon.png | Bin 0 -> 466 bytes
res/images/star_icon2.png | Bin 0 -> 474 bytes
res/layout/channel.edc | 37 +++++++++++++++++++++++++++++++++++++
res/layout/network.edc | 35 +++++++++++++++++++++++++++++++++++
res/layout/sound.edc | 39 ++++++++++++++++++++++++++++++++++++++-
res/widget/button.edc | 43 +++++++++++++++++++++++++++++++++++++++++++
src/common/favoritemgr.c | 33 +++++++++++++++++++++++++++++++++
src/common/menumgr.c | 8 ++++++++
src/layout/layout_sound.c | 5 +++++
src/layout/layout_system.c | 1 +
14 files changed, 229 insertions(+), 1 deletion(-)
create mode 100644 include/common/favoritemgr.h
create mode 100644 res/images/star_icon.png
create mode 100644 res/images/star_icon2.png
create mode 100644 src/common/favoritemgr.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c91b7c..096a9bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,7 @@ ENDIF(NOT DEFINED DESKTOP_ICON)
SET(SRCS
src/main.c
src/common/datamgr.c
+ src/common/favoritemgr.c
src/common/gridmgr.c
src/common/inputmgr.c
src/common/layoutmgr.c
diff --git a/include/common/favoritemgr.h b/include/common/favoritemgr.h
new file mode 100644
index 0000000..8346e0e
--- /dev/null
+++ b/include/common/favoritemgr.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2016 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_SETTINGS_FAVORITEMGR_H__
+#define __AIR_SETTINGS_FAVORITEMGR_H__
+
+void _set_favorite(Evas_Object *obj, Eina_Bool status);
+
+#endif /* __AIR_SETTINGS_FAVORITEMGR_H__ */
diff --git a/include/common/menumgr.h b/include/common/menumgr.h
index a1fb5bd..15e287e 100644
--- a/include/common/menumgr.h
+++ b/include/common/menumgr.h
@@ -26,6 +26,7 @@ struct menumgr_info {
const char *title;
const char *style;
Eina_Bool disabled;
+ Eina_Bool favorite;
Evas_Object *progress_evas;
char *(*status)(void *data, int id);
float (*progress_value)(void);
diff --git a/include/define.h b/include/define.h
index 573bd6d..c54c513 100644
--- a/include/define.h
+++ b/include/define.h
@@ -85,6 +85,7 @@
#define PART_LIVE_TV_BTN "part.live.tv.btn"
#define PART_MORE_FAV_BTN "part.more.fav.btn"
#define PART_MENU_PROGRESS "part.menu.progress"
+#define PART_FAV_STAR "part.star"
#define PART_GUIDE "part.guide"
#define PART_GUIDE_2 "part.guide2"
@@ -156,6 +157,8 @@
#define SIG_SELECTED "selected"
#define SIG_NOTAVAILABLE "state,notavailable"
#define SIG_ITEM_SELECTED "sig.item.selected"
+#define SIG_FAV_ADD "elm,state,favorite,add"
+#define SIG_FAV_DEL "elm,state,favorite,del"
/* Sources */
#define SRC_ELM "elm"
@@ -244,6 +247,8 @@
#define ARROW_ICON_DOWN_PNG "btn_option_arrow_nor.png"
#define ARROW_ICON_DOWN_FOC_PNG "btn_option_arrow_foc_down.png"
#define ARROW_ICON_SEL_PNG "btn_option_arrow_sel.png"
+#define STAR_ICON_PNG "star_icon.png"
+#define STAR_ICON2_PNG "star_icon2.png"
#define IC_ADD_SCHEDULE_COLON_PNG "ic_add_schedule_colon.png"
diff --git a/res/images/star_icon.png b/res/images/star_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..f493167be513bb05ccf9bbf909b251c2330cb21c
GIT binary patch
literal 466
zcmV;@0WJQCP)e
zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00BBlL_t(&-tC&(62c%1M4OEN
z|I7MPXVlSJnq?DU^IR^6-G)HBZ3>0rYTWn8oP)2n=mKV0TMEwxoSm%F70y}!S$g)c
zZ2Ov-Nnrs`1kBFXJ{yoMT@je+0x7J*gJ@Mo5po+@t+NaIx{y|J>wsGL!!=fQzeI!n
ze1~TMKgtC*LUn{pdNxv7h{*7N9~uF=Wjj0dU{&ZV`*u@w
z+wEZ^G)iS>srwBuLuqF#n{Dx~r==dYEqfl0OswZWAe
zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00BZtL_t(&-tC%84#OY}L}RPR
zz(gjqQg$K~8h$7@Mvs!l-^t_OgaqF;*PuED+
z{n8rr=R3Rt_*E{D8LA`8q$e|#g%%n9??W>{w`^y(9?S~evu`&w$OPV7q%=2*h90fP
zx*JD;Ta=zd9iX5sYiyH_Ji)CG6lR@yKzp2?Ogo$bS~J7)#$yLyYv<@rcBZ9wu(hHm
zQ%Vu^C(-EV*qN-J8~Xp6g^mON~m_B=c?G0%TO6m8+r_M^#5EETYR
z7d^(&EUKasnr4N)>VL%6!?%{`z4SdkY}^dL@k7VYaukHjW91L$492AK0$?q=5U7LU
Q8~^|S07*qoM6N<$f*xPOegFUf
literal 0
HcmV?d00001
diff --git a/res/layout/channel.edc b/res/layout/channel.edc
index bb89001..09f9152 100644
--- a/res/layout/channel.edc
+++ b/res/layout/channel.edc
@@ -23,6 +23,9 @@ group {
tag, "br" "\n";
}
}
+ images {
+ image, STAR_ICON2_PNG COMP;
+ }
parts {
part {
@@ -151,6 +154,25 @@ group {
fixed, 1 1;
}
}
+ part {
+ name, "PART_FAV_STAR";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 60 60;
+ image.normal, STAR_ICON2_PNG;
+ visible, 0;
+ rel1.relative, 0.95 0.05;
+ rel2.relative, 0.98 0.10;
+ fixed, 1 1;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
}
programs {
@@ -183,5 +205,20 @@ group {
target, PART_SUBTEXT1;
target, PART_SUBTEXT2;
}
+
+ program {
+ name, "SIG_FAV_ADD";
+ signal, SIG_FAV_ADD;
+ source, "elm";
+ action, STATE_SET "highlight" 0.0;
+ target, "PART_FAV_STAR";
+ }
+ program {
+ name, "SIG_FAV_DEL";
+ signal, SIG_FAV_DEL;
+ source, "elm";
+ action, STATE_SET "default" 0.0;
+ target, "PART_FAV_STAR";
+ }
}
}
diff --git a/res/layout/network.edc b/res/layout/network.edc
index 3d2ffe8..7f455f6 100644
--- a/res/layout/network.edc
+++ b/res/layout/network.edc
@@ -186,6 +186,7 @@ group {
image, IC_NETWORK_LOADING_10_PNG COMP;
image, IC_NETWORK_LOADING_11_PNG COMP;
image, IC_NETWORK_LOADING_12_PNG COMP;
+ image, STAR_ICON2_PNG COMP;
}
parts {
@@ -566,6 +567,25 @@ group {
visible, 1;
}
}
+ part {
+ name, "PART_FAV_STAR";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 60 60;
+ image.normal, STAR_ICON2_PNG;
+ visible, 0;
+ rel1.relative, 0.95 0.05;
+ rel2.relative, 0.98 0.10;
+ fixed, 1 1;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
}
programs {
@@ -610,6 +630,21 @@ group {
action, STATE_SET "default" 0.0;
target, "part.loading.icon";
}
+
+ program {
+ name, "SIG_FAV_ADD";
+ signal, SIG_FAV_ADD;
+ source, "elm";
+ action, STATE_SET "highlight" 0.0;
+ target, "PART_FAV_STAR";
+ }
+ program {
+ name, "SIG_FAV_DEL";
+ signal, SIG_FAV_DEL;
+ source, "elm";
+ action, STATE_SET "default" 0.0;
+ target, "PART_FAV_STAR";
+ }
}
}
diff --git a/res/layout/sound.edc b/res/layout/sound.edc
index 72ba8b6..43be74c 100644
--- a/res/layout/sound.edc
+++ b/res/layout/sound.edc
@@ -16,6 +16,9 @@
group {
name, GRP_LAYOUT_SOUND;
+ images {
+ image, STAR_ICON2_PNG COMP;
+ }
parts {
part {
name, "area";
@@ -247,6 +250,40 @@ group {
rel2.to, "speaker_settings_area";
}
}
-
+ part {
+ name, "PART_FAV_STAR";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 60 60;
+ image.normal, STAR_ICON2_PNG;
+ visible, 0;
+ rel1.relative, 0.95 0.05;
+ rel2.relative, 0.98 0.10;
+ fixed, 1 1;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "SIG_FAV_ADD";
+ signal, SIG_FAV_ADD;
+ source, "elm";
+ action, STATE_SET "highlight" 0.0;
+ target, "PART_FAV_STAR";
+ }
+ program {
+ name, "SIG_FAV_DEL";
+ signal, SIG_FAV_DEL;
+ source, "elm";
+ action, STATE_SET "default" 0.0;
+ target, "PART_FAV_STAR";
+ }
}
}
diff --git a/res/widget/button.edc b/res/widget/button.edc
index 8c71b5d..9c64120 100644
--- a/res/widget/button.edc
+++ b/res/widget/button.edc
@@ -418,6 +418,9 @@ group {
group {
name, "elm/button/base/style.normal.button";
data.item, "focus_highlight" "on";
+ images {
+ image, STAR_ICON_PNG COMP;
+ }
parts {
part {
name, "bg";
@@ -476,6 +479,32 @@ group {
color, COLOR_TEXT_DISABLE;
}
}
+ part {
+ name, "PART_FAV_STAR";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ image.normal, STAR_ICON_PNG;
+ visible, 0;
+ rel1 {
+ to, "bg.content";
+ relative, 0.95 0.05;
+ }
+ rel2 {
+ to, "bg.content";
+ relative, 0.05 0.05;
+ }
+ align, 0.05 0.0;
+ fixed, 1 1;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
}
programs {
program {
@@ -509,6 +538,20 @@ group {
action, STATE_SET "disabled" 0.0;
target, "elm.text";
}
+ program {
+ name, "SIG_FAV_ADD";
+ signal, SIG_FAV_ADD;
+ source, "elm";
+ action, STATE_SET "highlight" 0.0;
+ target, "PART_FAV_STAR";
+ }
+ program {
+ name, "SIG_FAV_DEL";
+ signal, SIG_FAV_DEL;
+ source, "elm";
+ action, STATE_SET "default" 0.0;
+ target, "PART_FAV_STAR";
+ }
}
}
diff --git a/src/common/favoritemgr.c b/src/common/favoritemgr.c
new file mode 100644
index 0000000..380ee29
--- /dev/null
+++ b/src/common/favoritemgr.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016 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
+#include
+
+#include "app_debug.h"
+#include "common/favoritemgr.h"
+#include "define.h"
+
+void _set_favorite(Evas_Object *obj, Eina_Bool status)
+{
+ SETTING_TRACE_BEGIN;
+ if(EINA_TRUE == status) {
+ elm_object_signal_emit(obj, SIG_FAV_ADD, SRC_ELM);
+ } else {
+ elm_object_signal_emit(obj, SIG_FAV_DEL, SRC_ELM);
+ }
+}
diff --git a/src/common/menumgr.c b/src/common/menumgr.c
index 357cb3a..019298f 100644
--- a/src/common/menumgr.c
+++ b/src/common/menumgr.c
@@ -17,6 +17,7 @@
#include
#include
+#include "common/favoritemgr.h"
#include "common/viewmgr.h"
#include "common/inputmgr.h"
#include "app_debug.h"
@@ -129,6 +130,9 @@ void menumgr_update(struct menumgr *m)
}
}
+ if (m->info[i])
+ _set_favorite(m->btn[i], m->info[i]->favorite);
+
if (m->info[i]->progress_evas) {
elm_progressbar_value_set(m->info[i]->progress_evas, m->info[i]->progress_value());
}
@@ -187,6 +191,10 @@ struct menumgr *menumgr_create(Evas_Object *table, Evas_Object *tab_menu_btn,
elm_object_disabled_set(btn, info[i].disabled);
evas_object_size_hint_align_set(btn, 0, 0);
+ if (info[i].favorite) {
+ _set_favorite(btn, info[i].favorite);
+ }
+
if (info[i].progress_value) {
info[i].progress_evas = utils_add_progressbar(btn, PART_MENU_PROGRESS, NULL);
if (!info[i].progress_evas) {
diff --git a/src/layout/layout_sound.c b/src/layout/layout_sound.c
index 46d942f..3e99aa4 100644
--- a/src/layout/layout_sound.c
+++ b/src/layout/layout_sound.c
@@ -16,6 +16,7 @@
#include
+#include "common/favoritemgr.h"
#include "common/layoutmgr.h"
#include "common/utils.h"
#include "common/inputmgr.h"
@@ -134,6 +135,10 @@ static bool _create(layoutmgr *lmgr, void *data)
elm_object_part_text_set(priv->ly, PART_SPEAKER_SETTINGS_DESC1, STR_SPEAKER_SETTINGS_DESC1);
elm_object_part_text_set(priv->ly, PART_SPEAKER_SETTINGS_DESC2, STR_SPEAKER_SETTINGS_DESC2);
+ //TODO Find how favorite will be saved and get the favorite status and set it
+ // when layout is created
+ _set_favorite(priv->ly, EINA_TRUE);
+
priv->speakers_count = ARRAY_SIZE(speakers);
priv->list_mgr = listmgr_create(priv->ly);
diff --git a/src/layout/layout_system.c b/src/layout/layout_system.c
index 212f267..7b1c34d 100644
--- a/src/layout/layout_system.c
+++ b/src/layout/layout_system.c
@@ -74,6 +74,7 @@ static struct menumgr_info menu_info[] = {
.title = STR_CLOCK,
.style = STYLE_STATUS_BTN,
.disabled = EINA_FALSE,
+ .favorite = EINA_TRUE,
.status = _get_clock_mode,
.selected = _selected,
.selected_menu = _selected_menu
--
2.7.4