Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

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

Prototype

public ProgressDialog(Context context, int theme) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:Main.java

public static ProgressDialog loader(Context context) {
    ProgressDialog loader = new ProgressDialog(context, ProgressDialog.STYLE_SPINNER);
    loader.setIndeterminate(false);//from   w w  w  .  j  a va  2s.  c  o m
    loader.setCancelable(false);
    return loader;
}

From source file:com.gigathinking.simpleapplock.Upgrade.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_upgrade);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER);
    mDialog.setMessage(getString(R.string.processing));
    mDialog.show();/*  ww w .j  a  v a 2  s .  c  o  m*/
    findViewById(R.id.id_btn_upgrade).setOnClickListener(this);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    new GetSKUDetails().execute();
}

From source file:com.angelhack.person2person.AbstractGetNameTask.java

@Override
protected void onPreExecute() {
    // TODO Auto-generated method stub
    super.onPreExecute();

    dialog = new ProgressDialog(mActivity, R.style.StyledDialog);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setMessage(" Connecting with your account , Please Wait....");
    dialog.setIndeterminate(true);/*from w w  w .  ja  v a 2s .  c om*/
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:com.gigathinking.simpleapplock.ResetUnlockMethod.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_reset);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER);
    mDialog.setIndeterminate(true);//from w ww  .  j ava2s.  c o m
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    mResetReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            prefs.edit().putString(AppLockApplication.LOCKTYPE, AppLockApplication.LOCKTYPE_PIN).commit();
            prefs.edit()
                    .putString(AppLockApplication.PASSWORD, intent.getStringExtra(AppLockApplication.PASSWORD))
                    .commit();
            Toast.makeText(context, getString(R.string.pin_reset), Toast.LENGTH_LONG).show();
            startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)
                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
            //startActivity(new Intent(ResetUnlockMethod.this,UnlockWithPIN.class).putExtra("test","test"));
            finish();
        }
    };
    LocalBroadcastManager.getInstance(this).registerReceiver(mResetReceiver,
            new IntentFilter(AppLockApplication.RESET_UNLOCK));

    if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.register_complete),
            false)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(getString(R.string.reset_register_device));
        builder.setTitle(getString(R.string.info));
        builder.setPositiveButton(getString(R.string.register), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                new Register().execute();
                if (mDialog != null) {
                    mDialog.setMessage(getString(R.string.register_ongoing));
                    mDialog.show();
                }
                dialog.dismiss();
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                finish();
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_HOME);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });
        builder.create().show();
    } else {
        if (mDialog != null) {
            mDialog.setMessage(getString(R.string.connect_to_server));
            mDialog.show();
        }
        new DoRequestReset().execute();
    }
}

From source file:com.guess.license.plate.Task.LoadingTaskConn.java

/**
 * A Loading task that will load some resources that are necessary for the app to start
 * @param progressBar - the progress bar you want to update while the task is in progress
 * @param finishedListener - the listener that will be told when this task is finished
 *///from ww  w . j av a  2 s . c  om
public LoadingTaskConn(Context context, SplashActivity activity) {
    this.context = context;
    this.activity = activity;

    // Progress Dialog
    this.loadingDialog = new ProgressDialog(activity, android.R.style.Theme_Translucent);
    this.loadingDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.loadingDialog.setCancelable(false);
    if (!this.loadingDialog.isShowing()) {
        this.loadingDialog.show();
    }
    this.loadingDialog.setContentView(R.layout.custom_progress_dialog);
}

From source file:it.scoppelletti.mobilepower.app.ProgressDialogFragment.java

/**
 * Crea il dialogo.//from  w ww.j  av a  2  s  .com
 * 
 * @param  savedInstanceState Stato dell’istanza.
 * @return                    Dialogo.
 */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int max, resId;
    ProgressDialog dlg;
    Bundle args = getArguments();

    dlg = new ProgressDialog(getActivity(), AppUtils.getDialogTheme());

    resId = args.getInt(ProgressDialogFragment.ARG_TITLEID);
    dlg.setTitle(getString(resId));
    max = args.getInt(ProgressDialogFragment.ARG_MAX, -1);

    if (max > 0) {
        dlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dlg.setIndeterminate(false);
        dlg.setMax(max);
    } else {
        dlg.setIndeterminate(true);
        dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    }

    dlg.setCancelable(args.getBoolean(ProgressDialogFragment.ARG_CANCELABLE));
    dlg.setCanceledOnTouchOutside(false);

    return dlg;
}

From source file:gcm.play.android.samples.com.gcmquickstart.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getSupportActionBar().hide();//from  w ww .  j ava 2 s  . c om

    etUsername = (EditText) findViewById(R.id.etUsername);
    etPassword = (EditText) findViewById(R.id.etPassword);
    btnIniciarSesion = (Button) findViewById(R.id.btnIniciarSesion);
    cbRecordar = (CheckBox) findViewById(R.id.cbRecordar);

    progressDialog = new ProgressDialog(this, R.style.MyTheme);

    //Se establece como usuario la cuenta registrada por el usuario para que haga su inicio de sesin
    userName = UserData.getUserAccount(this);
    Log.d("USER_ACCOUNT_LOCAL", userName);
    etUsername.setText(userName);

    //Establece como no editable el edit text de Usuario
    etUsername.setKeyListener(null);

    //progressDialog = new ProgressDialog(this, R.style.MyTheme);
    progressDialog.setTitle("Registration ID");
    progressDialog.setMessage("Espere un momento...");
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
    mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            progressDialog.dismiss();
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            boolean sentToken = sharedPreferences.getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false);
            if (sentToken) {
                Toast.makeText(getApplicationContext(), getString(R.string.gcm_ready), Toast.LENGTH_LONG)
                        .show();

            } else {
                Toast.makeText(getApplicationContext(), getString(R.string.gcm_not_ready), Toast.LENGTH_LONG)
                        .show();

            }
        }
    };

    if (checkPlayServices()) {
        // Start IntentService to register this application with GCM.
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
    }

    //Evento click para iniciar sesin
    btnIniciarSesion.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startSession();
        }
    });

}

From source file:com.ztspeech.weibo.sdk.renren.view.RenrenDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    progress = new ProgressDialog(getContext(), R.style.mydialog);
    progress.requestWindowFeature(Window.FEATURE_NO_TITLE);
    progress.setMessage("...");
    progress.setCanceledOnTouchOutside(false);
    content = new LinearLayout(getContext());
    content.setOrientation(LinearLayout.VERTICAL);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (this.showTitle) {
        setUpTitle();//from   www .  jav  a 2s.c om
    }
    setUpWebView();

    Display display = getWindow().getWindowManager().getDefaultDisplay();
    float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(content, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
            (int) (dimensions[1] * scale + 0.5f)));
}

From source file:es.uma.lcc.tasks.DecryptionRequestTask.java

@Override
public void onPreExecute() {
    mProgressDialog = new ProgressDialog(mMainActivity, ProgressDialog.THEME_HOLO_DARK);
    mProgressDialog.setTitle(R.string.connectingServerDialog);
    mProgressDialog.setMessage(mMainActivity.getString(R.string.pleaseWaitDialog));
    mProgressDialog.setCancelable(false);
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.show();/*from   www . ja va2  s  . c o m*/
}