Example usage for android.app ProgressDialog setTitle

List of usage examples for android.app ProgressDialog setTitle

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:de.gebatzens.sia.SetupActivity.java

public void startDownloadingSchool() {
    final ProgressDialog d = new ProgressDialog(this);
    d.setTitle(SIAApp.SIA_APP.school.name);
    d.setMessage(getString(R.string.downloading_image));
    d.setCancelable(false);/* www.  ja v a  2 s  .  co m*/
    d.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    d.show();

    new Thread() {
        @Override
        public void run() {
            if (!School.downloadImage(SIAApp.SIA_APP.school.image)) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Snackbar.make(getWindow().getDecorView().findViewById(R.id.coordinator_layout),
                                getString(R.string.download_error), Snackbar.LENGTH_LONG).show();
                    }
                });
            }

            //workaround for a bug that causes an endless loading screen
            Subst.GGPlans subst = SIAApp.SIA_APP.api.getPlans(false);
            subst.save();
            SIAApp.SIA_APP.school.fragments.getByType(FragmentData.FragmentType.PLAN).get(0).setData(subst);

            if (d.isShowing())
                d.dismiss();
            Intent i = new Intent(SetupActivity.this, MainActivity.class);
            //i.putExtra("reload", true);
            startActivity(i);
            finish();

        }
    }.start();
}

From source file:at.bitfire.davdroid.ui.CreateCollectionFragment.java

@NonNull
@Override//ww w.  ja  v  a 2 s  .  c om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progress = new ProgressDialog(getContext());
    progress.setTitle(R.string.create_collection_creating);
    progress.setMessage(getString(R.string.please_wait));
    progress.setIndeterminate(true);
    progress.setCanceledOnTouchOutside(false);
    setCancelable(false);
    return progress;
}

From source file:com.esri.arcgisruntime.sample.exporttiles.MainActivity.java

/**
 * Show progress UI elements.//from w w w .j av  a  2 s.  co  m
 *
 * @param exportTileCacheJob used to track progress and cancel when required
 */
private void createProgressDialog(ExportTileCacheJob exportTileCacheJob) {

    ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setTitle("Export Tile Cache Job");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel",
            (dialogInterface, i) -> exportTileCacheJob.cancel());
    progressDialog.show();

    exportTileCacheJob
            .addProgressChangedListener(() -> progressDialog.setProgress(exportTileCacheJob.getProgress()));
    exportTileCacheJob.addJobDoneListener(progressDialog::dismiss);
}

From source file:com.example.levelup.core.app.ProgressFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progressDialog = new ProgressDialog(getActivity());

    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(mLoaderId != LOADER_ID_NOT_SPECIFIED);
    progressDialog.setTitle(mTitle);
    progressDialog.setMessage(getText(mMessage));

    if (mLoaderId != LOADER_ID_NOT_SPECIFIED) {
        progressDialog.setOnCancelListener(new OnCancelListener() {
            @Override//  w  w w .j av a2  s . co  m
            public void onCancel(DialogInterface dialog) {
                getLoaderManager().destroyLoader(mLoaderId);
            }
        });
    }

    return progressDialog;
}

From source file:com.ubuntuone.android.files.fragment.ProgressDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ProgressDialog dialog = new ProgressDialog(getActivity());
    if (savedInstanceState != null) {
        title = savedInstanceState.getInt("title", -1);
        message = savedInstanceState.getInt("message", -1);
    }//  w w w . j av a  2  s .  c o m
    if (title != -1)
        dialog.setTitle(title);
    if (message != -1)
        dialog.setMessage(getString(message));
    setCancelable(false);
    return dialog;
}

From source file:com.tpb.projects.repo.fragments.RepoInfoFragment.java

@OnClick({ R.id.repo_license, R.id.repo_license_drawable, R.id.repo_license_text })
void showLicense() {
    if (mRepo.hasLicense()) {
        final ProgressDialog pd = new ProgressDialog(getContext());
        pd.setTitle(R.string.title_loading_license);
        pd.setMessage(mRepo.getLicenseName());
        pd.show();/*from  ww w .  j av  a 2s.c o  m*/
        mLoader.loadLicenseBody(new Loader.ItemLoader<String>() {
            @Override
            public void loadComplete(String data) {
                pd.dismiss();
                new AlertDialog.Builder(getContext()).setTitle(mRepo.getLicenseName()).setMessage(data)
                        .setPositiveButton(R.string.action_ok, null).create().show();
            }

            @Override
            public void loadError(APIHandler.APIError error) {
                pd.dismiss();
                Toast.makeText(getContext(), R.string.error_loading_license, Toast.LENGTH_SHORT).show();
            }
        }, mRepo.getLicenseUrl());
    }
}

From source file:com.esri.arcgisruntime.generateofflinemap.MainActivity.java

/**
 * Use the generate offline map job to generate an offline map.
 *//*from  ww w  .  j a  v a  2s.com*/
