Custom Dialog - Login - I want "modal" progress bar
<p>I have custom dialog for login in my application. I also added progressbar to it and made invisible. When user hits' button I call AsyncTask to process http login. I control progressbar from AsyncTask. All looks good, but while AsyncTask running - dialog completely responsive. I can change fields, I can click buttons, etc. I see 3 choices:</p>

<ol>
<li><p>Before running asynctask I will disable all controls. But how do I know when finished? Is there callback I can use?</p></li>
<li><p>Make login window Activity and show Progress dialog.</p></li>
<li><p>?</p></li>
</ol>

<p>Please let me know what is the proper way to handle this scenario</p>

<p>here is async task. I'm trying to make it generic where I pass url and body and return http response:</p>

<pre><code>private class RESTService extends AsyncTask&lt;String, Integer, String&gt;
    {
        //TODO: Add text to progress bar and add custom artwork
        ProgressBar progress;
        Dialog dialog;
        Activity activity;

        public RESTService(ProgressBar p, Dialog d, Activity a)
        {
            progress = p;
        }
        @Override
        protected String doInBackground(String... stuff)
        {
            String url = stuff[0];
            String post = stuff[1];

            try
            {
                Thread.sleep(15000);
            } catch (InterruptedException e)
            {
                e.printStackTrace();
            }

            return "done";
        }

        @Override
        protected void onPreExecute()
        {
            super.onPreExecute();

            if (dialog != null)
            {

            }

            if (progress != null)
            {
                progress.setVisibility(View.VISIBLE);

            }
        }

        @Override
        protected void onPostExecute(String s)
        {
            super.onPostExecute(s);

            if (progress != null)
            {
                progress.setVisibility(View.GONE);
            }
        }
    }
</code></pre>
