List of usage examples for android.widget ProgressBar setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java
public View createLoadingView() { LinearLayout l = new LinearLayout(getActivity()); l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); l.setGravity(Gravity.CENTER);//from w w w.j a v a2s . c o m ProgressBar pb = new ProgressBar(getActivity()); pb.getIndeterminateDrawable().setColorFilter(GGApp.GG_APP.provider.getColor(), PorterDuff.Mode.SRC_IN); pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); pb.setVisibility(ProgressBar.VISIBLE); l.addView(pb); return l; }
From source file:app.abhijit.iter.MainActivity.java
public void displayLoading(boolean visible) { ProgressBar progressBar = (ProgressBar) findViewById(R.id.loading_indicator); progressBar.setVisibility(visible ? View.VISIBLE : View.GONE); }
From source file:com.digium.respoke.GroupListActivity.java
public void onDisconnect(RespokeClient sender, boolean reconnecting) { if (reconnecting) { if (ContactManager.sharedInstance().groups.size() > 0) { groupsToJoin = new ArrayList<String>(); for (RespokeGroup eachGroup : ContactManager.sharedInstance().groups) { groupsToJoin.add(eachGroup.getGroupID()); }// w w w . j a v a 2 s. c om } ContactManager.sharedInstance().disconnected(); Button presenceButton = (Button) findViewById(R.id.button1); presenceButton.setVisibility(View.INVISIBLE); ProgressBar progressCircle = (ProgressBar) findViewById(R.id.progress_circle); progressCircle.setVisibility(View.VISIBLE); // Tell the ListView to reconfigure itself based on the new data listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetInvalidated(); //todo pop to this activity? } else { returnToConnectActivity(); } }
From source file:com.miz.mizuu.fragments.ActorPhotoFragment.java
public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); final ProgressBar pbar = (ProgressBar) v.findViewById(R.id.progressBar1); ImageView img = (ImageView) v.findViewById(R.id.imageView1); if (MizLib.isPortrait(getActivity()) && mPortraitPhotos || !MizLib.isPortrait(getActivity()) && !mPortraitPhotos) img.setScaleType(ScaleType.CENTER_CROP); mPicasso.load(mPhotoUrl).error(R.drawable.noactor).into(img, new Callback() { @Override//from ww w. j av a 2 s . c o m public void onError() { pbar.setVisibility(View.GONE); } @Override public void onSuccess() { pbar.setVisibility(View.GONE); } }); img.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (isAdded()) { mBus.post(new Object()); } } }); }
From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java
public View createLoadingView() { ScrollView sv = new ScrollView(getActivity()); sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); sv.setTag("gg_scroll"); sv.setFillViewport(true);/* w ww .j a va2s . c om*/ LinearLayout l = new LinearLayout(getActivity()); l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); l.setGravity(Gravity.CENTER); ProgressBar pb = new ProgressBar(getActivity()); pb.getIndeterminateDrawable().setColorFilter(SIAApp.SIA_APP.school.getAccentColor(), PorterDuff.Mode.SRC_IN); pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); pb.setVisibility(ProgressBar.VISIBLE); l.addView(pb); sv.addView(l); return sv; }
From source file:name.gumartinm.weather.information.fragment.current.CurrentFragment.java
@Override public void onResume() { super.onResume(); this.mReceiver = new BroadcastReceiver() { @Override/*from w w w . j av a 2 s .c o m*/ public void onReceive(final Context context, final Intent intent) { final String action = intent.getAction(); if (action.equals(BROADCAST_INTENT_ACTION)) { final Current currentRemote = (Current) intent.getSerializableExtra("current"); // 1. Check conditions. They must be the same as the ones that triggered the AsyncTask. final DatabaseQueries query = new DatabaseQueries(context.getApplicationContext()); final WeatherLocation weatherLocation = query.queryDataBase(); final PermanentStorage store = new PermanentStorage(context.getApplicationContext()); final Current current = store.getCurrent(); if (current == null || !CurrentFragment.this.isDataFresh(weatherLocation.getLastCurrentUIUpdate())) { if (currentRemote != null) { // 2. Update UI. CurrentFragment.this.updateUI(currentRemote); // 3. Update current data. store.saveCurrent(currentRemote); // 4. Update location data. weatherLocation.setLastCurrentUIUpdate(new Date()); query.updateDataBase(weatherLocation); } else { // Empty UI and show error message CurrentFragment.this.getActivity().findViewById(R.id.weather_current_data_container) .setVisibility(View.GONE); CurrentFragment.this.getActivity().findViewById(R.id.weather_current_progressbar) .setVisibility(View.GONE); CurrentFragment.this.getActivity().findViewById(R.id.weather_current_error_message) .setVisibility(View.VISIBLE); } } } } }; // Register receiver final IntentFilter filter = new IntentFilter(); filter.addAction(BROADCAST_INTENT_ACTION); LocalBroadcastManager.getInstance(this.getActivity().getApplicationContext()) .registerReceiver(this.mReceiver, filter); // Empty UI this.getActivity().findViewById(R.id.weather_current_data_container).setVisibility(View.GONE); final DatabaseQueries query = new DatabaseQueries(this.getActivity().getApplicationContext()); final WeatherLocation weatherLocation = query.queryDataBase(); if (weatherLocation == null) { // Nothing to do. // Show error message final ProgressBar progress = (ProgressBar) getActivity().findViewById(R.id.weather_current_progressbar); progress.setVisibility(View.GONE); final TextView errorMessage = (TextView) getActivity().findViewById(R.id.weather_current_error_message); errorMessage.setVisibility(View.VISIBLE); return; } // If is new location update widgets. if (weatherLocation.getIsNew()) { WidgetProvider.refreshAllAppWidgets(this.getActivity().getApplicationContext()); // Update location data. weatherLocation.setIsNew(false); query.updateDataBase(weatherLocation); } final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext()); final Current current = store.getCurrent(); if (current != null && this.isDataFresh(weatherLocation.getLastCurrentUIUpdate())) { this.updateUI(current); } else { // Load remote data (asynchronous) // Gets the data from the web. this.getActivity().findViewById(R.id.weather_current_progressbar).setVisibility(View.VISIBLE); this.getActivity().findViewById(R.id.weather_current_error_message).setVisibility(View.GONE); final CurrentTask task = new CurrentTask(this.getActivity().getApplicationContext(), new CustomHTTPClient(AndroidHttpClient.newInstance(this.getString(R.string.http_client_agent))), new ServiceCurrentParser(new JPOSCurrentParser())); task.execute(weatherLocation.getLatitude(), weatherLocation.getLongitude()); } }
From source file:com.digium.respoke.GroupListActivity.java
public void setStatus(final String newPresence) { if ((null != ContactManager.sharedInstance().sharedClient) && (ContactManager.sharedInstance().sharedClient.isConnected())) { Button presenceButton = (Button) findViewById(R.id.button1); presenceButton.setVisibility(View.INVISIBLE); ProgressBar progressCircle = (ProgressBar) findViewById(R.id.progress_circle); progressCircle.setVisibility(View.VISIBLE); ContactManager.sharedInstance().sharedClient.setPresence(newPresence, new Respoke.TaskCompletionListener() { @Override/*from ww w .j a v a 2 s . c o m*/ public void onSuccess() { runOnUiThread(new Runnable() { @Override public void run() { Button presenceButton = (Button) findViewById(R.id.button1); presenceButton.setText("Your Status: " + newPresence); presenceButton.setVisibility(View.VISIBLE); ProgressBar progressCircle = (ProgressBar) findViewById(R.id.progress_circle); progressCircle.setVisibility(View.INVISIBLE); } }); } @Override public void onError(String errorMessage) { Log.d(TAG, errorMessage); runOnUiThread(new Runnable() { @Override public void run() { Button presenceButton = (Button) findViewById(R.id.button1); presenceButton.setVisibility(View.VISIBLE); ProgressBar progressCircle = (ProgressBar) findViewById(R.id.progress_circle); progressCircle.setVisibility(View.INVISIBLE); } }); } }); } }
From source file:com.njlabs.amrita.aid.gpms.ui.PendingPassActivity.java
public void cancelPass(final View v) { String requestId = (String) v.getTag(); ProgressBar progressBar = null; ViewGroup row = (ViewGroup) v.getParent(); for (int itemPos = 0; itemPos < row.getChildCount(); itemPos++) { View view = row.getChildAt(itemPos); if (view instanceof ProgressBar) { progressBar = (ProgressBar) view; break; }/* w w w . j av a 2s . c om*/ } if (progressBar != null) { progressBar.setVisibility(View.VISIBLE); v.setVisibility(View.GONE); } final ProgressBar finalProgressBar = progressBar; gpms.cancelPass(requestId, new SuccessResponse() { @Override public void onSuccess() { swipeRefreshLayout.setRefreshing(true); loadData(); Snackbar.make(parentView, "Pass cancelled successfully.", Snackbar.LENGTH_LONG).show(); Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "GPMS"); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Cancel Pass"); bundle.putString(FirebaseAnalytics.Param.CHARACTER, gpms.getStudentName() + " - " + gpms.getStudentRollNo()); tracker.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); } @Override public void onFailure(Throwable throwable) { Ln.e(throwable); if (finalProgressBar != null) { finalProgressBar.setVisibility(View.GONE); v.setVisibility(View.VISIBLE); } Snackbar.make(parentView, "An error occurred while cancelling your pass", Snackbar.LENGTH_LONG) .show(); } }); }
From source file:net.nakama.duckdroid.ui.Duckdroid.java
private void toggleLoading(boolean visible) { ProgressBar loading = (ProgressBar) findViewById(R.id.pb_loading); loading.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); }
From source file:com.zion.htf.ui.fragment.ArtistSoundcloudFragment.java
private void setErrorMessage(String message) { ProgressBar progressBar = (ProgressBar) this.view.findViewById(R.id.progressBar); progressBar.setVisibility(0 == message.length() ? View.VISIBLE : View.GONE); TextView messageTextView = (TextView) this.view.findViewById(R.id.message); if (null == messageTextView) { ViewStub stub = (ViewStub) this.view.findViewById(R.id.empty_view_stub); if (null != stub) stub.inflate();//from www . j a va 2 s .c o m messageTextView = (TextView) this.view.findViewById(R.id.message); } messageTextView.setVisibility(View.VISIBLE); messageTextView.setText(message); }