Example usage for android.view Window PROGRESS_VISIBILITY_ON

List of usage examples for android.view Window PROGRESS_VISIBILITY_ON

Introduction

In this page you can find the example usage for android.view Window PROGRESS_VISIBILITY_ON.

Prototype

int PROGRESS_VISIBILITY_ON

To view the source code for android.view Window PROGRESS_VISIBILITY_ON.

Click Source Link

Document

Flag for setting the progress bar's visibility to VISIBLE.

Usage

From source file:Main.java

public static void setSpinnerState(Activity a) {
    if (isMediaScannerScanning(a)) {
        // start the progress spinner
        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_INDETERMINATE_ON);

        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
    } else {//from  w  w  w.j av a2  s.c  om
        // stop the progress spinner
        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_VISIBILITY_OFF);
    }
}

From source file:org.projecthdata.hhub.ui.HDataWebOauthActivity2.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
    webView = new WebView(this);
    setContentView(webView);//from   w  ww.  j  ava2s.c o m
    activity = this;
    this.hDataConnectionFactory = new HDataConnectionFactory(clientId, clientSecret, "server here");
    webView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView view, int progress) {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);
            if (progress == 100) {
                activity.setTitle(R.string.app_name);
            }
        }
    });
    webView.setWebViewClient(new MyWebViewClient());

}

From source file:com.springsource.greenhouse.WebOAuthActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

    connectionRepository = application.getConnectionRepository();
    connectionFactory = application.getConnectionFactory();
}

From source file:org.projecthdata.hhub.ui.HDataWebOauthActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
    super.onCreate(savedInstanceState);

    webView = new WebView(this);
    setContentView(webView);/*from   w w  w. j  a  v  a 2s.co m*/
    this.ehrUrl = getIntent().getStringExtra(EXTRA_EHR_URL);

    activity = this;

    this.connectionRepository = getApplicationContext().getConnectionRepository();
    this.hDataConnectionFactory = getApplicationContext().getHDataConnectionFactory(ehrUrl);

    webView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView view, int progress) {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);
            if (progress == 100) {
                activity.setTitle(R.string.app_name);
            }
        }
    });
    webView.setWebViewClient(new MyWebViewClient());

    // clear out any previously used credentials
    webView.clearCache(true);
    webView.clearFormData();
    webView.clearHistory();
    webView.getSettings().setSavePassword(false);
    webView.getSettings().setSaveFormData(false);
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeAllCookie();
}

From source file:au.com.wallaceit.reddinator.TabWebFragment.java

@SuppressLint("SetJavaScriptEnabled")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = this.getActivity();
    if (container == null) {
        return null;
    }//from   ww  w  . j a v  a  2 s .c o  m
    if (mFirstTime) {
        // get shared preferences
        SharedPreferences prefs = PreferenceManager
                .getDefaultSharedPreferences(this.getActivity().getApplicationContext());
        // work out the url this instance should load
        boolean commentswv = false;
        if (this.getArguments() != null) {
            commentswv = this.getArguments().getBoolean("loadcom", false);
        }

        int fontsize;
        String url;
        if (commentswv) {
            url = "http://reddit.com" + getActivity().getIntent().getStringExtra(WidgetProvider.ITEM_PERMALINK)
                    + ".compact";
            fontsize = Integer.parseInt(prefs.getString("commentfontpref", "22"));
        } else {
            url = getActivity().getIntent().getStringExtra(WidgetProvider.ITEM_URL);
            fontsize = Integer.parseInt(prefs.getString("contentfontpref", "18"));
        }
        // setup progressbar
        mActivity = this.getActivity();
        mActivity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
        ll = (LinearLayout) inflater.inflate(R.layout.tab1, container, false);
        mWebView = (WebView) ll.findViewById(R.id.webView1);
        // fixes for webview not taking keyboard input on some devices
        mWebView.requestFocus(View.FOCUS_DOWN);
        mWebView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_UP:
                    if (!v.hasFocus()) {
                        v.requestFocus();
                    }
                    break;
                }
                return false;
            }
        });
        mWebView.getSettings().setJavaScriptEnabled(true); // enable ecmascript
        mWebView.getSettings().setSupportZoom(true);
        mWebView.getSettings().setUseWideViewPort(true);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.getSettings().setDisplayZoomControls(true);
        mWebView.getSettings().setDefaultFontSize(fontsize);
        mChromeClient = newchromeclient;
        mWebView.setWebChromeClient(mChromeClient);
        mWebView.setWebViewClient(new WebViewClient());
        mWebView.loadUrl(url);
        mFirstTime = false;
        //System.out.println("Created fragment");
    } else {
        ((ViewGroup) ll.getParent()).removeView(ll);
    }

    return ll;
}

From source file:com.google.android.demos.jamendo.widget.StatusViewManager.java

private void updateWindowIndeterminateProgress() {
    // Show an indeterminate progress spinner when something is loading,
    // unless the main loading view is already visible.
    mWindow.setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            mActive.size() != 0 && mLoading.getVisibility() != View.VISIBLE ? Window.PROGRESS_VISIBILITY_ON
                    : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:com.google.android.demos.atom.app.FeedActivity.java

private void setWindowIndeterminateProgressVisible(boolean value) {
    getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            value ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

@Override
void setSupportProgressBarVisibility(boolean visible) {
    updateProgressBars(visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

@Override
void setSupportProgressBarIndeterminateVisibility(boolean visible) {
    updateProgressBars(visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *//*from   ww w .  j  a va2  s .c  o  m*/
private void updateProgressBars(int value) {
    ProgressBar circularProgressBar = getCircularProgressBar();
    ProgressBar horizontalProgressBar = getHorizontalProgressBar();

    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if (mFeatureProgress) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if (mFeatureProgress) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    }
}