Java Code Examples for android.app.progressdialog#setIndeterminate()

The following examples show how to use android.app.progressdialog#setIndeterminate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DriveActivity.java    From biermacht with Apache License 2.0 6 votes vote down vote up
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    // Create the progress dialog view - displayed when connecting to Google APIs.
    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage("Connecting to Google APIs...");
    progressDialog.setIndeterminate(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setCancelable(false);

    // Create the connection driveClient.
    driveClient = new GoogleApiClient.Builder(this)
            .addApi(Drive.API)
            .addScope(Drive.SCOPE_FILE)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
  }
 
Example 2
Source File: SignUpActivity.java    From restaurant-bot with GNU General Public License v3.0 6 votes vote down vote up
public void signup() {
    if (!validate()) {
        onSignupFailed();
        return;
    }
    signUpButton.setEnabled(false);
    final ProgressDialog progressDialog = new ProgressDialog(SignUpActivity.this);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Бүртгэл үүсгэж байна...");
    progressDialog.show();

    // TODO: Implement your own signup logic here.
    new android.os.Handler().postDelayed(
            new Runnable() {
                public void run() {
                    onSignupSuccess();
                    progressDialog.dismiss();
                }
            }, 3000);
}
 
Example 3
Source File: UnlockActivity.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    File file = new File(getFilesDir() + "/" + GravityBoxSettings.FILE_THEME_DARK_FLAG);
    mDlgThemeId = file.exists() ? android.R.style.Theme_Material_Dialog :
        android.R.style.Theme_Material_Light_Dialog;
    super.onCreate(savedInstanceState);

    mHandler = new Handler();
    mReceiver = new GravityBoxResultReceiver(mHandler);
    mReceiver.setReceiver(this);
    Intent intent = new Intent();
    intent.setAction(SystemPropertyProvider.ACTION_GET_SYSTEM_PROPERTIES);
    intent.putExtra("receiver", mReceiver);
    intent.putExtra("settings_uuid", SettingsManager.getInstance(this).getOrCreateUuid());
    mProgressDialog = new ProgressDialog(
            new ContextThemeWrapper(UnlockActivity.this, mDlgThemeId));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setTitle(R.string.app_name);
    mProgressDialog.setMessage(getString(R.string.gb_startup_progress));
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();
    mHandler.postDelayed(mGetSystemPropertiesTimeout, 5000);
    sendBroadcast(intent);
}
 
Example 4
Source File: DownloadCartridgeActivity.java    From WhereYouGo with GNU General Public License v3.0 6 votes vote down vote up
public DownloadTask(final Context context, String username, String password) {
    super(context, username, password);
    progressDialog = new ProgressDialog(context);
    progressDialog.setMessage("");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMax(1);
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(false);

    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(arg0 -> {
        if (downloadTask != null && downloadTask.getStatus() != Status.FINISHED) {
            downloadTask.cancel(false);
            downloadTask = null;
            Log.i("down", "cancel");
            ManagerNotify.toastShortMessage(context, getString(R.string.cancelled));
        }
    });
}
 
Example 5
Source File: UpdaterActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //set activity
    setContentView(R.layout.activity_updater);
    this.mTheme = findTheme();
    setTheme(this.mTheme);

    textView = findViewById(R.id.updater);

    mProgressDialog = new ProgressDialog(UpdaterActivity.this) {
        //show warning on back pressed
        @Override
        public void onBackPressed() {
            showCancelDialog();
        }
    };
    mProgressDialog.setMessage(getString(R.string.download_started));
    mProgressDialog.setProgressNumberFormat(null);
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setCanceledOnTouchOutside(false);
}
 
Example 6
Source File: PlayerView.java    From qplayer-sdk with MIT License 5 votes vote down vote up
private void showWaitDialog () {
	m_dlgWait = new ProgressDialog(this);
	m_dlgWait.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	m_dlgWait.setMessage("wait...");
	m_dlgWait.setIndeterminate(false);
	m_dlgWait.setCancelable(true);
	m_dlgWait.show();
}
 
Example 7
Source File: GetChromium.java    From getChromium with GNU General Public License v3.0 5 votes vote down vote up
private void showProgress() {
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle(getString(R.string.progress_title));
    mProgressDialog.setMessage(getString(R.string.progress_detail));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setProgress(0);
    mProgressDialog.setProgressNumberFormat(null);
    mProgressDialog.setProgressPercentFormat(null);
    mProgressDialog.show();
}
 
Example 8
Source File: IndexerTask.java    From geopackage-mapcache-android with MIT License 5 votes vote down vote up
/**
 * Index features
 *
 * @param activity
 * @param callback
 * @param database
 * @param tableName
 * @param indexLocation
 */
