Skip to content

5. Progress control

Andrii Konovalenko edited this page Apr 12, 2017 · 5 revisions

About progress control

EasyNet library provides convenient opportunity works with progress view, which will be shows or hides while request executing. For this use bind() method.

Example:

EasyNet.get("path").bind(progressBar).start(callback);

Method bind() has many overloads, consider some of them:

public Request bind(ProgressBar progressBar) - progressBar (ProgressBar and any other view) that will be shown during the request execution and hidden after.

public Request bind(Dialog progressDialog) - progress dialog that will be shown during the request execution and hidden after.

public Request bind(SwipeRefreshLayout swipeRefreshLayout) - SwipeRefreshLayout instance that will be activated during the request execution and hidden after.

public Request bind(ProgressBar progressBar, View... viewsToHide) - All of the above methods have such an overload, in which you can specify the view, which will hide during the request execution and will be displayed after.

New function

public Request bind(View view, BindParams params) - view, which participates in the request. BindParams - view behaviour options.

Example usage:

EasyNet.get("path").bind(view, 
       new BindParams(BindParams.Type.HIDE_AND_SHOW_AFTER, BindParams.Extra.ALWAYS));

Clone this wiki locally