summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-12-18 07:00:02 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-12-18 07:01:07 (GMT)
commit999c45fd0068ca7bc8cbca329c49dbe19a8d8f99 (patch)
tree08dcb1e170f8f21ad0989a9a94855600d9d03448
parent87d32bea6beb7dd98ddcd6b8ae5369fe999fb692 (diff)
downloadair_mediahub-999c45fd0068ca7bc8cbca329c49dbe19a8d8f99.zip
air_mediahub-999c45fd0068ca7bc8cbca329c49dbe19a8d8f99.tar.gz
air_mediahub-999c45fd0068ca7bc8cbca329c49dbe19a8d8f99.tar.bz2
Change-Id: I722759defc118ae93c8d9c0a7119b980142af4a7 Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--src/view/base.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/view/base.c b/src/view/base.c
index 0a53ee0..8742f44 100644
--- a/src/view/base.c
+++ b/src/view/base.c
@@ -38,9 +38,15 @@
#define TEXT_FAVORITE_ADDED "Added to your favorite."
#define TEXT_FAVORITE_REMOVED "Removed from your favorite."
+#define TEXT_USB_ADDED "USB Connected"
+#define TEXT_USB_REMOVED "USB Disconnected"
+
+#define USB_ADDED 1
+#define USB_REMOVED 0
+
#define BOX_PADDING_SIZE 80
-#define TIME_TOAST_FAVORITE 5.0
+#define TIME_TOAST 5.0
#define ARRAY_SIZE(arr) (sizeof((arr)) / sizeof((arr)[0]))
@@ -745,7 +751,7 @@ static bool _draw_items(struct _priv *priv)
return true;
}
-static void _hide_toast_favorite(struct _priv *priv)
+static void _hide_toast(struct _priv *priv)
{
if (priv->notify)
evas_object_hide(priv->notify);
@@ -765,10 +771,10 @@ static void _show_toast_favorite(struct _priv *priv, const char *id)
if (favorite)
notify = util_add_notify(priv->base, STYLE_TOAST, STYLE_TOAST,
- TEXT_FAVORITE_ADDED, TIME_TOAST_FAVORITE);
+ TEXT_FAVORITE_ADDED, TIME_TOAST);
else
notify = util_add_notify(priv->base, STYLE_TOAST, STYLE_TOAST,
- TEXT_FAVORITE_REMOVED, TIME_TOAST_FAVORITE);
+ TEXT_FAVORITE_REMOVED, TIME_TOAST);
if (!notify) {
_ERR("failed to add notify object");
@@ -778,6 +784,20 @@ static void _show_toast_favorite(struct _priv *priv, const char *id)
priv->notify = notify;
}
+static void _show_toast_usb(struct _priv *priv, int state)
+{
+ Evas_Object *notify;
+
+ if (state == USB_ADDED)
+ notify = util_add_notify(priv->base, STYLE_TOAST, STYLE_TOAST,
+ TEXT_USB_ADDED, TIME_TOAST);
+ else
+ notify = util_add_notify(priv->base, STYLE_TOAST, STYLE_TOAST,
+ TEXT_USB_REMOVED, TIME_TOAST);
+
+ priv->notify = notify;
+}
+
static void _media_db_updated_cb(media_content_error_e error,
int pid,
media_content_db_update_item_type_e update_item,
@@ -808,6 +828,8 @@ static void _media_db_updated_cb(media_content_error_e error,
}
media_content_remove_db_updated_cb(priv->noti_h);
+
+ _hide_toast(priv);
}
static void _usb_changed_cb(void *data, int state)
@@ -835,6 +857,8 @@ static void _usb_changed_cb(void *data, int state)
/* to show base view */
while (viewmgr_active_view_count() > 1)
viewmgr_pop_view();
+
+ _show_toast_usb(priv, state);
}
static Evas_Object *_create(Evas_Object *win, void *data)
@@ -993,7 +1017,7 @@ static void _update(void *view_data, int update_type, void *data)
if (vdata->status == E_TOAST_SHOW)
_show_toast_favorite(priv, vdata->id);
else
- _hide_toast_favorite(priv);
+ _hide_toast(priv);
break;
case UPDATE_FAVORITE:
if (!data)