Search code examples
navigationtizen-wearable-sdktizen-native-app

Native Tizen remove naviframe item


I have a Tizen wear application that consists of 3 views and each one of the views is pushed to the naviframe. The three views are:

Genlist_A > Progressbar > Genlist_B

The layout of the views are shown by the arrows. When as user touches a genlist item in Genlist_A then the Progressbar is shown until Genlist_B has data to display.

This navigation works well as all the views display as they should. The problem is when trying to navigate from Genlist_B back to Genlist_A. When navigating back the Progressbar shows again and the only way to go see Genlist_A when this happens is to close the progressbar.

void _create_progressbar()
{
    Evas_Object *nf = local_ad->naviframe;
    Evas_Object *progressbar;
    Evas_Object *layout;

    layout = elm_layout_add(nf);
    elm_layout_file_set(layout, ELM_DEMO_EDJ, "progessbar");
    evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    progressbar = elm_progressbar_add(layout);
    elm_object_style_set(progressbar, "process");
    evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(progressbar);
    elm_progressbar_pulse(progressbar, EINA_TRUE);
    elm_object_part_content_set(layout, "process", progressbar);
    elm_object_content_set(layout, layout);
    elm_naviframe_item_push(nf, "ProgressBar", NULL, NULL, layout, "empty");
}

The code above shows the creation of the progressbar view. I have seen in some samples that elm_naviframe_item_pop_cb_set is used. I did the same thing and the progress bar is still shown when I click back.

nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, scroller, "empty");
elm_naviframe_item_pop_cb_set(nf_it, _naviframe_pop_cb, ad->win);

How do I pop the progress bar off when Genlist_B pulled its data?


Solution

  • Update I found a solution to the problem. I was on the right track with popping the item off the naviframe using

    nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, scroller, "empty");
    elm_naviframe_item_pop_cb_set(nf_it, _naviframe_pop_cb, ad->win);
    

    The changes that I made is inside of _naviframe_pop_cb

    static Eina_Bool _naviframe_pop_cb(void *data, Elm_Object_Item *it)
    {
        elm_naviframe_item_pop_to(local_ad->startview);
        return EINA_TRUE;
    }
    

    What this does is it jumps to a specified naviframe labeled as local_ad->startview and that was just simply set by means of setting the Elm_Object_Item inside of the genlist.

     nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, genlist, "empty");
    

    This worked for me.