public static void indexFeatures(Activity activity, IIndexerTask callback,
                                 String database, String tableName,
                                 FeatureIndexType indexLocation) {

    GeoPackageManager manager = GeoPackageFactory.getManager(activity);
    GeoPackage geoPackage = manager.open(database);

    FeatureDao featureDao = geoPackage.getFeatureDao(tableName);

    FeatureIndexManager indexer = new FeatureIndexManager(activity, geoPackage, featureDao);
    indexer.setIndexLocation(indexLocation);

    ProgressDialog progressDialog = new ProgressDialog(activity);
    final IndexerTask indexTask = new IndexerTask(activity,
            callback, progressDialog, geoPackage, indexer);

    int max = featureDao.count();
    indexTask.setMax(max);
    indexer.setProgress(indexTask);

    progressDialog.setMessage(activity
            .getString(R.string.geopackage_table_index_features_index_title)
            + ": "
            + geoPackage.getName() + " - " + tableName);
    progressDialog.setCancelable(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(false);
    progressDialog.setMax(max);
    progressDialog.setButton(ProgressDialog.BUTTON_NEGATIVE,
            activity.getString(R.string.button_cancel_label),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    indexTask.cancel(true);
                }
            });

    indexTask.execute();
}
 
Example 9
Source File: ManageSpaceFragment.java    From droidddle with Apache License 2.0 5 votes vote down vote up
public DeleteTask(int type) {
    mType = type;
    mDialog = new ProgressDialog(getActivity());
    mDialog.setCancelable(false);
    mDialog.setCanceledOnTouchOutside(false);
    if (mType == TYPE_CACHE) {
        mDialog.setIndeterminate(true);
        mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mDialog.setMessage(getString(R.string.dialog_delete_file));
    } else {
        mDialog.setTitle(R.string.dialog_delete_file);
        mDialog.setIndeterminate(false);
        mDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    }
}
 
Example 10
Source File: PostsAdapter.java    From Hify with MIT License 5 votes vote down vote up
protected void onPreExecute(){
    mProgressDialog=new ProgressDialog(context);
    mProgressDialog.setIndeterminate(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle("Please wait");
    mProgressDialog.setMessage("We are processing the image for sharing...");
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();
    mProgressDialog.setProgress(0);
}
 
Example 11
Source File: SaveTools.java    From Gallery-example with GNU General Public License v3.0 5 votes vote down vote up
protected void onPreExecute() {
    count = getLastInt(activity) + 1;
    progressDialog = new ProgressDialog(activity);
    progressDialog.setMessage(activity.getString(R.string.saving_crop));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(true);
    progressDialog.setProgressNumberFormat(null);
    progressDialog.setProgressPercentFormat(null);
    progressDialog.show();
}
 
Example 12
Source File: DownloadGif.java    From Android-GiphySearch with MIT License 5 votes vote down vote up
@Override
public void onPreExecute() {
    dialog = new ProgressDialog(activity);
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.setMessage(activity.getString(R.string.downloading));
    dialog.show();
}
 
Example 13
Source File: ProofActivity.java    From Mupdf with Apache License 2.0 5 votes vote down vote up
private static ProgressDialog createAndShowWaitSpinner(Context mContext)
{
	ProgressDialog dialog = new ProgressDialog(mContext);
	try {
		dialog.show();
	}
	catch (WindowManager.BadTokenException e) {
	}
	dialog.setCancelable(false);
	dialog.setIndeterminate(true);
	dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
	dialog.setContentView(R.layout.wait_spinner);
	return dialog;
}
 
Example 14
Source File: DownloadTask.java    From geopackage-mapcache-android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void onProgressUpdate(Integer... progress) {
    super.onProgressUpdate(progress);

    // If the indeterminate progress dialog is still showing, swap to a
    // determinate horizontal bar
    if (progressDialog.isIndeterminate()) {

        String messageSuffix = "\n\n"
                + GeoPackageIOUtils.formatBytes(max);

        ProgressDialog newProgressDialog = createDownloadProgressDialog(
                database, url, this, messageSuffix);
        newProgressDialog
                .setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        newProgressDialog.setIndeterminate(false);
        newProgressDialog.setMax(100);

        newProgressDialog.show();
        progressDialog.dismiss();
        progressDialog = newProgressDialog;
    }

    // Set the progress
    progressDialog.setProgress(progress[0]);
}
 
Example 15
Source File: NestedPreferenceFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    progress = new ProgressDialog(getActivity());
    progress.setTitle(getResources().getString(R.string.delete_offline));
    progress.setMessage(getResources().getString(R.string.loading_offline_message));
    progress.setIndeterminate(false);
    progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progress.setCancelable(false);
    progress.show();
}
 
Example 16
Source File: ProgressDialogTaskFragmentCallbacks.java    From edslite with GNU General Public License v2.0 5 votes vote down vote up
@NonNull
@Override
public android.app.Dialog onCreateDialog(Bundle savedInstanceState)
{
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getArguments().getString(ARG_DIALOG_TEXT));
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    return dialog;
}
 
