From: Denis Dolzhenko Date: Fri, 2 Sep 2016 09:08:23 +0000 (+0300) Subject: TizenRefApp-6781 Added advanced pop of Naviframe-item X-Git-Tag: submit/tizen/20160916.133943^2~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4656d033571af94d36995e95e281041cdf41a05;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-6781 Added advanced pop of Naviframe-item Change-Id: I773967c82afac7728c8b0d124201041037e8ab79 Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/View/inc/NaviFrameView.h b/src/Common/View/inc/NaviFrameView.h index ff5c0cc..4600a53 100644 --- a/src/Common/View/inc/NaviFrameView.h +++ b/src/Common/View/inc/NaviFrameView.h @@ -20,6 +20,7 @@ #include "View.h" #include "NaviFrameItem.h" +#include namespace Msg { @@ -100,6 +101,7 @@ namespace Msg private: bool m_TransitionStatus; + std::vector m_ItemsToDelete; }; } diff --git a/src/Common/View/src/NaviFrameView.cpp b/src/Common/View/src/NaviFrameView.cpp index 98a1f36..26f346b 100644 --- a/src/Common/View/src/NaviFrameView.cpp +++ b/src/Common/View/src/NaviFrameView.cpp @@ -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(eventInfo); - if(item) - item->onTransitionFinished(*item); + + auto *transFinishedItem = ViewItem::staticCast(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