Example usage for android.app ProgressDialog setIndeterminate

List of usage examples for android.app ProgressDialog setIndeterminate

Introduction

In this page you can find the example usage for android.app ProgressDialog setIndeterminate.

Prototype

public void setIndeterminate(boolean indeterminate) 

Source Link

Document

Change the indeterminate mode for this ProgressDialog.

Usage

From source file:jp.co.noxi.app.NXProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        final ProgressDialog dialog = mProgressDialog = new ProgressDialog(getActivity());
        dialog.setProgressStyle(mStyle);
        dialog.setIndeterminate(mIndeterminate);
        if (mMax > 0) {
            dialog.setMax(mMax);//  w  ww . j a v  a2 s .c om
        }
        if (mProgressVal > 0) {
            dialog.setProgress(mProgressVal);
        }
        if (mSecondaryProgressVal > 0) {
            dialog.setSecondaryProgress(mSecondaryProgressVal);
        }
        if (mMessage != null) {
            dialog.setMessage(mMessage);
        }
        if (mFormat != null) {
            dialog.setProgressNumberFormat(mFormat);
        }
        return dialog;
    } else {
        final ProgressDialogGB dialog = mProgressDialogGB = new ProgressDialogGB(getActivity());
        dialog.setProgressStyle(mStyle);
        dialog.setIndeterminate(mIndeterminate);
        if (mMax > 0) {
            dialog.setMax(mMax);
        }
        if (mProgressVal > 0) {
            dialog.setProgress(mProgressVal);
        }
        if (mSecondaryProgressVal > 0) {
            dialog.setSecondaryProgress(mSecondaryProgressVal);
        }
        if (mMessage != null) {
            dialog.setMessage(mMessage);
        }
        if (mFormat != null) {
            dialog.setProgressNumberFormat(mFormat);
        }
        return dialog;
    }
}

From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java

/**
 * Update beer on server/* ww w .  j a v a2s. c  o m*/
 */
private void updateBeer() {
    if (TextUtils.isEmpty(etAlcohol.getText().toString()) || TextUtils.isEmpty(etName.getText().toString())) {
        Toast.makeText(BeerActivity.this, R.string.fieldsEmpty, Toast.LENGTH_SHORT).show();
        return;
    }
    final ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMessage(getString(R.string.connecting));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();

    BeerRequest beerRequest = new BeerRequest();
    beerRequest.setAvb(Double.parseDouble(etAlcohol.getText().toString()));
    beerRequest.setName(etName.getText().toString());
    beerRequest.setDescription(etDescription.getText().toString());
    APIService.get().updateBeer(beerResponseEdit.getId(), beerRequest,
            new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) {
                @Override
                public void onResults(BeerResponse beerResponse) {
                    progressDialog.dismiss();
                    Toast.makeText(BeerActivity.this, R.string.beerSaved, Toast.LENGTH_SHORT).show();
                    setResult(RESULT_OK);
                    finish();
                }

                @Override
                public void onError(Throwable e) {
                    progressDialog.dismiss();
                    Toast.makeText(BeerActivity.this, R.string.error, Toast.LENGTH_SHORT).show();
                }
            });
}

From source file:com.ota.updates.activities.MainActivity.java

private void checkForUpdate() {
    final ProgressDialog loadingDialog = new ProgressDialog(mContext);
    loadingDialog.setIndeterminate(true);
    loadingDialog.setCancelable(false);/*  w w w  .j a  va 2  s.c  o m*/
    loadingDialog.setMessage(mContext.getResources().getString(R.string.loading));
    loadingDialog.show();

    new DownloadJson(mContext, new AsyncResponse() {
        @Override
        public void processFinish(Boolean output) {
            if (output) {
                new ParseJson(mContext, new AsyncResponse() {
                    @Override
                    public void processFinish(Boolean output) {
                        if (output) {
                            new CheckForUpdate(mContext, new AsyncResponse() {
                                @Override
                                public void processFinish(Boolean updateAvailability) {
                                    if (DEBUGGING) {
                                        Log.d(TAG, "Update availability is " + updateAvailability);
                                    }

                                    if (updateAvailability) {
                                        loadFragment(new AvailableFragment());
                                    } else {
                                        loadFragment(new CheckFragment());
                                    }

                                    String time = Utils.getTimeNow(mContext);
                                    Preferences.setUpdateLastChecked(mContext, time);

                                    loadingDialog.cancel();
                                }
                            }).execute();
                        } else {
                            loadingDialog.cancel();
                        }
                    }
                }).execute();
            } else {
                loadingDialog.cancel();
            }
        }
    }).execute();
}

From source file:com.almarsoft.GroundhogReader.SubscribeActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    if (id == ID_DIALOG_SEARCHING) {
        ProgressDialog searchDialog = new ProgressDialog(this);
        searchDialog.setMessage("Searching matching groups...");
        searchDialog.setIndeterminate(true);
        searchDialog.setCancelable(true);
        return searchDialog;
    }//from  ww  w. jav  a  2  s  . c  o  m

    return super.onCreateDialog(id);
}

