Languages

Menu
Sites
Language
Sample progressbar not working

Im trying to create a sample application following the example in https://developer.tizen.org/ko/development/guides/native-application/user-interface/efl/ui-components/wearable-ui-components/circle-progressbar for wearable-4.0 but the text in the center of progress bar does not show at all as illustrated in the sample picture.

 

Im using the following code as instructed.

static void create_base_gui(appdata_s *ad) {
    /* Window */
    /* Create and initialize elm_win,
       which is mandatory to manipulate a window
    */
    ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
    elm_win_autodel_set(ad->win, EINA_TRUE);

    if (elm_win_wm_rotation_supported_get(ad->win)) {
        int rots[4] = {0, 90, 180, 270};
        elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
    }

    evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
    eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

    /* Conformant */
    /* Create and initialize elm_conformant,
       which is mandatory for the base UI to have a proper size
       when an indicator or virtual keypad is visible
    */
    ad->conform = elm_conformant_add(ad->win);
    elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE);
    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->win, ad->conform);
    evas_object_show(ad->conform);

    /* Naviframe */
    ad->naviFrame = elm_naviframe_add(ad->conform);
    evas_object_show(ad->naviFrame);
    elm_naviframe_prev_btn_auto_pushed_set(ad->naviFrame, EINA_TRUE);
    elm_object_content_set(ad->conform, ad->naviFrame);

    /* Starting right after the basic EFL UI layout code */
	/* (win - conformant - naviframe) */

	/* Set a circle surface */
	ad->circleSurface = eext_circle_surface_conformant_add(ad->conform);

	/* Add a layout and push the layout into the naviframe */
	/* EDJ_PATH is folder path, it contains the progressbar_circle.edj file */
	ad->progressBarLayout = elm_layout_add(ad->naviFrame);
	elm_layout_file_set(ad->progressBarLayout, "res/progressbar_circle.edj", "eext_progressbar_layout");
	evas_object_show(ad->progressBarLayout);
	elm_naviframe_item_push(ad->naviFrame, NULL, NULL, NULL, ad->progressBarLayout, NULL);

	/* Add a progressbar and set a circle surface to render the progressbar */
	ad->progressBar = eext_circle_object_progressbar_add(ad->progressBarLayout, ad->circleSurface);
	/*Set a minimum and maximum values */
	eext_circle_object_value_min_max_set(ad->progressBar, 0.0, 100.0);
	/* Set a progressbar value */
	eext_circle_object_value_set(ad->progressBar, 0);
	/* Set a part content */
	elm_object_part_content_set(ad->progressBarLayout, "elm.swallow.content", ad->progressBar);
	evas_object_show(ad->progressBar);

	/* Set a text */
	elm_object_part_text_set(ad->progressBarLayout, "elm.text.progressbar", "10");

	evas_object_show(ad->win);

}

and EDJ

collections {
   group {
      name: "eext_progressbar_layout";
      parts {
         part {
            name: "base";
            type: SPACER;
            scale: 1;
            description {
               state: "default" 0.0;
               min: 360 360;
               max: 360 360;
               fixed: 1 1;
            }
         }
         part {
            name: "elm.swallow.content";
            type: SWALLOW;
            scale: 1;
            description {
               state: "default" 0.0;
               rel1.to: "base";
               rel2.to: "base";
            }
         }
         part {
            name: "elm.text.progressbar";
            type: TEXT;
            scale: 1;
            description {
               state: "default" 0.0;
               fixed: 1 1;
               rel1.to: "base";
               rel2.to: "base";
               rel1.relative: 0.5 0.5;
               rel2.relative: 0.5 0.5;
               text {
                  font: "Tizen:style=Regular";
                  size: 50;
                  min: 1 1;
                  ellipsis: -1;
               }
               color: 255 255 255 255;
            }
         }
      }
   }
}

Can you see any issue with my implementation? I tried both in emu. and Galaxy watch.

Responses

1 Replies
woochan lee

Hello.

 

Well done with progress bar creation.

But eext_progressbar doesn't move automatically.
It is a widget that aims to receive a callback, perform a specific action, and show progress as much as it is performed.

lacked guides :(

 

/**
 * @brief Callback for timer to update value of a progressbar.
 *
 * @param[in] data The user data for progressbar sample
 */
static Eina_Bool
_progressbar_timer_cb(void *data)
{
        double progress_1;
	char buf[PATH_MAX];
	Progressbar_Data *pd = (Progressbar_Data *)data;

	/* Gets current progress value to increase */
	progress = eext_circle_object_value_get(pd->progressbar);
	progress += 0.5;

	if (progress > 100)
		progress = 0.0;

	/* Sets increased value as new progress */
	eext_circle_object_value_set(pd->progressbar, progress);

	snprintf(buf, sizeof(buf), "%d %%", (int) progress);
	/* Sets the text of an object for showing current value. */
	elm_object_part_text_set(pd->layout, "elm.text.progressbar", buf);

	return ECORE_CALLBACK_RENEW;
}

/* Registers a timer callback function for updating value of progressbar. */
Ecore_timer *timer = ecore_timer_add(0.05, _progressbar_timer_cb, User_Data);