List of usage examples for android.widget ProgressBar setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.google.sample.devicelab.MainActivity.java
private void refreshUI() { mLoginProgressBar.setVisibility(View.GONE); mLoginStatus.setVisibility(View.GONE); mLogoutProgressBar.setVisibility(View.GONE); mLogoutStatus.setVisibility(View.GONE); LinearLayout loggedOut = (LinearLayout) findViewById(R.id.loggedOut); LinearLayout loggedIn = (LinearLayout) findViewById(R.id.loggedIn); if (UserSettings.isDeviceAddedToLab(this)) { loggedIn.setVisibility(View.VISIBLE); loggedOut.setVisibility(View.GONE); } else {/* ww w .ja v a 2 s . co m*/ loggedIn.setVisibility(View.GONE); loggedOut.setVisibility(View.VISIBLE); String appEngineId = UserSettings.getAppEngineId(this); LinearLayout gaeVerifyingLL = (LinearLayout) findViewById(R.id.gaeVerificationLL); if (appEngineId.equals("")) { ((TextView) findViewById(R.id.gaeUrl)).setText(R.string.gae_id_label_hint); gaeVerifyingLL.setVisibility(View.GONE); } else { ((TextView) findViewById(R.id.gaeUrl)).setText(appEngineId); gaeVerifyingLL.setVisibility(View.VISIBLE); ((TextView) findViewById(R.id.gaeNumber)).setText(UserSettings.getAppEngineNumber(this)); //Update the UI for the gaeVerification linear layout TextView verificationStatus = (TextView) findViewById(R.id.gaeVerificationStatus); ProgressBar verificationProgressBar = (ProgressBar) findViewById(R.id.gaeVerificationProgress); GAEIdVerificationStatus idStatus = UserSettings.getAppEngineIdStatus(this); verificationStatus.setText(idStatus.getDisplayString(this)); verificationProgressBar.setVisibility(idStatus.showProgressBar() ? View.VISIBLE : View.GONE); //We set on click listened to redo verification gaeVerifyingLL.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new GAEIdVerifier(MainActivity.this).execute(); } }); //If verification passed, we allow user to log in; otherwise, we block it TextView loginDescription = (TextView) findViewById(R.id.loginDescription); SignInButton signInButton = (SignInButton) findViewById(R.id.signInButton); if (idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED && UserSettings.getAppEngineNumber(this).equals("")) { loginDescription.setText(R.string.description_logged_out4); signInButton.setVisibility(View.GONE); } else if (idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED) { loginDescription.setText(R.string.description_logged_out3); signInButton.setVisibility(View.VISIBLE); } else { loginDescription.setText(R.string.description_logged_out2); signInButton.setVisibility(View.GONE); } //Show reason logged in failed if (!UserSettings.getLoginFailureReason(this).equals("") && idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED) { mLoginStatus.setVisibility(View.VISIBLE); mLoginStatus.setText(UserSettings.getLoginFailureReason(this)); } } } }
From source file:com.adrguides.ReadGuideFragment.java
private void printStatus() { TextView title = (TextView) v.findViewById(R.id.textTitle); TextView content = (TextView) v.findViewById(R.id.textContent); TextView message = (TextView) v.findViewById(R.id.textMessage); ProgressBar progress = (ProgressBar) v.findViewById(R.id.progressMessage); if (ttsfragment.isTTSReady() && ttsfragment.isGuideAvailable() && ttsfragment.isGuideLanguageAvailable()) { Guide guide = ttsfragment.getGuide(); int chapter = ttsfragment.getChapter(); int paragraph = ttsfragment.getParagraph(); String imageURL;/* w w w .jav a 2s . c o m*/ // Print title in bar getActivity().getActionBar().setTitle(guide.getTitle()); message.setVisibility(View.GONE); progress.setVisibility(View.GONE); Place mychapter = guide.getPlaces().get(chapter); title.setVisibility(View.VISIBLE); title.setText(mychapter.getVisibleLabel()); if (paragraph >= 0) { content.setVisibility(View.VISIBLE); content.setText(mychapter.getSections().get(paragraph).getText()); imageURL = mychapter.getSections().get(paragraph).getImageURL(); } else { content.setVisibility(View.GONE); if (mychapter.getSections().size() > 0) { imageURL = mychapter.getSections().get(0).getImageURL(); } else { imageURL = null; } } switchImage(imageURL); } else { getActivity().getActionBar().setTitle(getResources().getText(R.string.title_activity_read_guide)); title.setVisibility(View.GONE); content.setVisibility(View.GONE); message.setVisibility(View.VISIBLE); switchImage(null); if (!ttsfragment.isTTSReady()) { // Language not available if (ttsfragment.isInitialized()) { // error message.setText(getResources().getString(R.string.msg_tts_not_available)); progress.setVisibility(View.GONE); } else { // Initializing message.setText(getResources().getString(R.string.msg_tts_initializing)); progress.setVisibility(View.VISIBLE); } } else if (!ttsfragment.isGuideAvailable()) { message.setText(getResources().getString(R.string.msg_guide_not_available)); progress.setVisibility(View.GONE); } else { // !ttsfragment.isGuideLanguageAvailable message.setText(getResources().getString(R.string.msg_guide_language_not_available, ttsfragment.getGuide().getLocale().getDisplayName())); progress.setVisibility(View.GONE); } } getActivity().invalidateOptionsMenu(); }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void showMapHideLoadingScreen() { ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); View loadingTV = (View) findViewById(R.id.loading_tv); progressBar.getIndeterminateDrawable().setColorFilter(Color.parseColor("#FF00BEED"), PorterDuff.Mode.MULTIPLY);/*w w w. j ava 2 s. c om*/ progressBar.setVisibility(View.GONE); loadingTV.setVisibility(View.GONE); }
From source file:com.imagersliderlib.adapter.ImagePagerAdapter.java
@Override public Object instantiateItem(ViewGroup view, int position) { View imageLayout = inflater.inflate(R.layout.image_pager_layout, view, false); assert imageLayout != null; ImageView imageView = (ImageView) imageLayout.findViewById(R.id.image); // image loding progressbar final ProgressBar spinner = (ProgressBar) imageLayout.findViewById(R.id.loading); // image scale set imageView.setScaleType(ScaleType.FIT_XY); // init ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.init(ImageLoaderConfiguration.createDefault(mContext)); // ImageLoader set option options = new DisplayImageOptions.Builder().showImageForEmptyUri(new ColorDrawable(0xff6e6e6e)) .showImageOnFail(new ColorDrawable(0xff6e6e6e)).showImageOnLoading(new ColorDrawable(0xff6e6e6e)) .cacheInMemory(true).cacheOnDisk(true).build(); imageLoader.displayImage(mImages.get(position), imageView, options, new SimpleImageLoadingListener() { @Override/*from w ww . j av a 2 s . c o m*/ public void onLoadingStarted(String imageUri, View view) { spinner.setVisibility(View.VISIBLE); } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { String message = null; switch (failReason.getType()) { case IO_ERROR: message = "Input/Output error"; break; case DECODING_ERROR: message = "Image can't be decoded"; break; case NETWORK_DENIED: message = "Downloads are denied"; break; case OUT_OF_MEMORY: message = "Out Of Memory error"; break; case UNKNOWN: message = "Unknown error"; break; } Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); spinner.setVisibility(View.GONE); } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { spinner.setVisibility(View.GONE); } }); view.addView(imageLayout, 0); return imageLayout; }
From source file:org.ozonecity.gpslogger2.GpsMainActivity.java
public void OnWaitingForLocation(boolean inProgress) { ProgressBar fixBar = (ProgressBar) findViewById(R.id.progressBarGpsFix); fixBar.setVisibility(inProgress ? View.VISIBLE : View.INVISIBLE); }
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
/** * Updates the quota in the drawer/*from w w w.ja v a2s.c o m*/ */ private void updateQuota() { Account account = AccountUtils.getCurrentOwnCloudAccount(this); if (account == null) return; UserProfile.UserQuota userQuota = UserProfilesRepository.getUserProfilesRepository().getQuota(account.name); if (userQuota == null) return; ProgressBar accountQuotaBar = findViewById(R.id.account_quota_bar); TextView accountQuotaText = findViewById(R.id.account_quota_text); if (accountQuotaBar != null && accountQuotaText != null) { if (userQuota.getFree() < 0) { // Pending, unknown or unlimited free storage accountQuotaBar.setVisibility(View.VISIBLE); accountQuotaBar.setProgress(0); accountQuotaText.setText(String.format(getString(R.string.drawer_unavailable_free_storage), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(), this))); } else if (userQuota.getFree() == 0) { // Quota 0, guest users accountQuotaBar.setVisibility(View.GONE); accountQuotaText.setText(getString(R.string.drawer_unavailable_used_storage)); } else { // Limited quota accountQuotaBar.setVisibility(View.VISIBLE); // Update progress bar rounding up to next int. Example: quota is 0.54 => 1 accountQuotaBar.setProgress((int) Math.ceil(userQuota.getRelative())); accountQuotaText.setText(String.format(getString(R.string.drawer_quota), DisplayUtils.bytesToHumanReadable(userQuota.getUsed(), this), DisplayUtils.bytesToHumanReadable(userQuota.getTotal(), this), userQuota.getRelative())); } } }
From source file:mp.paschalis.RegisterActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); getSupportActionBar().setDisplayHomeAsUpEnabled(true); app = (App) getApplication();//w w w . j a v a2 s .co m buttonRegister = (Button) findViewById(R.id.buttonRegister); registerAsyncTask = new RegisterAsyncTask(); registerUsername = (EditText) findViewById(R.id.editTextRegisterUsername); registerPassword = (EditText) findViewById(R.id.editTextRegisterPassword); registerConfirmPassword = (EditText) findViewById(R.id.editTextRegisterConfirmPassword); registerName = (EditText) findViewById(R.id.editTextRegisterName); registerSurname = (EditText) findViewById(R.id.editTextRegisterSurname); registerEmail = (EditText) findViewById(R.id.editTextRegisterEmail); registerPhone = (EditText) findViewById(R.id.editTextRegisterPhone); checkBoxNotificationsApplication = (CheckBox) findViewById(R.id.checkBoxRegisterNotificationsApplication); checkBoxNotificationsEmail = (CheckBox) findViewById(R.id.checkBoxRegisterNotificationsEmail); // textViewConfirmPassword = (TextView) // findViewById(R.id.textViewRegisterConfirmPassword); // Watch Field Changes registerUsername.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.username); } }); registerPassword.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.password); } }); registerConfirmPassword.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.confirmPassword); } }); registerName.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.name); } }); registerSurname.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.surname); } }); registerEmail.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.email); } }); registerPhone.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { enableRegisterFields(RegisterFields.phone); } }); buttonRegister.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Try to register user to database // Hide Progress Bar, and reEnable button ProgressBar progressBarRegisterButton = (ProgressBar) findViewById(R.id.progressBarRegisterButton); buttonRegister.setClickable(false); progressBarRegisterButton.setVisibility(View.VISIBLE); buttonRegister.setVisibility(View.INVISIBLE); // Progress Bar Can cancel the task progressBarRegisterButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!registerAsyncTask.isCancelled()) registerAsyncTask.cancel(true); } }); // Login User if (!registerAsyncTask.isCancelled()) { registerAsyncTask = new RegisterAsyncTask(); } registerAsyncTask.execute(app.library); } }); }
From source file:at.alladin.rmbt.android.map.RMBTMapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.map_google, container, false); registerListeners(view);/*w ww.ja v a 2s . co m*/ final int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()); if (errorCode != ConnectionResult.SUCCESS) { final Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, getActivity(), 0); errorDialog.show(); getFragmentManager().popBackStack(); return view; } View mapView = super.onCreateView(inflater, container, savedInstanceState); final RelativeLayout mapViewContainer = (RelativeLayout) view.findViewById(R.id.mapViewContainer); mapViewContainer.addView(mapView); ProgressBar progessBar = new ProgressBar(getActivity()); final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 1); progessBar.setLayoutParams(layoutParams); progessBar.setVisibility(View.GONE); view.addView(progessBar); return view; }
From source file:com.digium.respoke.GroupListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_join) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_join_group); dialog.setTitle("Join a group"); Button dialogButton = (Button) dialog.findViewById(R.id.button1); TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(""); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new View.OnClickListener() { @Override/*from ww w. jav a 2 s . c o m*/ public void onClick(View v) { Button connectButton = (Button) dialog.findViewById(R.id.button1); ProgressBar progressCircle = (ProgressBar) dialog.findViewById(R.id.progress_circle); EditText userInput = (EditText) dialog.findViewById(R.id.editTextDialogUserInput); String groupID = userInput.getText().toString(); if (groupID.length() > 0) { TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(""); connectButton.setText(""); progressCircle.setVisibility(View.VISIBLE); ContactManager.sharedInstance().joinGroup(groupID, new Respoke.TaskCompletionListener() { @Override public void onSuccess() { dialog.dismiss(); } @Override public void onError(final String errorMessage) { Button connectButton = (Button) dialog.findViewById(R.id.button1); ProgressBar progressCircle = (ProgressBar) dialog .findViewById(R.id.progress_circle); TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText(errorMessage); connectButton.setText("Connect"); progressCircle.setVisibility(View.INVISIBLE); } }); } else { TextView errorText = (TextView) dialog.findViewById(R.id.errorText); errorText.setText("Group name may not be blank"); } } }); dialog.show(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.geotrackin.gpslogger.GpsMainActivity.java
@Override public void OnWaitingForLocation(boolean inProgress) { ProgressBar fixBar = (ProgressBar) findViewById(R.id.progressBarGpsFix); fixBar.setVisibility(inProgress ? View.VISIBLE : View.INVISIBLE); }