From source file:com.almarsoft.GroundhogReader.ComposeActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    if (id == ID_DIALOG_POSTING) {
        ProgressDialog loadingDialog = new ProgressDialog(this);
        loadingDialog.setMessage(getString(R.string.posting_message));
        loadingDialog.setIndeterminate(true);
        loadingDialog.setCancelable(true);
        return loadingDialog;
    }/*  w  w w  .j a v  a2  s. c om*/

    return super.onCreateDialog(id);
}

From source file:com.example.parkhere.provider.AddSeekerRoleFragment.java

public void createSeekerProfileProcess(SeekerPayment seekerPayment, BillingAddress billingAddress,
        Vehicle vehicle) {//from  w  ww.  j av  a2s  .  c  om
    final ProgressDialog progressDialog = new ProgressDialog(rootView.getContext(),
            R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Adding Seeker Role...");
    progressDialog.show();

    Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create()).build();

    RequestInterface requestInterface = retrofit.create(RequestInterface.class);

    ServerRequest request = new ServerRequest();
    request.setOperation(Constants.ADD_SEEKER_ROLE_OPERATION);
    request.setUser(user);
    request.setSeekerPayment(seekerPayment);
    request.setBillingAddress(billingAddress);
    request.setVehicle(vehicle);
    Call<ServerResponse> response = requestInterface.operation(request);

    response.enqueue(new Callback<ServerResponse>() {
        @Override
        public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) {
            ServerResponse resp = response.body();

            if (resp.getResult().equals(Constants.SUCCESS)) {
                goToSeekerUserhomeScreen();
            }

            progressDialog.dismiss();
            Snackbar.make(create_sprof_scrollview, resp.getMessage(), Snackbar.LENGTH_LONG).show();
        }

        @Override
        public void onFailure(Call<ServerResponse> call, Throwable t) {
            progressDialog.dismiss();
            Snackbar.make(create_sprof_scrollview, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
        }
    });
}

From source file:ack.me.truconnectandroiddemo.DeviceInfoActivity.java

private void showDisconnectDialog() {
    final ProgressDialog dialog = new ProgressDialog(DeviceInfoActivity.this);
    String title = getString(R.string.disconnect_dialog_title);
    String msg = getString(R.string.disconnect_dialog_message);
    dialog.setIndeterminate(true);//Dont know how long disconnect could take.....
    dialog.setCancelable(false);//from  w  w  w .jav  a 2  s  .c om

    mDisconnectDialog = dialog.show(DeviceInfoActivity.this, title, msg);
    mDisconnectDialog.setCancelable(false);
}

From source file:com.pansapiens.occyd.Search.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_SEARCHING: {
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setTitle("Searching ...");
        dialog.setMessage("Searching ...");
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);/*  w w  w.j  a va  2  s .co m*/
        return dialog;
    }
    }
    return null;
}

From source file:com.ntsync.android.sync.activities.ImportProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.import_activity_progress));
    dialog.setIndeterminate(false);
    if (acInfo != null) {
        dialog.setMax(acInfo.getContactCount());
    }// w  w w.  j av  a 2s  .  co m
    return dialog;
}

From source file:com.ame.armymax.SearchActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);

    context = this;
    DataUser.context = context;//  ww  w  . j  av a2 s .c  o m
    aq = new AQuery(this);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setTitle("");

    query = getIntent().getStringExtra("query");

    searchBox = (BootstrapEditText) findViewById(R.id.room_name);
    searchBox.setText(query);

    searchButton = (Button) findViewById(R.id.search_button);
    searchButton.setVisibility(View.GONE);

    intent = new Intent(this, ProfileActivity.class);

    searchButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            query = searchBox.getEditableText().toString();

            if (!query.equals("")) {
                String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query
                        + "&startPoint=0&sizePage=50";
                ProgressDialog dialog = new ProgressDialog(context);
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                dialog.setInverseBackgroundForced(false);
                dialog.setCanceledOnTouchOutside(true);
                dialog.setTitle("Finding ...");
                Log.e("searchurl", resultUrl);
                newSearch = true;
                aq.progress(dialog).ajax(resultUrl, JSONObject.class, context, "newSearchResultCb");

            }

        }
    });

    searchBox.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            query = searchBox.getEditableText().toString();

            if (!query.equals("")) {
                String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query
                        + "&startPoint=0&sizePage=20";

                ProgressDialog dialog = new ProgressDialog(context);
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                dialog.setInverseBackgroundForced(false);
                dialog.setCanceledOnTouchOutside(true);
                dialog.setTitle("Finding ...");
                newSearch = true;
                Log.e("q", query);
                aq.ajax(resultUrl, JSONObject.class, context, "newSearchResultCb");
            }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

    String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query + "&startPoint=0&sizePage=50";
    aq.ajax(resultUrl, JSONObject.class, this, "searchResultCb");

}