List of usage examples for android.widget ProgressBar getIndeterminateDrawable
public Drawable getIndeterminateDrawable()
Get the drawable used to draw the progress bar in indeterminate mode.
From source file:com.gigigo.vuforiacore.sdkimagerecognition.icloudrecognition.CloudRecognition.java
public void startLoadingAnimation() { // Inflates the Overlay Layout to be displayed above the Camera View LayoutInflater inflater = LayoutInflater.from(this.mActivity); mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay_vuforia, null, false); mUILayout.setVisibility(View.VISIBLE); ProgressBar loadingProgressBar = (ProgressBar) mUILayout.findViewById(R.id.loading_indicator); // By default loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_container); if (Build.VERSION.SDK_INT < 21) { if (loadingProgressBar.getIndeterminateDrawable() != null) { loadingProgressBar.getIndeterminateDrawable().setColorFilter( ContextCompat.getColor(mActivity, R.color.vuforia_loading_indicator_color), android.graphics.PorterDuff.Mode.SRC_IN); }//from w ww . ja va2s. c om } loadingDialogHandler.mLoadingDialogContainer.setVisibility(View.VISIBLE); this.mActivity.addContentView(mUILayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
From source file:com.nextgis.mobile.activity.MainActivity.java
public synchronized void onRefresh(boolean isRefresh) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { MenuItem refreshItem = mToolbar.getMenu().findItem(R.id.menu_refresh); if (null != refreshItem) { if (isRefresh) { if (refreshItem.getActionView() == null) { refreshItem.setActionView(R.layout.layout_refresh); ProgressBar progress = (ProgressBar) refreshItem.getActionView() .findViewById(R.id.refreshingProgress); if (progress != null) progress.getIndeterminateDrawable().setColorFilter( ContextCompat.getColor(this, R.color.color_grey_200), PorterDuff.Mode.SRC_IN); }/* w ww. ja v a 2 s .co m*/ } else stopRefresh(refreshItem); } } }
From source file:com.cerema.cloud2.ui.activity.Uploader.java
@Override protected Dialog onCreateDialog(final int id) { final AlertDialog.Builder builder = new Builder(this); switch (id) { case DIALOG_WAITING: final ProgressDialog pDialog = new ProgressDialog(this, R.style.ProgressDialogTheme); pDialog.setIndeterminate(false); pDialog.setCancelable(false);// ww w . j a v a2 s . co m pDialog.setMessage(getResources().getString(R.string.uploader_info_uploading)); pDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { ProgressBar v = (ProgressBar) pDialog.findViewById(android.R.id.progress); v.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.color_accent), android.graphics.PorterDuff.Mode.MULTIPLY); } }); return pDialog; case DIALOG_NO_ACCOUNT: builder.setIcon(R.drawable.ic_warning); builder.setTitle(R.string.uploader_wrn_no_account_title); builder.setMessage( String.format(getString(R.string.uploader_wrn_no_account_text), getString(R.string.app_name))); builder.setCancelable(false); builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ECLAIR_MR1) { // using string value since in API7 this // constant is not defined // in API7 < this constant is defined in // Settings.ADD_ACCOUNT_SETTINGS // and Settings.EXTRA_AUTHORITIES Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); intent.putExtra("authorities", new String[] { MainApp.getAuthTokenType() }); startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT); } else { // since in API7 there is no direct call for // account setup, so we need to // show our own AccountSetupAcricity, get // desired results and setup // everything for ourself Intent intent = new Intent(getBaseContext(), AccountAuthenticator.class); startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT); } } }); builder.setNegativeButton(R.string.uploader_wrn_no_account_quit_btn_text, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); return builder.create(); case DIALOG_MULTIPLE_ACCOUNT: CharSequence ac[] = new CharSequence[mAccountManager .getAccountsByType(MainApp.getAccountType()).length]; for (int i = 0; i < ac.length; ++i) { ac[i] = DisplayUtils.convertIdn(mAccountManager.getAccountsByType(MainApp.getAccountType())[i].name, false); } builder.setTitle(R.string.common_choose_account); builder.setItems(ac, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setAccount(mAccountManager.getAccountsByType(MainApp.getAccountType())[which]); onAccountSet(mAccountWasRestored); dialog.dismiss(); mAccountSelected = true; mAccountSelectionShowing = false; } }); builder.setCancelable(true); builder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mAccountSelectionShowing = false; dialog.cancel(); finish(); } }); return builder.create(); case DIALOG_NO_STREAM: builder.setIcon(R.drawable.ic_warning); builder.setTitle(R.string.uploader_wrn_no_content_title); builder.setMessage(R.string.uploader_wrn_no_content_text); builder.setCancelable(false); builder.setNegativeButton(R.string.common_cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); return builder.create(); default: throw new IllegalArgumentException("Unknown dialog id: " + id); } }
From source file:jahirfiquitiva.iconshowcase.activities.AltWallpaperViewerActivity.java
@SuppressWarnings("ResourceAsColor") @Override/*www . jav a2 s . c o m*/ protected void onCreate(Bundle savedInstanceState) { ThemeUtils.onActivityCreateSetTheme(this); setupFullScreen(); super.onCreate(savedInstanceState); mPrefs = new Preferences(this); Intent intent = getIntent(); String transitionName = intent.getStringExtra("transitionName"); item = intent.getParcelableExtra("item"); setContentView(R.layout.alt_wallpaper_viewer_activity); fab = (FloatingActionButton) findViewById(R.id.fab); applyFab = (FloatingActionButton) findViewById(R.id.applyFab); saveFab = (FloatingActionButton) findViewById(R.id.saveFab); infoFab = (FloatingActionButton) findViewById(R.id.infoFab); hideFab(applyFab); hideFab(saveFab); hideFab(infoFab); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(item.getWallName()); getSupportActionBar().setSubtitle(item.getWallAuthor()); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back_with_shadow); changeToolbarTextAppearance(toolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } if (Build.VERSION.SDK_INT < 19) { ToolbarColorizer.colorizeToolbar(toolbar, ContextCompat.getColor(this, android.R.color.white)); } fab.setOnClickListener(new DebouncedClickListener() { @Override public void onDebouncedClick(View v) { if (fabOpened) { closeMenu(); } else { openMenu(); } fabOpened = !fabOpened; } }); applyFab.setOnClickListener(new DebouncedClickListener() { @Override public void onDebouncedClick(View v) { showApplyWallpaperDialog(AltWallpaperViewerActivity.this, item.getWallURL()); } }); if (item.isDownloadable()) { saveFab.setOnClickListener(new DebouncedClickListener() { @Override public void onDebouncedClick(View v) { if (!PermissionUtils.canAccessStorage(AltWallpaperViewerActivity.this)) { PermissionUtils.setViewerActivityAction("save"); PermissionUtils.requestStoragePermission(AltWallpaperViewerActivity.this); } else { showDialogs("save"); } } }); } else { saveFab.setVisibility(View.GONE); } infoFab.setOnClickListener(new DebouncedClickListener() { @Override public void onDebouncedClick(View v) { ISDialogs.showWallpaperDetailsDialog(AltWallpaperViewerActivity.this, item.getWallName(), item.getWallAuthor(), item.getWallDimensions(), item.getWallCopyright(), new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { reshowFab(fab); setupFullScreen(); } }); } }); TouchImageView mPhoto = (TouchImageView) findViewById(R.id.big_wallpaper); ViewCompat.setTransitionName(mPhoto, transitionName); layout = (CoordinatorLayout) findViewById(R.id.viewerLayout); Bitmap bmp = null; String filename = getIntent().getStringExtra("image"); try { if (filename != null) { FileInputStream is = openFileInput(filename); bmp = BitmapFactory.decodeStream(is); is.close(); } else { bmp = null; } } catch (Exception e) { e.printStackTrace(); } int colorFromCachedPic; if (bmp != null) { colorFromCachedPic = ColorUtils.getPaletteSwatch(bmp).getBodyTextColor(); } else { colorFromCachedPic = ThemeUtils.darkOrLight(this, R.color.drawable_tint_dark, R.color.drawable_base_tint); } final ProgressBar spinner = (ProgressBar) findViewById(R.id.progress); spinner.getIndeterminateDrawable().setColorFilter(colorFromCachedPic, PorterDuff.Mode.SRC_IN); Drawable d; if (bmp != null) { d = new GlideBitmapDrawable(getResources(), bmp); } else { d = new ColorDrawable(ContextCompat.getColor(this, android.R.color.transparent)); } if (mPrefs.getAnimationsEnabled()) { Glide.with(this).load(item.getWallURL()).placeholder(d).diskCacheStrategy(DiskCacheStrategy.SOURCE) .fitCenter().listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { spinner.setVisibility(View.GONE); return false; } }).into(mPhoto); } else { Glide.with(this).load(item.getWallURL()).placeholder(d).dontAnimate() .diskCacheStrategy(DiskCacheStrategy.SOURCE).fitCenter() .listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { spinner.setVisibility(View.GONE); return false; } }).into(mPhoto); } }
From source file:com.synox.android.ui.activity.Uploader.java
@Override protected Dialog onCreateDialog(final int id) { final AlertDialog.Builder builder = new Builder(this); switch (id) { case DIALOG_WAITING: final ProgressDialog pDialog = new ProgressDialog(this, R.style.ProgressDialogTheme); pDialog.setIndeterminate(false); pDialog.setCancelable(false);/*from w w w.j av a2 s. c o m*/ pDialog.setMessage(getResources().getString(R.string.uploader_info_uploading)); pDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { ProgressBar v = (ProgressBar) pDialog.findViewById(android.R.id.progress); v.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.accent), android.graphics.PorterDuff.Mode.MULTIPLY); } }); return pDialog; case DIALOG_NO_ACCOUNT: builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setTitle(R.string.uploader_wrn_no_account_title); builder.setMessage( String.format(getString(R.string.uploader_wrn_no_account_text), getString(R.string.app_name))); builder.setCancelable(false); builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ECLAIR_MR1) { // using string value since in API7 this // constatn is not defined // in API7 < this constatant is defined in // Settings.ADD_ACCOUNT_SETTINGS // and Settings.EXTRA_AUTHORITIES Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); intent.putExtra("authorities", new String[] { MainApp.getAuthTokenType() }); startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT); } else { // since in API7 there is no direct call for // account setup, so we need to // show our own AccountSetupAcricity, get // desired results and setup // everything for ourself Intent intent = new Intent(getBaseContext(), AccountAuthenticator.class); startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT); } } }); builder.setNegativeButton(R.string.uploader_wrn_no_account_quit_btn_text, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); return builder.create(); case DIALOG_MULTIPLE_ACCOUNT: CharSequence ac[] = new CharSequence[mAccountManager .getAccountsByType(MainApp.getAccountType()).length]; for (int i = 0; i < ac.length; ++i) { ac[i] = DisplayUtils.convertIdn(mAccountManager.getAccountsByType(MainApp.getAccountType())[i].name, false); } builder.setTitle(R.string.common_choose_account); builder.setItems(ac, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setAccount(mAccountManager.getAccountsByType(MainApp.getAccountType())[which]); onAccountSet(mAccountWasRestored); dialog.dismiss(); mAccountSelected = true; mAccountSelectionShowing = false; } }); builder.setCancelable(true); builder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mAccountSelectionShowing = false; dialog.cancel(); finish(); } }); return builder.create(); case DIALOG_NO_STREAM: builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setTitle(R.string.uploader_wrn_no_content_title); builder.setMessage(R.string.uploader_wrn_no_content_text); builder.setCancelable(false); builder.setNegativeButton(R.string.common_cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); return builder.create(); default: throw new IllegalArgumentException("Unknown dialog id: " + id); } }
From source file:in.andres.kandroid.ui.TaskDetailActivity.java
private void showProgress() { activeRequests++;/* www . j a v a2s .c om*/ if (activeRequests > 0 && refreshAction != null && !progressVisible) { ProgressBar prog = new ProgressBar(self); prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY); refreshAction.setActionView(prog); refreshAction.expandActionView(); progressVisible = true; } }
From source file:in.andres.kandroid.ui.TaskDetailActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); refreshAction = menu.findItem(R.id.action_refresh); if (activeRequests > 0 && refreshAction != null) { ProgressBar prog = new ProgressBar(self); prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY); refreshAction.setActionView(prog); refreshAction.expandActionView(); progressVisible = true;/*from w w w. ja v a 2 s.co m*/ } return true; }