Example usage for android.widget ProgressBar setVisibility

List of usage examples for android.widget ProgressBar setVisibility

Introduction

In this page you can find the example usage for android.widget ProgressBar setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:at.alladin.rmbt.android.map.RMBTMapFilterFragment.java

/**
* 
*/// ww w  .  j  a  va2 s .  c  o m
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {

    view = inflater.inflate(R.layout.map_filter, container, false);

    final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar);

    progressBar.setVisibility(View.VISIBLE);

    // /

    recheckRunnable = new Runnable() {
        @Override
        public void run() {
            final RMBTMainActivity activity = getRMBTMainActivity();
            if (activity.getMapOptions() == null) {
                activity.fetchMapOptions();
                handler.postDelayed(recheckRunnable, 500);
            } else {
                progressBar.setVisibility(View.GONE);
                options = activity.getMapOptions();
                populateList(options.getRootOptions(), true);
            }
        }
    };
    recheckRunnable.run();

    view.setFocusableInTouchMode(true);
    view.requestFocus();
    view.setOnKeyListener(this);

    return view;
}

From source file:com.somethoughts.chinmay.game.Dice.DiceFragment.java

void spin() {
    if (inProgress) {
        Toast.makeText(getActivity(), "Please Wait", Toast.LENGTH_SHORT).show();
        return;//from   w  w  w. j a v  a 2  s  .co  m
    }
    Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myfnt.ttf");
    final TextView textView = (TextView) view.findViewById(R.id.dice_result_textview);
    final TextView textViewrun = (TextView) view.findViewById(R.id.result_textView_run);
    final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.dice_progressBar);
    progressBar.setIndeterminate(false);
    progressBar.setMax(3000);
    textView.setTypeface(custom_font);
    textViewrun.setTypeface(custom_font);
    progressBar.setVisibility(View.VISIBLE);

    countDownTimer = new CountDownTimer(3000, 250) {
        @Override
        public void onTick(long l) {
            inProgress = true;
            Random random = new Random();

            progressBar.setProgress(3000 - (int) l);

            Log.v("Progress", Integer.toString(progressBar.getProgress()));
            textViewrun.setVisibility(View.VISIBLE);
            textViewrun.setText("Waiting");
            textView.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
            textView.setText(Integer.toString(random.nextInt(6) + 1));
        }

        @Override
        public void onFinish() {
            inProgress = false;
            view.setBackgroundColor(getResources().getColor(R.color.colorWin));
            textViewrun.setText("Here you go");
            progressBar.setProgress(3000);
            return;
        }
    }.start();
}

From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java

/**
 * Show progressBar//from   w  w  w . j  a va 2  s. c  o m
 *
 * @see #hideProgressBar
 */
@UiThread
public void showProgressBar() {
    ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.progress_bar);
    if (progressBar != null) {
        progressBar.setVisibility(View.VISIBLE);
    }
}

From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java

/**
 * Hide progressBar//from  w  w w.  j a va2  s  .  co  m
 *
 * @see #showProgressBar
 */
@UiThread
public void hideProgressBar() {
    ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.progress_bar);
    if (progressBar != null) {
        progressBar.setVisibility(View.GONE);
    }
}

From source file:eu.inmite.apps.smsjizdenka.framework.about.PlayServicesLicenceDialogFragment.java

private View getCustomView() {
    View customView = LayoutInflater.from(getActivity()).inflate(R.layout.view_licence_dialog, null);
    final TextView txtEulaContent = (TextView) customView.findViewById(R.id.txt_content);
    final ProgressBar progress = (ProgressBar) customView.findViewById(R.id.progress_bar);

    new BaseAsyncTask() {
        String licence;/*from ww  w.  j  a v a  2s  .  co  m*/

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            if (isAdded()) {
                progress.setVisibility(View.VISIBLE);
            }

        }

        @Override
        public void doInBackground() {
            licence = getPlayServicesLicense();
        }

        @Override
        public void onPostExecute() {
            super.onPostExecute();
            if (isAdded()) {
                progress.setVisibility(View.GONE);
                txtEulaContent.setText(licence);
            }

        }
    }.start();

    return customView;
}