Example 17
Source File: RemoteControllerActivity.java    From screenstandby with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
	RemoteAppPackages rap = mCore.getRemoteAppPackages();
	if (rap != null)
	{
		showAppDialog(rap);
	}
	else
	{
    	progressDialog = new ProgressDialog(RemoteControllerActivity.this);    
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER | ProgressDialog.THEME_HOLO_DARK);
        progressDialog.setTitle("Fetching app list");  
        progressDialog.setMessage("Requesting list of applications from remote device...");
        progressDialog.setCancelable(false);
        progressDialog.setIndeterminate(true);
        progressDialog.setIcon(R.drawable.launchappico);
        progressDialog.show();
        Runnable rCallback = new Runnable(){
			@Override
			public void run() {
					runOnUiThread(new Runnable() {
						@Override
						public void run() {
							RemoteAppPackages rap2 = mCore.getRemoteAppPackages();
							progressDialog.dismiss();
							if (rap2 != null)
								showAppDialog(rap2);
							else
								Toast.makeText(RemoteControllerActivity.this, "An error occurred during fetching app list", Toast.LENGTH_SHORT).show();
						}});
			}};
		mCore.requestRemoteAppPackages(rCallback);
	}
}
 
Example 18
Source File: ReadTask.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ReadTask(LuaEditor edit, File file) {
    _file = file;
    _len = _file.length();
    _edit = new WeakReference<>(edit);
    _dlg = new ProgressDialog(edit.getContext());
    _dlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    _dlg.setTitle(edit.getContext().getString(R.string.Opening));
    _dlg.setIcon(android.R.drawable.ic_dialog_info);
    _dlg.setIndeterminate(true);
}
 
Example 19
Source File: AdditTextActivity.java    From Quran-For-My-Android with Apache License 2.0 4 votes vote down vote up
public FileAdderTask(){
	//initialize progress dialog
	progressDialog=new ProgressDialog(AdditTextActivity.this);
	progressDialog.setIndeterminate(true);
	progressDialog.setMessage("Checking validity...");
}
 
Example 20
Source File: TrackExportDialog.java    From Androzic with GNU General Public License v3.0 4 votes vote down vote up
public void onClick(View v)
{
	final Activity activity = getActivity();
	final Androzic application = Androzic.getApplication();

	final ProgressDialog pd = new ProgressDialog(activity);
	pd.setIndeterminate(true);
	pd.setMessage(getString(R.string.msg_wait));
	pd.setCancelable(false);
	pd.show();

	new Thread(new Runnable() {
		public void run()
		{
			String name = nameText.getText().toString();
			String format = formatSpinner.getItemAtPosition(formatSpinner.getSelectedItemPosition()).toString();
			String filename = FileUtils.sanitizeFilename(name) + format;

			Calendar startTime = fromSliderContainer.getTime();
			startTime.set(Calendar.HOUR_OF_DAY, 0);
			startTime.set(Calendar.MINUTE, 0);
			startTime.set(Calendar.SECOND, 0);
			startTime.set(Calendar.MILLISECOND, 0);
			long start = startTime.getTimeInMillis();
			Calendar endTime = tillSliderContainer.getTime();
			endTime.set(Calendar.HOUR_OF_DAY, 23);
			endTime.set(Calendar.MINUTE, 59);
			endTime.set(Calendar.SECOND, 59);
			endTime.set(Calendar.MILLISECOND, 999);
			long end = endTime.getTimeInMillis();
			
			Track track = locationService.getTrack(start, end);
			List<Track.TrackPoint> points = track.getAllPoints();
			
			if (points.size() < 2)
			{
				activity.runOnUiThread(new Runnable() {
					public void run()
					{
						Toast.makeText(activity, R.string.msg_emptytracksegment, Toast.LENGTH_LONG).show();
					}
				});
				pd.dismiss();
				return;
			}

			SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
			track.name = name;
			track.width = prefs.getInt(getString(R.string.pref_tracking_linewidth), getResources().getInteger(R.integer.def_track_linewidth));
			track.color = color.getColor();

			try
			{
				File dir = new File(application.dataPath);
				if (!dir.exists())
					dir.mkdirs();
				File file = new File(dir, filename);
				if (!file.exists())
				{
					file.createNewFile();
				}
				if (file.canWrite())
				{
					if (".plt".equals(format))
					{
						OziExplorerFiles.saveTrackToFile(file, application.charset, track);
					}
					else if (".kml".equals(format))
					{
						KmlFiles.saveTrackToFile(file, track);
					}
					else if (".gpx".equals(format))
					{
						GpxFiles.saveTrackToFile(file, track);
					}
				}
				dismiss();
			}
			catch (Exception e)
			{
				Log.e("TrackExport", e.toString(), e);
				activity.runOnUiThread(new Runnable() {
					public void run()
					{
						Toast.makeText(activity, R.string.err_write, Toast.LENGTH_LONG).show();
					}
				});
			}
			pd.dismiss();
		}
	}).start();
}