TizenRefApp-6781 Added advanced pop of Naviframe-item 76/86676/5
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Fri, 2 Sep 2016 09:08:23 +0000 (12:08 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 5 Sep 2016 07:50:52 +0000 (10:50 +0300)
Change-Id: I773967c82afac7728c8b0d124201041037e8ab79
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/View/inc/NaviFrameView.h
src/Common/View/src/NaviFrameView.cpp

index ff5c0cc..4600a53 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "View.h"
 #include "NaviFrameItem.h"
+#include <vector>
 
 namespace Msg
 {
@@ -100,6 +101,7 @@ namespace Msg
 
         private:
             bool m_TransitionStatus;
+            std::vector<NaviFrameItem*> m_ItemsToDelete;
     };
 }
 
index 98a1f36..26f346b 100644 (file)
@@ -46,7 +46,6 @@ NaviFrameView::~NaviFrameView()
 void NaviFrameView::create(Evas_Object *parent)
 {
     setEo(elm_naviframe_add(parent));
-    elm_naviframe_event_enabled_set(getEo(), true); // Remove it after fix: TSAM-6776
     addSmartCb("transition,finished", SMART_CALLBACK(NaviFrameView, onTransitionFinished), this);
     show();
 }
@@ -115,19 +114,30 @@ void NaviFrameView::push(NaviFrameItem &item, View &content)
 
 void NaviFrameView::pop()
 {
-    m_TransitionStatus = getItemsCount() > 1;
-    elm_naviframe_item_pop(getEo());
+    auto *topFrame = getTopFrame();
+    if(topFrame)
+        pop(*topFrame);
 }
 
 void NaviFrameView::pop(NaviFrameItem &item)
 {
-    pop();
-    // Uncomment it after fix: TSAM-6776
-    /* if(getTransitionStatus())
-        item.destroy();
+    // Workaround solution to avoid rejected JIRA issue: http://suprem.sec.samsung.net/jira/browse/TSAM-6776
+    if(getTransitionStatus())
+    {
+        m_ItemsToDelete.push_back(&item);
+    }
     else
-        pop();
-    */
+    {
+        if(getTopFrame() == &item)
+        {
+            m_TransitionStatus = getItemsCount() > 1;
+            elm_naviframe_item_pop(getEo());
+        }
+        else
+        {
+            item.destroy();
+        }
+    }
 }
 
 void NaviFrameView::insertToBottom(NaviFrameItem &item)
@@ -136,9 +146,14 @@ void NaviFrameView::insertToBottom(NaviFrameItem &item)
     Elm_Object_Item *insert = nullptr;
 
     if(before)
+    {
         insert = elm_naviframe_item_insert_before(getEo(), before, nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty);
+    }
     else
+    {
+        m_TransitionStatus = !isEmpty();
         insert = elm_naviframe_item_push(getEo(), nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty);
+    }
 
     item.setElmObjItem(insert);
 }
@@ -153,9 +168,19 @@ void NaviFrameView::onTransitionFinished(Evas_Object *obj, void *eventInfo)
 {
     MSG_LOG("");
     m_TransitionStatus = false;
-    auto *item = ViewItem::staticCast<NaviFrameItem*>(eventInfo);
-    if(item)
-        item->onTransitionFinished(*item);
+
+    auto *transFinishedItem = ViewItem::staticCast<NaviFrameItem*>(eventInfo);
+
+    for(NaviFrameItem *item: m_ItemsToDelete)
+    {
+        if(item == transFinishedItem)
+            transFinishedItem = nullptr;
+        item->destroy();
+    }
+    m_ItemsToDelete.clear();
+
+    if(transFinishedItem)
+        transFinishedItem->onTransitionFinished(*transFinishedItem);
 }
 
 bool NaviFrameView::getTransitionStatus() const