Java Code Examples for android.app.Activity#setProgressBarIndeterminateVisibility()
The following examples show how to use
android.app.Activity#setProgressBarIndeterminateVisibility() .
These examples are extracted from open source projects.
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 Project: java-unified-sdk File: DemoBaseActivity.java License: Apache License 2.0 | 6 votes |
public void runMethod(final Activity demoRunActivity, final String methodName) { demoRunActivity.setProgressBarIndeterminateVisibility(true); new BackgroundTask() { @Override protected void doInBack() throws Exception { Method method = DemoUtils.getMethodSafely(DemoBaseActivity.this.getClass(), methodName); DemoUtils.invokeMethod(DemoBaseActivity.this, method); } @Override protected void onPost(Exception e) { demoRunActivity.setProgressBarIndeterminateVisibility(false); if (e != null) { if (e instanceof InvocationTargetException) { // 打印原方法抛出的异常 log("Error : %s", e.getCause().getMessage()); } else { log("Error : %s", e.getMessage()); } } else { log("%s Finished.", methodName); } } }.execute(); }
Example 2
Source Project: android-atleap File: ActivityHelper.java License: Apache License 2.0 | 6 votes |
/** * Change specified Progress Bar Visibility or Indeterminate Progress Bar * @param progressBar progress bar, could be <code>null</code> * @param show <code>true</code> if we would like to show */ public static void changeProgressBarVisibility(ProgressBar progressBar, Activity activity, boolean show) { if (progressBar != null) { if (show) progressBar.setVisibility(View.VISIBLE); else progressBar.setVisibility(View.GONE); } else { if (activity != null) { if (activity instanceof ActionBarActivity) { ActionBarActivity actionBarActivity = (ActionBarActivity) activity; actionBarActivity.setSupportProgressBarIndeterminateVisibility(show); } else { activity.setProgressBarIndeterminateVisibility(show); } } } }
Example 3
Source Project: TextFiction File: ImportTask.java License: Apache License 2.0 | 6 votes |
@Override public void onPostExecute(Exception result) { Activity context = master.getActivity(); if (result != null) { Toast.makeText(context, R.string.msg_failure_import, Toast.LENGTH_SHORT) .show(); } if (context != null) { context.setProgressBarIndeterminate(false); context.setProgressBarIndeterminateVisibility(false); context.setProgressBarVisibility(false); } if (result==null && context!=null && didImport) { Toast.makeText(context,R.string.msg_file_copied_you_may_delete_the_original_now,Toast.LENGTH_LONG).show(); } master.reScan(); }
Example 4
Source Project: TextFiction File: ImportTask.java License: Apache License 2.0 | 5 votes |
@Override public void onPreExecute() { Activity context = master.getActivity(); if (context != null) { context.setProgressBarIndeterminate(false); context.setProgressBarIndeterminateVisibility(false); context.setProgressBarVisibility(false); } }
Example 5
Source Project: clusterkraf File: DelayedIndeterminateProgressBarRunnable.java License: Apache License 2.0 | 5 votes |
@Override public void run() { Activity activity = activityRef.get(); if (activity != null) { activity.setProgressBarIndeterminateVisibility(true); } }
Example 6
Source Project: android-discourse File: UserFragment.java License: Apache License 2.0 | 4 votes |
private void showActonBarProgress() { Activity a = getActivity(); if (a != null) { a.setProgressBarIndeterminateVisibility(Boolean.TRUE); } }
Example 7
Source Project: android-discourse File: UserFragment.java License: Apache License 2.0 | 4 votes |
private void hideActonBarProgress() { Activity a = getActivity(); if (a != null) { a.setProgressBarIndeterminateVisibility(Boolean.FALSE); } }
Example 8
Source Project: android-discourse File: EditorFragment.java License: Apache License 2.0 | 4 votes |
private void showActonBarProgress() { Activity a = getActivity(); if (a != null) { a.setProgressBarIndeterminateVisibility(Boolean.TRUE); } }
Example 9
Source Project: android-discourse File: EditorFragment.java License: Apache License 2.0 | 4 votes |
private void hideActonBarProgress() { Activity a = getActivity(); if (a != null) { a.setProgressBarIndeterminateVisibility(Boolean.FALSE); } }