Java Code Examples for android.widget.ProgressBar#setIndeterminate()
The following examples show how to use
android.widget.ProgressBar#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: PleaseWaitProgressDialog.java From InviZible with GNU General Public License v3.0 | 6 votes |
@Override public AlertDialog.Builder assignBuilder() { if (getActivity() == null) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CustomAlertDialogTheme); builder.setTitle(R.string.please_wait); builder.setPositiveButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.dismiss()); ProgressBar progressBar = new ProgressBar(getActivity(), null, android.R.attr.progressBarStyleHorizontal); progressBar.setBackgroundResource(R.drawable.background_10dp_padding); progressBar.setIndeterminate(true); builder.setView(progressBar); builder.setCancelable(false); return builder; }
Example 2
Source File: MainActivity.java From android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progressBar = (ProgressBar) findViewById(R.id.progress_bar); progressBar.setIndeterminate(true); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); configureListView(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { checkRuntimePermissions(); } }
Example 3
Source File: OfflineLayersAdapter.java From mage-android with Apache License 2.0 | 6 votes |
public void updateDownloadProgress(View view, Layer layer) { int progress = downloadManager.getProgress(layer); long size = layer.getFileSize(); final ProgressBar progressBar = view.findViewById(R.id.layer_progress); final View download = view.findViewById(R.id.layer_download); if (progress <= 0) { String reason = downloadManager.isFailed(layer); if(!StringUtils.isEmpty(reason)) { Toast.makeText(context, reason, Toast.LENGTH_LONG).show(); progressBar.setVisibility(View.GONE); download.setVisibility(View.VISIBLE); } return; } int currentProgress = (int) (progress / (float) size * 100); progressBar.setIndeterminate(false); progressBar.setProgress(currentProgress); TextView layerSize = view.findViewById(R.id.layer_size); layerSize.setText(String.format("Downloading: %s of %s", Formatter.formatFileSize(context, progress), Formatter.formatFileSize(context, size))); }
Example 4
Source File: PLView.java From PanoramaGL with Apache License 2.0 | 6 votes |
/** * This event is fired when GLSurfaceView is created * @param glSurfaceView current GLSurfaceView */ @SuppressWarnings("deprecation") protected View onGLSurfaceViewCreated(GLSurfaceView glSurfaceView) { for(int i = 0; i < kMaxTouches; i++) mInternalTouches.add(new UITouch(glSurfaceView, new CGPoint(0.0f, 0.0f))); mContentLayout = new RelativeLayout(this); mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mContentLayout.addView(glSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar = new ProgressBar(this); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.GONE); mContentLayout.addView(mProgressBar, progressBarLayoutParams); return this.onContentViewCreated(mContentLayout); }
Example 5
Source File: EBrowserProgress.java From appcan-android with GNU Lesser General Public License v3.0 | 6 votes |
public EBrowserProgress(Context context) { super(context); mProgress = new ProgressBar(context); mProgress.setIndeterminate(true); mMessege = new TextView(context); RelativeLayout.LayoutParams parmPro = new LayoutParams(-2, -2); parmPro.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mProgress.setLayoutParams(parmPro); RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2); parmMsg.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mMessege.setLayoutParams(parmMsg); mMessege.setTextColor(0xFFFF0000); mMessege.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); addView(mProgress); addView(mMessege); setOnClickListener(this); }
Example 6
Source File: DetailsProgressListener.java From YalpStore with GNU General Public License v2.0 | 6 votes |
@Override public void onProgress(long bytesDownloaded, long bytesTotal) { if (null == activityRef.get()) { return; } activityRef.get().findViewById(R.id.download_progress_container).setVisibility(View.VISIBLE); ((TextView) activityRef.get().findViewById(R.id.download_progress_size)).setText(activityRef.get().getString( R.string.notification_download_progress, Formatter.formatShortFileSize(activityRef.get(), bytesDownloaded), Formatter.formatShortFileSize(activityRef.get(), bytesTotal) )); activityRef.get().findViewById(R.id.download).setVisibility(View.GONE); ProgressBar progressBar = activityRef.get().findViewById(R.id.download_progress); progressBar.setIndeterminate(false); progressBar.setProgress((int) bytesDownloaded); progressBar.setMax((int) bytesTotal); }
Example 7
Source File: LoadingLayout.java From LoadingLayout with Apache License 2.0 | 6 votes |
@Override protected void onFinishInflate() { super.onFinishInflate(); // 事先保存子控件显示状态,并隐藏所有子控件 for (int i = 0; i < getChildCount(); i++) { mVisibilityMap.put(getChildAt(i), getChildAt(i).getVisibility()); if (!mAutoLoadingDebug) { getChildAt(i).setVisibility(GONE); } } mLoadingBar = new ProgressBar(getContext()); mLoadingBar.setIndeterminate(true); if (mProgressDrawable != null) { mLoadingBar.setProgressDrawable(mProgressDrawable); } LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.CENTER; addView(mLoadingBar, params); if (!mAutoLoadingDebug) { showLoading(); } }
Example 8
Source File: PhotoPagerAdapter.java From secrecy with Apache License 2.0 | 6 votes |
/** * The Fragment's UI is just a simple text view showing its * instance number. */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final RelativeLayout relativeLayout = new RelativeLayout(container.getContext()); final EncryptedFile encryptedFile = encryptedFiles.get(mNum); final PhotoView photoView = new PhotoView(container.getContext()); relativeLayout.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); try { photoView.setImageBitmap(encryptedFile.getEncryptedThumbnail().getThumb(150)); } catch (SecrecyFileException e) { Util.log("No bitmap available!"); } RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); final ProgressBar pBar = new ProgressBar(container.getContext()); pBar.setIndeterminate(false); relativeLayout.addView(pBar, layoutParams); imageLoadJob = new ImageLoadJob(mNum, encryptedFile, photoView, pBar); CustomApp.jobManager.addJobInBackground(imageLoadJob); return relativeLayout; }
Example 9
Source File: PLView.java From panoramagl with Apache License 2.0 | 6 votes |
/** * This event is fired when GLSurfaceView is created * * @param glSurfaceView current GLSurfaceView */ @SuppressWarnings("deprecation") protected View onGLSurfaceViewCreated(GLSurfaceView glSurfaceView) { for (int i = 0; i < kMaxTouches; i++) mInternalTouches.add(new UITouch(glSurfaceView, new CGPoint(0.0f, 0.0f))); mContentLayout = new RelativeLayout(this); mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mContentLayout.addView(glSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar = new ProgressBar(this); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.GONE); mContentLayout.addView(mProgressBar, progressBarLayoutParams); return this.onContentViewCreated(mContentLayout); }
Example 10
Source File: NotificationBoardCallback.java From Android-Notification with Apache License 2.0 | 5 votes |
/** * Called when a row view is being updated. * * @param board * @param rowView * @param entry */ public void onRowViewUpdate(NotificationBoard board, RowView rowView, NotificationEntry entry) { if (DBG) Log.v(TAG, "onRowViewUpdate - " + entry.ID); ImageView iconView = (ImageView) rowView.findViewById(R.id.icon); TextView titleView = (TextView) rowView.findViewById(R.id.title); TextView textView = (TextView) rowView.findViewById(R.id.text); TextView whenView = (TextView) rowView.findViewById(R.id.when); ProgressBar bar = (ProgressBar) rowView.findViewById(R.id.progress); if (entry.iconDrawable != null) { iconView.setImageDrawable(entry.iconDrawable); } else if (entry.smallIconRes != 0) { iconView.setImageResource(entry.smallIconRes); } else if (entry.largeIconBitmap != null) { iconView.setImageBitmap(entry.largeIconBitmap); } titleView.setText(entry.title); textView.setText(entry.text); if (entry.showWhen) { whenView.setText(entry.whenFormatted); } if (entry.progressMax != 0 || entry.progressIndeterminate) { bar.setVisibility(View.VISIBLE); bar.setIndeterminate(entry.progressIndeterminate); if (!entry.progressIndeterminate) { bar.setMax(entry.progressMax); bar.setProgress(entry.progress); } } else { bar.setVisibility(View.GONE); } }
Example 11
Source File: EBrowserToast.java From appcan-android with GNU Lesser General Public License v3.0 | 5 votes |
public EBrowserToast(Context context) { super(context); GradientDrawable grade = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0x99000000, 0x99000000}); grade.setCornerRadius(6); setBackgroundDrawable(grade); int pad = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, ESystemInfo.getIntence().mDisplayMetrics); setPadding(pad, pad, pad, pad); m_progress = new ProgressBar(context); m_progress.setId(0x1101); m_progress.setIndeterminate(true); m_msg = new TextView(context); m_msg.setId(0x1102); int use = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, ESystemInfo.getIntence().mDisplayMetrics); RelativeLayout.LayoutParams parmPro = new LayoutParams(use, use); parmPro.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); parmPro.addRule(RelativeLayout.CENTER_VERTICAL); m_progress.setLayoutParams(parmPro); m_progress.setMinimumHeight(10); RelativeLayout.LayoutParams parmMsg = new LayoutParams(-2, -2); parmMsg.addRule(RelativeLayout.RIGHT_OF, 0x1101); parmMsg.addRule(RelativeLayout.CENTER_VERTICAL); m_msg.setLayoutParams(parmMsg); m_msg.setTextColor(0xFFFFFFFF); m_msg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); addView(m_progress); addView(m_msg); }
Example 12
Source File: ProfileProgressbar.java From ViewInspector with Apache License 2.0 | 5 votes |
@Inject public ProfileProgressbar(Context context) { super(context); inflate(context, R.layout.view_inspector_progressbar, this); mProgressbar = (ProgressBar) findViewById(R.id.progressbar); mProgressbar.setIndeterminate(false); mProgressbar.setMax(100); mPercentage = (TextView) findViewById(R.id.percentage); }
Example 13
Source File: ChannelSetupStepFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onScanStepCompleted(int completedStep, int totalSteps) { ProgressBar progressBar = mChannelSetupStylist.getProgressBar(); if (totalSteps > 0 && progressBar != null) { progressBar.setIndeterminate(false); progressBar.setMax(totalSteps); progressBar.setProgress(completedStep); } }
Example 14
Source File: ChannelSetupStepFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onStart() { super.onStart(); ProgressBar progressBar = mChannelSetupStylist.getProgressBar(); if (progressBar != null) { progressBar.setIndeterminate(true); } mSyncStatusChangedReceiver = new SyncStatusBroadcastReceiver(mInputId, this); LocalBroadcastManager.getInstance(getActivity()) .registerReceiver( mSyncStatusChangedReceiver, new IntentFilter(EpgSyncJobService.ACTION_SYNC_STATUS_CHANGED)); startScan(); }
Example 15
Source File: CacheFragment.java From Aurora with Apache License 2.0 | 5 votes |
private void showDownload(int position) { VideoDownLoadInfo item = data.get(position); item.setDownLoading(true); adapter.setDownPosition(position); ProgressBar seekBar = (ProgressBar) adapter.getViewByPosition(position, R.id.sb_progress); TextView size = (TextView) adapter.getViewByPosition(position, R.id.tv_pause); size.setText(StringUtils.getPrintSize(item.getCurrentBytes() == null ? 0 : item.getCurrentBytes(), false) + "/" + StringUtils.getPrintSize(item.getContentLength() == null ? 0 : item.getContentLength(), true)); seekBar.setVisibility(View.VISIBLE); seekBar.setIndeterminate(false); seekBar.setProgress(data.get(position).getPercent()); }
Example 16
Source File: LoadingFragment.java From leanback-extensions with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_loading, container, false); FrameLayout loadingContainer = (FrameLayout) view.findViewById(R.id.fragment_loading_container); loadingContainer.setBackgroundColor(backgroundColor); progressBar = new ProgressBar(container.getContext()); if (container instanceof FrameLayout) { FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(progressWidth, progressHeight, Gravity.CENTER); progressBar.setLayoutParams(layoutParams); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { if (progressBar.getIndeterminateDrawable() != null) { progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(progressColor), PorterDuff.Mode.SRC_IN); } } else { ColorStateList stateList = ColorStateList.valueOf(progressColor); progressBar.setIndeterminateTintMode(PorterDuff.Mode.SRC_IN); progressBar.setIndeterminateTintList(stateList); progressBar.setProgressBackgroundTintMode(PorterDuff.Mode.SRC_IN); progressBar.setProgressBackgroundTintList(stateList); progressBar.setIndeterminate(true); } loadingContainer.addView(progressBar); return view; }
Example 17
Source File: ChannelSetupStepFragment.java From androidtv-sample-inputs with Apache License 2.0 | 5 votes |
@Override public void onScanStepCompleted(int completedStep, int totalSteps) { ProgressBar progressBar = mChannelSetupStylist.getProgressBar(); if (totalSteps > 0 && progressBar != null) { progressBar.setIndeterminate(false); progressBar.setMax(totalSteps); progressBar.setProgress(completedStep); } }
Example 18
Source File: RootCheckingProgressDialog.java From InviZible with GNU General Public License v3.0 | 5 votes |
public static AlertDialog.Builder getBuilder(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.CustomAlertDialogTheme); builder.setTitle(R.string.root); builder.setMessage(R.string.root_available); builder.setIcon(R.drawable.ic_visibility_off_black_24dp); ProgressBar progressBar = new ProgressBar(context,null, android.R.attr.progressBarStyleHorizontal); progressBar.setBackgroundResource(R.drawable.background_10dp_padding); progressBar.setIndeterminate(true); builder.setView(progressBar); builder.setCancelable(false); return builder; }
Example 19
Source File: MainActivity.java From video-transcoder with GNU General Public License v3.0 | 4 votes |
@Override public void handleMessage(Message msg) { final MainActivity mainActivity = activityRef.get(); if (mainActivity == null) { // Activity is no longer available, exit. return; } MessageId messageId = MessageId.fromInt(msg.what); switch (MessageId.fromInt(msg.what)) { /* * Receives callback from the service when a job has landed * on the app. Turns on indicator and sends a message to turn it off after * a second. */ case JOB_START_MSG: Log.d(TAG, "JOB_START_MSG: " + msg.obj.toString()); break; /* * Receives callback from the service when a job that previously landed on the * app must stop executing. Turns on indicator and sends a message to turn it * off after two seconds. */ case JOB_PROGRESS_MSG: Integer percentComplete = (Integer)msg.obj; if(percentComplete != null && percentComplete > 0) { Log.d(TAG, "JOB_PROGRESS_MSG: " + percentComplete); ProgressBar progressBar = mainActivity.findViewById(R.id.encodeProgress); progressBar.setIndeterminate(false); progressBar.setProgress(percentComplete); } break; case JOB_SUCCEDED_MSG: case JOB_FAILED_MSG: boolean result = false; String outputFile = null; String mimetype = null; String message = null; if(messageId == MessageId.JOB_SUCCEDED_MSG) { result = true; outputFile = ((Bundle)msg.obj).getString(FFMPEG_OUTPUT_FILE); mimetype = ((Bundle)msg.obj).getString(OUTPUT_MIMETYPE); } else { message = ((Bundle)msg.obj).getString(FFMPEG_FAILURE_MSG); } Log.d(TAG, "Job complete, result: " + result); showEncodeCompleteDialog(mainActivity, result, message, outputFile, mimetype); break; case FFMPEG_UNSUPPORTED_MSG: Log.d(TAG, "FFMPEG_UNSUPPORTED_MSG"); break; case UNKNOWN_MSG: Log.w(TAG, "UNKNOWN_MSG received"); break; } }
Example 20
Source File: UIManagerAppCompat.java From document-viewer with GNU General Public License v3.0 | 4 votes |
public static void setProgressSpinnerVisible(AppCompatActivity activity, boolean visible) { ActionBar bar = activity.getSupportActionBar(); if (bar.getCustomView() == null) { ProgressBar spinner = new ProgressBar(activity); spinner.setIndeterminate(true); bar.setCustomView(spinner); } bar.setDisplayShowCustomEnabled(visible); }