List of usage examples for android.widget ProgressBar setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.ros.android.app_chooser.ExchangeActivity.java
public void installApp(View view) { final ExchangeActivity activity = this; showDialog(INSTALL_DIALOG);/* w ww . j a v a2 s. c o m*/ appManager.installApp(appSelected, new ServiceResponseListener<InstallApp.Response>() { @Override public void onSuccess(InstallApp.Response message) { if (!message.installed) { final String errorMessage = message.message; runOnUiThread(new Runnable() { @Override public void run() { new AlertDialog.Builder(activity).setTitle("Error on Installation!") .setCancelable(false).setMessage("ERROR: " + errorMessage) .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).create().show(); } }); } runOnUiThread(new Runnable() { @Override public void run() { ProgressBar progress_bar = (ProgressBar) dialog.findViewById(R.id.progress_bar); progress_bar.setVisibility(View.GONE); button.setVisibility(View.VISIBLE); } }); } @Override public void onFailure(final RemoteException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { new AlertDialog.Builder(activity).setTitle("Error on Installation!").setCancelable(false) .setMessage("Failed: cannot contact robot: " + e.toString()) .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).create().show(); removeDialog(INSTALL_DIALOG); } }); } }); }
From source file:de.geeksfactory.opacclient.frontend.AccountEditActivity.java
public void setProgress(boolean show, boolean animate) { ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar); View content = findViewById(R.id.svAccount); if (show) {/*from w w w . j ava 2s.com*/ if (animate) { progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); } else { progress.clearAnimation(); content.clearAnimation(); } progress.setVisibility(View.VISIBLE); content.setVisibility(View.GONE); } else { if (animate) { progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); } else { progress.clearAnimation(); content.clearAnimation(); } progress.setVisibility(View.GONE); content.setVisibility(View.VISIBLE); } }
From source file:com.sina.weibo.sdk.demo.sample.activity.TestFragment.java
public void showLargeImg(final Context context, final String url) { View view = LayoutInflater.from(context).inflate(R.layout.img_large, null); final ZoomImageView zoomImageView = (ZoomImageView) view.findViewById(R.id.id_iv_large); final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.id_pb_load); alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setView(view);//w ww .j av a2 s. c o m alertDialog.show(); progressBar.setVisibility(View.VISIBLE); Target target = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Log.d("", "?" + bitmap.toString()); progressBar.setVisibility(View.GONE); zoomImageView.setImageBitmap(bitmap, iZoomViewListener); zoomImageView.setVisibility(View.VISIBLE); } @Override public void onBitmapFailed(Drawable errorDrawable) { } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { Log.d("", "onPrepareLoad"); } }; zoomImageView.setTag(target); Picasso.with(context).load(url).into(target); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.cancel(); progressBar.setVisibility(View.GONE); } }); }
From source file:com.airad.zhonghan.ui.components.ImageWorker.java
public void loadImage(Object data, ImageView imageView, ProgressBar progressBar) { if (data == null) { return;/*from w ww . j a v a 2 s. co m*/ } Bitmap bitmap = null; if (mImageCache != null) { bitmap = mImageCache.getBitmapFromMemCache(String.valueOf(data)); } if (bitmap != null) { // Bitmap found in memory cache imageView.setImageBitmap(bitmap); if (progressBar != null) { progressBar.setVisibility(View.INVISIBLE); } } else if (cancelPotentialWork(data, imageView)) { final BitmapWorkerTask task = new BitmapWorkerTask(imageView, progressBar); final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task); imageView.setImageDrawable(asyncDrawable); task.execute(data); if (progressBar != null) { progressBar.setVisibility(View.INVISIBLE); } } }
From source file:jahirfiquitiva.iconshowcase.activities.AltWallpaperViewerActivity.java
@Override protected void onResume() { super.onResume(); ProgressBar spinner = (ProgressBar) findViewById(R.id.progress); if (spinner != null) spinner.setVisibility(View.GONE); reshowFab(fab);/*from w w w . j a v a 2 s . c o m*/ setupFullScreen(); }
From source file:com.facebook.GraphObjectAdapter.java
private View getActivityCircleView(View convertView, ViewGroup parent) { View result = (View) convertView; if (result == null) { result = (View) inflater.inflate(R.layout.com_facebook_picker_activity_circle_row, null); }/*from www .j a v a 2s. c o m*/ ProgressBar activityCircle = (ProgressBar) result .findViewById(R.id.com_facebook_picker_row_activity_circle); activityCircle.setVisibility(View.VISIBLE); return result; }
From source file:com.glanznig.beepme.view.ExportActivity.java
private void populateFields() { BeeperApp app = (BeeperApp) getApplication(); if (app.getPreferences().exportRunningSince() == 0L || (Calendar.getInstance().getTimeInMillis() - app.getPreferences().exportRunningSince()) >= 120000) { //2 min enableDisableView(findViewById(R.id.export_settings), true); CheckBox rawExp = (CheckBox) findViewById(R.id.export_raw); rawExp.setChecked(rawExport);//from w w w . j av a2s .c om rawExp.setOnClickListener(this); CheckBox photoExp = (CheckBox) findViewById(R.id.export_photos); View photoExpGroup = findViewById(R.id.export_photos_group); if (PhotoUtils.isEnabled(ExportActivity.this)) { photoExp.setVisibility(View.VISIBLE); photoExpGroup.setVisibility(View.VISIBLE); File[] photos = PhotoUtils.getPhotos(ExportActivity.this); if (photos != null && photos.length > 0) { photoExp.setEnabled(true); photoExp.setChecked(photoExport); photoExp.setOnClickListener(this); enableDisableView(photoExpGroup, photoExport); } else { photoExp.setChecked(false); photoExp.setEnabled(false); enableDisableView(photoExpGroup, false); } downscalePhotos = (Spinner) findViewById(R.id.export_downscale_photos); downscaleAdapter = new ArrayAdapter<CharSequence>(ExportActivity.this, android.R.layout.simple_spinner_item, new ArrayList<CharSequence>()); downscaleAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); downscalePhotos.setAdapter(downscaleAdapter); downscalePhotos.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { densityItem = position; Bundle opts = new Bundle(); opts.putBoolean("photoExport", photoExport); opts.putBoolean("rawExport", rawExport); estimatedSize.setText(String.format(getString(R.string.export_archive_estimated_size), exporter.getReadableArchiveSize(opts, densityFactors.get(downscalePhotos.getSelectedItemPosition()).intValue()))); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if (photoAvgSize == 0) { File[] photoFiles = PhotoUtils.getPhotos(ExportActivity.this); int count; int overallSize = 0; for (count = 0; count < photoFiles.length; count++) { overallSize += photoFiles[count].length(); } if (count > 0) { photoAvgSize = overallSize / count; } } if (photoAvgDensity == 0) { new Thread(new PhotoDimRunnable(ExportActivity.this, new PhotoDimHandler(ExportActivity.this))) .start(); } else { TextView density = (TextView) findViewById(R.id.export_photos_avg_size); density.setText( getString(R.string.export_photos_avg_size, String.format("%.1f", photoAvgDensity))); downscaleAdapter.add(String.format(getString(R.string.export_downscale_original_size), DataExporter.getReadableFileSize(photoAvgSize, 0))); densityFactors.add(Integer.valueOf(1)); int densityFactor = 2; for (; (Math.round((photoAvgDensity / densityFactor) * 2) / 2f) > 1; densityFactor *= 2) { downscaleAdapter.add(String.format(getString(R.string.export_downscale), String.format("%.1f", Math.round((photoAvgDensity / densityFactor) * 2) / 2f), DataExporter.getReadableFileSize(photoAvgSize / densityFactor, 0))); densityFactors.add(Integer.valueOf(densityFactor)); } downscaleAdapter.add(String.format(getString(R.string.export_downscale), String.valueOf(1), DataExporter.getReadableFileSize(photoAvgSize / densityFactor, 0))); densityFactors.add(Integer.valueOf(densityFactor)); if (densityItem != -1) { downscalePhotos.setSelection(densityItem); } } } else { photoExp.setVisibility(View.GONE); photoExpGroup.setVisibility(View.GONE); } postActions = (Spinner) findViewById(R.id.export_post_actions); ArrayAdapter<CharSequence> actionsAdapter = ArrayAdapter.createFromResource(this, R.array.post_export_actions, android.R.layout.simple_spinner_item); actionsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); postActions.setAdapter(actionsAdapter); if (postActionItem != -1) { postActions.setSelection(postActionItem); } estimatedSize = (TextView) findViewById(R.id.export_estimated_size); int densityFactor = 1; if (densityFactors.size() > 0 && downscalePhotos.getSelectedItemPosition() >= 0) { densityFactor = densityFactors.get(downscalePhotos.getSelectedItemPosition()).intValue(); } Bundle opts = new Bundle(); opts.putBoolean("photoExport", photoExport); opts.putBoolean("rawExport", rawExport); estimatedSize.setText(String.format(getString(R.string.export_archive_estimated_size), exporter.getReadableArchiveSize(opts, densityFactor))); Button start = (Button) findViewById(R.id.export_start_button); ProgressBar progress = (ProgressBar) findViewById(R.id.export_progress_bar); TextView runningText = (TextView) findViewById(R.id.export_running_text); start.setVisibility(View.VISIBLE); progress.setVisibility(View.GONE); runningText.setVisibility(View.GONE); } else { Button start = (Button) findViewById(R.id.export_start_button); ProgressBar progress = (ProgressBar) findViewById(R.id.export_progress_bar); TextView runningText = (TextView) findViewById(R.id.export_running_text); start.setVisibility(View.GONE); progress.setVisibility(View.VISIBLE); runningText.setVisibility(View.VISIBLE); enableDisableView(findViewById(R.id.export_settings), false); } }
From source file:com.mjhram.geodata.GpsMainActivity.java
public void OnWaitingForLocation(boolean inProgress) { ProgressBar fixBar = (ProgressBar) findViewById(R.id.registrationProgressBar); fixBar.setVisibility(inProgress ? View.VISIBLE : View.INVISIBLE); tracer.debug(inProgress + ""); }
From source file:com.eutectoid.dosomething.picker.GraphObjectAdapter.java
private View getActivityCircleView(View convertView, ViewGroup parent) { View result = convertView;/*from www.j ava 2s . c o m*/ if (result == null) { result = inflater.inflate(R.layout.picker_activity_circle_row, null); } ProgressBar activityCircle = (ProgressBar) result .findViewById(R.id.com_facebook_picker_row_activity_circle); activityCircle.setVisibility(View.VISIBLE); return result; }
From source file:com.facebook.widget.GraphObjectAdapter.java
private View getActivityCircleView(View convertView, ViewGroup parent) { View result = convertView;//from w ww .ja v a 2s.com if (result == null) { result = inflater.inflate(R.layout.com_facebook_picker_activity_circle_row, null); } ProgressBar activityCircle = (ProgressBar) result .findViewById(R.id.com_facebook_picker_row_activity_circle); activityCircle.setVisibility(View.VISIBLE); return result; }