#define PART_GENGRID "part.gengrid"
#define PART_APP_COUNT "part.app.count"
#define PART_NO_CONTENTS "part.no.contents"
+#define PART_FAVORITE_ICON "part.favorite.icon"
/* Style */
#define STYLE_MENU_BTN "style.menu.button"
#define SIG_ITEM_FOCUSED "item_focused"
#define SIG_ITEM_SELECTED "item_selected"
#define SIG_SOURCE_EDC "edc"
+#define SIG_FAVORITE "favorite"
/* Font */
#define FONT_TIZENSANS_REGULAR "TizenSans"
#define SIZE_BOX_PAD_H (40 + 40)
#define SIZE_BOX_PAD_V 0
+/* Image */
+#define FAVORITE_ICON_PNG "ic_thumbnail_favorite_01.png"
+
#endif /* __AIR_APPS_DEFINE_H__ */
data.item, "focus_highlight" "on";
data.item, "texts" "elm.text";
data.item, "contents" "elm.swallow.icon";
+ images {
+ image, FAVORITE_ICON_PNG COMP;
+ }
+
parts {
part {
name, "padding.bottom.right";
}
}
+ part {
+ name, "padding.favorite";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 164 12;
+ rel2.relative, 0.0 0.0;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, PART_FAVORITE_ICON;
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ image.normal, FAVORITE_ICON_PNG;
+ rel1 {
+ to, "padding.favorite";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "padding.favorite";
+ align, 0.0 0.0;
+ fixed, 1 1;
+ visible, 0;
+ }
+ description {
+ state, "visible" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+
part {
name, "elm.swallow.icon";
type, SWALLOW;
name, "item_selected";
action, SIGNAL_EMIT SIG_ITEM_SELECTED SIG_SOURCE_EDC;
}
+
+ program {
+ name, "favorite";
+ signal, "favorite";
+ source, PART_FAVORITE_ICON;
+ action, STATE_SET "visible" 0.0;
+ target, PART_FAVORITE_ICON;
+ }
}
}
#include <viewmgr.h>
#include <gridmgr.h>
#include <inputmgr.h>
+#include <app_contents.h>
#include <app_debug.h>
#include "define.h"
_ERR("Invalid argument.");
return;
}
- adata = (struct app_data *)elm_object_item_data_get(it);
+ adata = elm_object_item_data_get(it);
r = aul_open_app(get_app_id(adata));
if (r == AUL_R_EINVAL) {
static void _grid_realized_cb(int id, void *data, Evas_Object *obj,
Elm_Object_Item *item)
{
+ struct app_data *adata;
+ bool isfavorite;
+ int r;
+
if (!data || !item) {
_ERR("Invalid argument.");
return;
}
+ adata = elm_object_item_data_get(item);
+
elm_object_item_signal_callback_add(item, SIG_ITEM_FOCUSED,
SIG_SOURCE_EDC, _grid_item_focused_cb, data);
elm_object_item_signal_callback_add(item, SIG_ITEM_SELECTED,
SIG_SOURCE_EDC, _grid_item_selected_cb, data);
+
+ r = app_contents_favorite_check(CONTENTS_APP, get_app_id(adata),
+ &isfavorite);
+ if (r != APP_CONTENTS_ERROR_NONE) {
+ _ERR("Favorite check failed.");
+ return;
+ }
+
+ if (isfavorite)
+ elm_object_item_signal_emit(item, SIG_FAVORITE,
+ PART_FAVORITE_ICON);
}
static void _grid_unrealized_cb(int id, void *data, Evas_Object *obj,