At my app I'm using retrofit2 library for sending request to my server. One of parts of the application has to send messages to some addresses. After clicking "Submit" button I show custom progress dialog at my dialog view:

 private void showDialog() {
        final Dialog dialog = new Dialog(mcontext);
        dialog.setContentView(R.layout.progress_dialog);
        Objects.requireNonNull(dialog.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

        CircleProgressBar circleProgressBar = dialog.findViewById(R.id.progressBar);
        circleProgressBar.setColorSchemeColors(Color.RED, Color.GREEN, Color.BLUE, Color.CYAN, Color.YELLOW, Color.MAGENTA);

        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(false);
        dialog.show();
    } 

but as I see it is very boring to see on this progress bar and I have decided to show circle progress bar with percentage. I think it will help all users to get to know how long they have to wait. So, as I understood I have to divide all time for sending full request with response for several parts and then show percentage for this time sections. How I can do it or my solution is totally wrong and I have to find the another one? Thank you for your help :)

UPDATE:

Possible duplicate of my question - this but I don't send files to server. I'm sending json data.

0 Answers