bug fix: TC-1987 97/30597/1
authorRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Fri, 21 Nov 2014 06:13:56 +0000 (15:13 +0900)
committerRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Fri, 21 Nov 2014 06:16:34 +0000 (15:16 +0900)
The live thumbnail becomes transparent after install/uninstall web app
by pkgcmd.

Change-Id: I35908b38baf2e00b1f13af7456043b019b0d4f23
Bug-Tizen: TC-1987
Signed-off-by: Ryota Okubi <ryota.okubi@mail.toyota-td.jp>
src/homescreen/CicoHSMenuTile.cpp
src/homescreen/CicoHSMenuTile.h
src/homescreen/CicoHSMenuWindow.cpp
src/homescreen/CicoHSMenuWindow.h

index 34ce03a..8b67aec 100644 (file)
@@ -245,41 +245,6 @@ CicoHSMenuTile::Resize(int width, int height)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   CicoHSMenuTile::MovePosition
- *          move tile base position
- *
- * @param[in]   page        page
- * @param[in]   position    position of tile
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-CicoHSMenuTile::MovePosition(int page, int position)
-{
-    this->page = page;
-    this->position= position;
-    pos_x = GetPositionX();
-    pos_y = GetPositionY();
-
-    ICO_DBG("CicoHSMenuTile::MovePosition(appid=%p<%s> tile=(%d,%d))",
-            this->appid, appid, pos_x, pos_y);
-
-    evas_object_move(tile, pos_x, pos_y);
-    if (thumb_tile) {
-        evas_object_move(thumb_tile, pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
-    }
-    if (small_icon) {
-        evas_object_move(small_icon,
-                         pos_x + thumb_reduce_x - ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2,
-                         pos_y + height - thumb_reduce_y - height
-                             / ICO_HS_MENUTILE_THUMBNAIL_REDUCTION
-                             + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2);
-    }
-    evas_object_move(term_icon, pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH, pos_y);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
  * @brief   CicoHSMenuTile::OffsetMove
  *          move from base position
  *
@@ -916,32 +881,63 @@ CicoHSMenuTile::ShowMenu(bool show)
 void
 CicoHSMenuTile::SetOrgThumbnail(CicoHSMenuTile *orgTile)
 {
-
-    ICO_DBG("CicoHSMenuTile::SetOrgThumbnail Enter(appid=%p<%s>) run=%d surf=%08x",
-            this->appid, this->appid, app_running, orgTile->thumb.surface );
+    ICO_DBG("CicoHSMenuTile::SetOrgThumbnail appid=%s run=%d surf=%08x",
+            this->appid, app_running, orgTile->thumb.surface);
 
     /* check surface of orgTile */
-    if ( orgTile == NULL || orgTile->thumb.surface == 0 ) {
+    if (orgTile == NULL) {
         return;
     }
 
-    /* set surface */
-    this->ValidThumbnail( orgTile->thumb.surface );
-
-    /* set new thumbnail */
-    ico_syc_thumb_info_t info;
-
-    info.surface = orgTile->thumb.surface;
-    info.type = orgTile->thumb.type;
-    info.width = orgTile->thumb.width;
-    info.height = orgTile->thumb.height;
-    info.stride = orgTile->thumb.stride;
-    info.format = orgTile->thumb.format;
-
-    SetThumbnail( &info );
-
-    ICO_DBG("CicoHSMenuTile::SetOrgThumbnail Leave(appid=%p<%s>) run=%d surf=%08x",
-            this->appid, this->appid, app_running, orgTile->thumb.surface );
+    thumb_reduce_x = orgTile->thumb_reduce_x;
+    thumb_reduce_y = orgTile->thumb_reduce_y;
+    app_running = orgTile->app_running;
+    menu_show = orgTile->menu_show;
+    if (orgTile->thumb_tile)    {
+        if (thumb_tile) {
+            evas_object_del(thumb_tile);
+        }
+        thumb_tile = orgTile->thumb_tile;
+        orgTile->thumb_tile = NULL;
+        evas_object_event_callback_del(thumb_tile, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu);
+        evas_object_event_callback_del(thumb_tile, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu);
+        evas_object_event_callback_add(thumb_tile, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu, appid);
+        evas_object_event_callback_add(thumb_tile, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu, appid);
+        if ((orgTile->icon == thumb_tile) && (icon != thumb_tile))  {
+            evas_object_hide(icon);
+            icon = thumb_tile;
+            evas_object_show(icon);
+        }
+    }
+    if ((small_icon == NULL) && (orgTile->small_icon != NULL))  {
+        small_icon = orgTile->small_icon;
+        orgTile->small_icon = NULL;
+        evas_object_event_callback_del(small_icon, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu);
+        evas_object_event_callback_del(small_icon, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu);
+        evas_object_event_callback_add(small_icon, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu, appid);
+        evas_object_event_callback_add(small_icon, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu, appid);
+    }
+    if (orgTile->thumb.thumb_timer) {
+        ecore_timer_del(orgTile->thumb.thumb_timer);
+    }
+    thumb = orgTile->thumb;
+    orgTile->thumb.surface = 0;
+    orgTile->thumb.fbcount = 0;
+    orgTile->thumb.pixel_data = NULL;
+    orgTile->thumb.orgsurface = 0;
 
+    if (thumb.thumb_timer)  {
+        thumb.thumb_timer = ecore_timer_add(ICO_HS_MENUTILE_THUMBNAIL_RETRYTIME,
+                                            CicoHSMenuTile::TimerThumbnail, (void *)this);
+        orgTile->thumb.thumb_timer = NULL;
+    }
 }
 // vim: set expandtab ts=4 sw=4:
index 8b08eb6..f95f184 100644 (file)
@@ -113,7 +113,6 @@ class CicoHSMenuTile
     void CreateObject(Evas *evas);
     void FreeObject(void);
     void Resize(int width,int height);
-    void MovePosition(int page,int poisition);
     void OffsetMove(int offset_x,int offset_y);
     const char* GetImagePath(void);
     int GetWidth(void);
index 808d69c..2924ab9 100644 (file)
@@ -301,10 +301,10 @@ CicoHSMenuWindow::InitAppTiles(void)
  *          create object and show (tiles)
  *
  * @param[in]   none
- * @return      ERROR or OK
+ * @return      none
  */
 /*--------------------------------------------------------------------------*/
-int
+void
 CicoHSMenuWindow::SetAppTiles(void)
 {
     int tile_num = 0;
@@ -429,7 +429,6 @@ CicoHSMenuWindow::SetAppTiles(void)
             menu_tile[ii]->OffsetMove(height,0);
         }
     }
-    return ICO_OK;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -468,23 +467,23 @@ CicoHSMenuWindow::RenewAppTiles(void)
     ICO_TRA("CicoHSMenuWindow::RenewAppTiles Enter");
 
     int cnt, cnt2;
-    int ret;
+
+    /* save current page */
+    int current_page_org = current_page;
+    int subcurrent_page_org = subcurrent_page;
 
     /* backup old data */
     int all_tile_num_org = all_tile_num;
     CicoHSMenuTile *menu_tile_org[ICO_HS_MENU_MAX_TILE_NUM];
-    for (cnt=0; cnt < all_tile_num_org; cnt++) {
-        menu_tile_org[cnt]=menu_tile[cnt];
+    for (cnt = 0; cnt < all_tile_num_org; cnt++) {
+        menu_tile_org[cnt] = menu_tile[cnt];
     }
 
     /* initialization */
     InitAppTiles();
 
     /* set app tiles */
-    ret = SetAppTiles();
-    if(ret != ICO_OK){
-        ICO_ERR("CicoHSMenuWindow::RenewAppTiles: could not make tiles.");
-    }
+    SetAppTiles();
 
     /* update app info list */
     CicoHomeScreen::RenewAppInfoList();
@@ -494,20 +493,21 @@ CicoHSMenuWindow::RenewAppTiles(void)
         if (menu_tile[cnt] == NULL) {
             continue;
         }
-        for (cnt2=0; cnt2 < all_tile_num_org; cnt2++) {
+        for (cnt2 = 0; cnt2 < all_tile_num_org; cnt2++) {
             if (menu_tile_org[cnt2] == NULL) {
                 continue;
             }
             if (strncmp(menu_tile[cnt]->GetAppId(),
                         menu_tile_org[cnt2]->GetAppId(), ICO_HS_MAX_PROCESS_NAME) == 0) {
-                menu_tile[cnt]->SetOrgThumbnail( menu_tile_org[cnt2] );
+                // if same appid, a tile object is changed to an original thing
+                menu_tile[cnt]->SetOrgThumbnail(menu_tile_org[cnt2]);
                 break;
             }
         }
     }
 
-    /* free org app tiles */
-    for (cnt2=0; cnt2 < all_tile_num_org; cnt2++) {
+    /* free original app tiles */
+    for (cnt2 = 0; cnt2 < all_tile_num_org; cnt2++) {
         if (menu_tile_org[cnt2] == NULL) {
             continue;
         }
@@ -515,6 +515,63 @@ CicoHSMenuWindow::RenewAppTiles(void)
         delete menu_tile_org[cnt2];
     }
 
+    // restore current page
+    if (current_page_org < all_page_num)    {
+        for (cnt = 0; cnt < all_category_num; cnt++) {
+            if (current_page_org == category_info[cnt].page) {
+                break;
+            }
+        }
+        if (cnt < all_category_num) {
+            if (subcurrent_page_org >= category_info[cnt].subpage_max) {
+                subcurrent_page_org = 0;
+            }
+        }
+        else    {
+            current_page_org = 0;
+            subcurrent_page_org = 0;
+        }
+    }
+    else    {
+        current_page_org = 0;
+        subcurrent_page_org = 0;
+    }
+    ICO_TRA("CicoHSMenuWindow::RenewAppTiles page change %d/%d->%d/%d",
+            current_page, subcurrent_page, current_page_org, subcurrent_page_org);
+
+    // update the menu currently displayed
+    /* page pointer */
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    snprintf(img_path, sizeof(img_path), "%s%s",
+             img_dir_path, ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
+    evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+
+    current_page = current_page_org;
+    subcurrent_page = subcurrent_page_org;
+    snprintf(img_path, sizeof(img_path), "%s%s",
+             img_dir_path, ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
+    evas_object_image_file_set(page_pointer[current_page_org], img_path, NULL);
+
+    current_page = current_page_org;
+    subcurrent_page = subcurrent_page_org;
+
+    /* display cursor */
+    DspCtrlPageCursor();
+
+    /*tile*/
+    for (cnt = 0;cnt < menu_window_instance->all_tile_num; cnt++) {
+        if (menu_window_instance->menu_tile[cnt] == NULL) {
+            continue;
+        }
+        if ((menu_window_instance->menu_tile[cnt]->GetPage() != current_page) ||
+            (menu_window_instance->menu_tile[cnt]->GetSubPage() != subcurrent_page)) {
+            menu_window_instance->menu_tile[cnt]->
+                                        OffsetMove(-menu_window_instance->width, 0);
+        }
+        else    {
+            menu_window_instance->menu_tile[cnt]->OffsetMove(0, 0);
+        }
+    }
     ICO_TRA("CicoHSMenuWindow::RenewAppTiles Leave");
 }
 
@@ -866,13 +923,7 @@ CicoHSMenuWindow::CreateMenuWindow(int pos_x, int pos_y, int width, int height)
         return ICO_ERROR;
     }
     /* App tiles*/
-    ret = SetAppTiles();
-    if(ret != ICO_OK){
-        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make tiles.");
-        FreeMenuBack();
-        FreeWindow();
-        return ICO_ERROR;
-    }
+    SetAppTiles();
 
     /* Page Pointer */
     ret = SetPagePointer();
index 830440e..1cdf81e 100644 (file)
@@ -133,7 +133,7 @@ class CicoHSMenuWindow :public CicoHSWindow
     int SetMenuBack(void);
     void FreeMenuBack(void);
     void InitAppTiles(void);
-    int SetAppTiles(void);
+    void SetAppTiles(void);
     void FreeAppTiles(void);
     void RenewAppTiles(void);
     int SetPagePointer(void);