box/box-android-apptoapp-sdk

BoxAuthentication progress bar

Opened this issue · 1 comments

The current implementation of BoxAuthentication activity gives a bad user experience. A user sees a white screen until the login form is loaded. Show a progress bur during the loading process:

    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mApiKey = getIntent().getStringExtra("API_KEY").trim();
        if (mApiKey == null || mApiKey.length() == 0) {
            setResult(AUTH_RESULT_FAIL);
            finish();
            return;
        }

        FrameLayout layout = new FrameLayout(this);
        layout.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        mLoginWebView = new WebView(this);
        mLoginWebView.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        mLoginWebView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                if (progress == 100) {
                    mLoginWebView.setVisibility(View.VISIBLE);
                    mProgressBar.setVisibility(View.GONE);
                }
            }
        });
        mLoginWebView.setVisibility(View.INVISIBLE);
        layout.addView(mLoginWebView);
        mProgressBar = new ProgressBar(this);
        mProgressBar.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER));
        layout.addView(mProgressBar);
        setContentView(layout);
...
}

same issue.

My proposal:

  • Show progress dialog when connecting in Box#getTicket(callback).
  • Show progress bar between WebView#onPageStarted() and WebView#onPageFinished.