private void generateOfflineMap() {

    // create a progress dialog to show download progress
    ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setTitle("Generate Offline Map Job");
    progressDialog.setMessage("Taking map offline...");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(false);
    progressDialog.setProgress(0);

    // when the button is clicked, start the offline map task job
    mTakeMapOfflineButton.setOnClickListener(v -> {
        progressDialog.show();

        // delete any offline map already in the cache
        String tempDirectoryPath = getCacheDir() + File.separator + "offlineMap";
        deleteDirectory(new File(tempDirectoryPath));

        // specify the extent, min scale, and max scale as parameters
        double minScale = mMapView.getMapScale();
        double maxScale = mMapView.getMap().getMaxScale();
        // minScale must always be larger than maxScale
        if (minScale <= maxScale) {
            minScale = maxScale + 1;
        }
        GenerateOfflineMapParameters generateOfflineMapParameters = new GenerateOfflineMapParameters(
                mDownloadArea.getGeometry(), minScale, maxScale);

        // create an offline map offlineMapTask with the map
        OfflineMapTask offlineMapTask = new OfflineMapTask(mMapView.getMap());

        // create an offline map job with the download directory path and parameters and start the job
        GenerateOfflineMapJob job = offlineMapTask.generateOfflineMap(generateOfflineMapParameters,
                tempDirectoryPath);

        // replace the current map with the result offline map when the job finishes
        job.addJobDoneListener(() -> {
            if (job.getStatus() == Job.Status.SUCCEEDED) {
                GenerateOfflineMapResult result = job.getResult();
                mMapView.setMap(result.getOfflineMap());
                mGraphicsOverlay.getGraphics().clear();
                mTakeMapOfflineButton.setEnabled(false);
                Toast.makeText(this, "Now displaying offline map.", Toast.LENGTH_LONG).show();
            } else {
                String error = "Error in generate offline map job: " + job.getError().getAdditionalMessage();
                Toast.makeText(this, error, Toast.LENGTH_LONG).show();
                Log.e(TAG, error);
            }
            progressDialog.dismiss();
        });

        // show the job's progress with the progress dialog
        job.addProgressChangedListener(() -> progressDialog.setProgress(job.getProgress()));

        // start the job
        job.start();
    });

}

From source file:com.inaetics.demonstrator.MainActivity.java

/**
 * Method to start a progress dialog and a download task.
 * @param url   Url where to download from
 *///  www.j a va2 s . c  om
private void download(String url) {
    ProgressDialog progress = new ProgressDialog(this);
    progress.setTitle("Downloading");
    progress.setMessage("Wait while downloading");
    progress.show();

    DownloadTask task = new DownloadTask(this, progress);
    task.execute(url);
}

From source file:com.koushikdutta.superuser.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Settings.applyDarkThemeSetting(this, R.style.SuperuserDarkActivity);
    super.onCreate(savedInstanceState);

    if (Settings.getBoolean(this, "first_run", true)) {
        saveWhatsNew();//from w  ww.j a v a2  s. com
        Settings.setBoolean(this, "first_run", false);
    }

    final ProgressDialog dlg = new ProgressDialog(this);
    dlg.setTitle(R.string.superuser);
    dlg.setMessage(getString(R.string.checking_superuser));
    dlg.setIndeterminate(true);
    dlg.show();
    new Thread() {
        public void run() {
            boolean _error = false;
            try {
                SuHelper.checkSu(MainActivity.this);
            } catch (Exception e) {
                e.printStackTrace();
                _error = true;
            }
            final boolean error = _error;
            dlg.dismiss();
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (error) {
                        doInstall();
                    } else {
                        doWhatsNew();
                    }
                }
            });
        };
    }.start();
}

From source file:com.qddagu.app.meetreader.ui.MainActivity.java

/**
 * ?//from  www . j av  a2s  .co m
 * @param handler
 */
public void loadMeeting(final String url) {
    final ProgressDialog mLoadingDialog = new ProgressDialog(this);
    mLoadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mLoadingDialog.setTitle("??");
    mLoadingDialog.setMessage("??...");
    mLoadingDialog.setCancelable(false);
    mLoadingDialog.show();
    final Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            mLoadingDialog.dismiss();
            if (msg.what == 1) { //?
                Meeting meeting = ((Meeting) msg.obj);
                User user = meeting.getUser();
                if (user != null) {
                    //??
                    appContext.saveUserInfo(user);
                }
                appContext.setMeeting(meeting);//?
                appContext.saveHistory(meeting);//??

                UIHelper.showMeeting(MainActivity.this);
            } else if (msg.what == 0) { //
                UIHelper.ToastMessage(MainActivity.this, "");
            } else if (msg.what == -1 && msg.obj != null) {
                ((AppException) msg.obj).makeToast(MainActivity.this);
            }
        }
    };
    new Thread() {
        public void run() {
            Message msg = new Message();
            try {
                Meeting meeting = appContext.getMeeting(url);
                msg.what = (meeting != null && meeting.getId() > 0) ? 1 : 0;
                msg.obj = meeting;
            } catch (AppException e) {
                e.printStackTrace();
                msg.what = -1;
                msg.obj = e;
            }
            handler.sendMessage(msg);
        }
    }.start();
}