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) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:com.nextgis.firereporter.HttpGetter.java

@Override
protected void onPreExecute() {
    super.onPreExecute();
    if (mbShowProgress) {
        mDownloadDialog = new ProgressDialog(mContext);
        mDownloadDialog.setMessage(mDownloadDialogMsg);
        mDownloadDialog.show();//from  ww  w. j  a v a2 s  .c  o m
    }
}

From source file:com.aokp.romcontrol.github.tasks.GetJSONChangelogTask.java

protected void onPreExecute() {
    // start with a clean view, always
    mCategory.removeAll();/* w  w w . j av a  2s .com*/
    mCategory.setTitle(mContext.getString(R.string.loading_projects));
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(mAlertDialog.getContext());
        ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(R.drawable.octacat);
        mProgressDialog.show();
        mProgressDialog.setContentView(R.layout.github_octacat);
    }
}

From source file:com.zirconi.huaxiaclient.ScoreActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.score_layout);
    NUM = this.getIntent().getStringExtra("NUM");
    SharedPreferences temp = this.getSharedPreferences("LOGIN", MODE_PRIVATE);
    lv_score = (ListView) this.findViewById(R.id.score_lv_score);
    dialog = new ProgressDialog(this);
    dialog.setTitle("");
    dialog.setMessage("");
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.show();/* w w w .j a v  a 2  s.  c  o m*/
    ITEM_INFO = new ArrayList<Map<String, String>>();

    year = new ArrayList<String>();
    term = new ArrayList<String>();
    name = new ArrayList<String>();
    type = new ArrayList<String>();
    teacher = new ArrayList<String>();
    test = new ArrayList<String>();
    score = new ArrayList<String>();
    MKEscore = new ArrayList<String>();
    rescore = new ArrayList<String>();
    credit = new ArrayList<String>();

    if (temp.getBoolean("TEL", true)) {
        this.SCORE_PAGE = SharedApplication.HTTP_TEL_ADDR;
    } else {
        this.SCORE_PAGE = SharedApplication.HTTP_CER_ADDR;
    }

    new AsyncScore().execute(SCORE_PAGE);
}

From source file:com.frublin.androidoauth2.FsDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");

    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();/*  w w w  .j  a  v a  2s. co m*/
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT
            : DIMENSIONS_LANDSCAPE;
    addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
            (int) (dimensions[1] * scale + 0.5f)));
}

From source file:me.ziccard.secureit.async.upload.AuthenticatorTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(activity);
    dialog.setCancelable(false);/*ww w . ja  v a2s .c o  m*/
    dialog.setTitle("Authenticating");
    dialog.setMessage("Trying to authenticate");
    dialog.show();
}

From source file:com.lostad.app.base.util.DownloadUtil.java