From source file:com.coinblesk.client.wallet.WalletAddressList.java

private void startProgress() {
    ProgressBar progressBar = getProgressBar();
    if (progressBar != null) {
        progressBar.setVisibility(View.VISIBLE);
    }/*from   w  w  w . j  a v  a2  s.co  m*/
}

From source file:com.coinblesk.client.wallet.WalletAddressList.java

private void stopProgress() {
    ProgressBar progressBar = getProgressBar();
    if (progressBar != null) {
        progressBar.setVisibility(View.GONE);
    }/*from  w  ww.  j a v  a2s .c  o  m*/
}

From source file:com.tdispatch.passenger.fragment.OAuthFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*  w ww  . java2 s  .c o  m*/
protected void onPostCreateView() {

    View v = mFragmentView.findViewById(R.id.button_cancel);
    v.setOnClickListener(mOnClickListener);

    ProgressBar pb = (ProgressBar) mFragmentView.findViewById(R.id.progressbar);
    pb.setVisibility(View.GONE);

    mWebView = (WebView) mFragmentView.findViewById(R.id.webview);
    if (mWebView != null) {

        mWebView.setWebViewClient(new MyWebViewClient());
        mWebView.setWebChromeClient(new MyWebchromeClient());

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            mWebView.setOnTouchListener(mOnTouchListener);
        }

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        webSettings.setAppCacheEnabled(false);
        webSettings.setSavePassword(false);
        webSettings.setSaveFormData(false);

        CookieSyncManager.createInstance(mContext);
        CookieManager cm = CookieManager.getInstance();
        cm.setAcceptCookie(true);
        cm.removeAllCookie();

        try {
            ApiRequest req = new ApiRequest(Const.Api.OauthAuthUrl);
            req.addGetParam("key", Const.getApiKey());
            req.addGetParam("scope", "");
            req.addGetParam("response_type", "code");
            req.addGetParam("client_id", Const.getOAuthClientId());
            req.addGetParam("redirect_uri", mOAuthRedirectUrl);
            req.buildRequest();

            String url = req.getUrl();

            mWebView.loadUrl(url);

        } catch (Exception e) {
            WebnetLog.e("Failed to load oauth launch page...");
        }

    } else {
        WebnetLog.e("Failed to init WebView. Aborting");
        mHostActivity.oAuthCancelled();
    }
}

From source file:com.qjdchina.qjdsale.MemberPicturePlusFragment.java

private void clickProcess(View view, String folder, String file) {
    if (view.getTag().equals(0)) {
        startCamera(folder, file);/*from w ww  .ja v  a2s .co  m*/
    } else {

        Dialog dialog = new MemberPictureDialog(getActivity(), R.style.dialog_center);
        dialog.show();
        ImageView iv = (ImageView) dialog.findViewById(R.id.iv_dialog_member);
        ProgressBar pb = (ProgressBar) dialog.findViewById(R.id.pb_dialog_member);
        Bitmap bp = getImage(folder + file, 1024);
        iv.setImageBitmap(bp);
        pb.setVisibility(View.INVISIBLE);

        Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.androchill.call411.MainActivity.java

@Override
public void onLoadFinished(Loader<List<Phone>> loader, final List<Phone> data) {
    ProgressBar progress = (ProgressBar) findViewById(R.id.progress);
    progress.setVisibility(View.GONE);
    if (data == null) {
        Log.d("Download phones", "Null result");
        Toast.makeText(this, "Failed to load phone database!", Toast.LENGTH_SHORT).show();
    } else {//from  ww  w.  j  av  a2 s .  c o m
        Log.d("Download phones", "Load finished");
        mAdapter.setDataset(data);
        Toast.makeText(this, "Loaded " + data.size() + " phones", Toast.LENGTH_SHORT).show();
    }
}