public static void downFileAsyn(final Activity ctx, final String upgradeUrl, final String savedPath,
        final MyCallback<Boolean> callback) {
    final ProgressDialog xh_pDialog = new ProgressDialog(ctx);
    // ?/*from w w w.ja  v a  2 s .c  om*/
    xh_pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    // ProgressDialog 
    xh_pDialog.setTitle("???");
    // ProgressDialog???
    xh_pDialog.setMessage("...");
    // ProgressDialog
    // xh_pDialog.setIcon(R.drawable.img2);
    // ProgressDialog ??? false ??
    xh_pDialog.setIndeterminate(false);
    // ProgressDialog ?
    // xh_pDialog.setProgress(100);
    // ProgressDialog ???
    xh_pDialog.setCancelable(true);
    // ProgressDialog
    xh_pDialog.show();

    new Thread() {
        public void run() {

            boolean downloadSuccess = true;
            FileOutputStream fileOutputStream = null;
            try {
                Looper.prepare();
                HttpClient client = new DefaultHttpClient();
                HttpGet get = new HttpGet(upgradeUrl);

                File f = new File(savedPath);
                if (!f.exists()) {
                    f.createNewFile();
                }

                HttpResponse response = client.execute(get);
                HttpEntity entity = response.getEntity();
                // ?
                Long length = entity.getContentLength();
                xh_pDialog.setMax(length.intValue());
                //
                InputStream is = entity.getContent();
                fileOutputStream = null;

                if (is != null && length > 0) {

                    fileOutputStream = new FileOutputStream(f);

                    byte[] buf = new byte[1024];
                    int ch = -1;
                    int count = 0;
                    while ((ch = is.read(buf)) != -1) {

                        if (xh_pDialog.isShowing()) {
                            fileOutputStream.write(buf, 0, ch);
                            // ?
                            count += ch;
                            xh_pDialog.setProgress(count);
                        } else {
                            downloadSuccess = false;
                            break;// ?
                        }
                    }

                } else {
                    callback.onCallback(false);
                }

                if (downloadSuccess && fileOutputStream != null) {
                    xh_pDialog.dismiss();
                    fileOutputStream.flush();
                    fileOutputStream.close();
                    callback.onCallback(true);// ?
                }
                Looper.loop();
            } catch (FileNotFoundException e) {
                xh_pDialog.dismiss();
                e.printStackTrace();
                callback.onCallback(false);
                xh_pDialog.dismiss();
            } catch (Exception e) {
                xh_pDialog.dismiss();
                e.printStackTrace();
                callback.onCallback(false);
            } finally {
                try {
                    fileOutputStream.flush();
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }.start();

}

From source file:com.googlecode.android_scripting.ZipExtractorTask.java

public ZipExtractorTask(String in, String out, Context context, boolean replaceAll) throws Sl4aException {
    super();//from ww  w .j  a v  a2s. c om
    mInput = new File(in);
    mOutput = new File(out);
    if (!mOutput.exists()) {
        if (!mOutput.mkdirs()) {
            throw new Sl4aException("Failed to make directories: " + mOutput.getAbsolutePath());
        }
    }
    if (context != null) {
        mDialog = new ProgressDialog(context);
    } else {
        mDialog = null;
    }

    mContext = context;
    mReplaceAll = replaceAll;

}

From source file:com.mjhram.ttaxi.login_register.LoginActivity.java

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

    phpErrorMsgs = AppSettings.getInstance().getPhpErrorMsg();
    inputName = (EditText) findViewById(R.id.name);
    inputPassword = (EditText) findViewById(R.id.password);
    btnLogin = (Button) findViewById(R.id.btnLogin);
    btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen);
    setButtons(true);//from   w ww .j  a v a 2s  . c o  m
    // Progress dialog
    pDialog = new ProgressDialog(this);
    pDialog.setCancelable(false);

    //get GCM registeration ID:
    mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            //mRegistrationProgressBar.setVisibility(ProgressBar.GONE);
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            boolean sentToken = sharedPreferences.getBoolean(Constants.SENT_TOKEN_TO_SERVER, false);

            /*if (sentToken) {
            setButtons(true);
            } else {
            setButtons(false);
            }*/
        }
    };
    if (checkPlayServices()) {
        // Start IntentService to register this application with GCM.
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
    }
    // Session manager
    //session = new SessionManager(getApplicationContext());

    // Check if user is already logged in or not
    if (AppSettings.isLoggedIn()) {
        // User is already logged in. Take him to main activity
        Intent intent = new Intent(LoginActivity.this, com.mjhram.ttaxi.GpsMainActivity.class);
        //intent.putExtra(Constants.KEY_UID, AppSettings.getUid());
        //intent.putExtra(Constants.KEY_EMAIL, AppSettings.getEmail());
        startActivity(intent);
        finish();
    }

    // Login button Click Event
    btnLogin.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            String name = inputName.getText().toString();
            String password = inputPassword.getText().toString();
            //check for regId
            if (AppSettings.regId == null) {
                Toast.makeText(getApplicationContext(), getString(R.string.loginMsgNotRegistered),
                        Toast.LENGTH_LONG).show();
                finish();
            }
            // Check for empty data in the form
            if (name.trim().length() > 0 && password.trim().length() > 0) {
                // login user
                checkLogin(name, password);
            } else {
                // Prompt user to enter credentials
                Toast.makeText(getApplicationContext(), getString(R.string.loginMsgEnterCredentials),
                        Toast.LENGTH_LONG).show();
            }
        }

    });

    // Link to Register Screen
    btnLinkToRegister.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent i = new Intent(getApplicationContext(), RegisterActivity.class);
            startActivity(i);
            finish();
        }
    });
    //registerReceiver(registrationStatusReceiver, new IntentFilter(Constants.ACTION_REGISTER));
    //get registeration id
    //gcmUtil = new GcmUtil(getApplicationContext());
    //mRegistrationProgressBar = (ProgressBar) findViewById(R.id.registrationProgressBar);
    //mRegistrationProgressBar.setVisibility(View.VISIBLE);

}

From source file:com.aokp.romcontrol.github.tasks.GetCommitsInProjectTask.java

protected void onPreExecute() {
    // show commit after we load next set
    mCategory.setTitle(mContext.getString(R.string.loading_commits));
    mCategory.setOrderingAsAdded(true);//  w  ww . ja v  a  2s.c om
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(mAlertDialog.getContext());
        ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(R.drawable.octacat);
        mProgressDialog.show();
        mProgressDialog.setContentView(R.layout.github_octacat);
    }
}