List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate)
From source file:com.cs411.trackallthethings.MyItems.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myitems);//from w w w . j a v a 2s. c o m // bind the ArrayList of Item Objects to the Array Adapter // and then bind the Array Adapter to the ListView ListView myItemsFeed = (ListView) findViewById(R.id.myitemsfeed); myItemsAdapter = new ArrayAdapter<Item>(this, R.layout.item, myItems); myItemsFeed.setAdapter(myItemsAdapter); // fire up an AsyncTask to get the user's items //show the loading dialog loading = ProgressDialog.show(MyItems.this, "", "Getting your items...", true); getMyItems task = new getMyItems(MyItems.this, "http://www.trackallthethings.com/mobile-api/display_user_inventory_items.php"); task.execute(); Button back = (Button) findViewById(R.id.backfrommyitems); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myItemsAdapter != null) myItemsAdapter.clear(); finish(); } }); }
From source file:org.maikelwever.droidpile.SendMailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_send_mail); this.context = getApplicationContext(); addressView = (ContactsCompletionView) findViewById(R.id.sendViewAdresses); ccView = (ContactsCompletionView) findViewById(R.id.sendViewCC); //bccView = (ContactsCompletionView) findViewById(R.id.sendViewBCC); //getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.title_activity_send_mail); String savedMid;//w ww . j a v a2s . co m try { Bundle bundle = getIntent().getExtras(); savedMid = bundle.getString("draft-mid"); } catch (Exception e) { savedMid = ""; } if (!savedMid.isEmpty()) { progressDialog = ProgressDialog.show(SendMailActivity.this, "", getString(R.string.download_please_wait), true); new FetchDraft().execute(savedMid); } if (contacts == null) { new FetchContactsTask().execute("not needed?"); } }
From source file:com.playcez.GooglePlus.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = getIntent(); if (intent == null || !intent.hasExtra("token")) { AuthUtils.refreshAuthToken(this); return;/*from w w w . java2 s . c om*/ } setContentView(R.layout.activity_list); mListView = (ListView) findViewById(R.id.activityList); loginProgress = ProgressDialog.show(GooglePlus.this, "Please wait", "Autheticating...", true); AsyncTask<String, Void, List<Activity>> task = new AsyncTask<String, Void, List<Activity>>() { @Override protected List<Activity> doInBackground(String... params) { try { plus = new PlusWrap(GooglePlus.this).get(); Person mePerson = plus.people().get("me").execute(); Log.d(TAG, "ID:\t" + mePerson.getId()); Log.d(TAG, "Display Name:\t" + mePerson.getDisplayName()); Log.d(TAG, "Image URL:\t" + mePerson.getImage().getUrl()); Log.d(TAG, "Profile URL:\t" + mePerson.getUrl()); final String TOKEN = "access_token"; SharedPreferences myData = getSharedPreferences("myData", MODE_PRIVATE); Editor edit = myData.edit(); edit.putString(TOKEN, "access_token"); edit.putString("uid", mePerson.getId()); edit.commit(); Log.d(TAG, "hererre"); String placesLived = ""; String name = ""; String json = ""; JSONArray obj = null; try { name = mePerson.getDisplayName().toString(); placesLived = mePerson.getPlacesLived().toString(); List<PersonPlacesLived> object = mePerson.getPlacesLived(); json = object.toString(); obj = new JSONArray(json); json = obj.toString(); } catch (Exception e) { e.printStackTrace(); } final SharedPreferences settings = getSharedPreferences(AuthUtils.PREFS_NAME, 0); final String account_name = settings.getString(AuthUtils.PREF_ACCOUNT_NAME, ""); final String accessToken = settings.getString("accessToken", null); sendToServer("https://playcez.com/api_getUID.php", name, mePerson.getBirthday(), mePerson.getId(), mePerson.getCurrentLocation(), obj, mePerson.getGender(), accessToken, account_name); return plus.activities().list("me", "public").execute().getItems(); } catch (IOException e) { loginProgress.dismiss(); Toast.makeText(getApplicationContext(), "Check your network connection!", Toast.LENGTH_LONG) .show(); Log.e(TAG, "Unable to list recommended people for user: " + params[0], e); } return null; } @Override protected void onPostExecute(List<Activity> feed) { if (feed != null) { Log.d(TAG, feed + ""); SharedPreferences data = getSharedPreferences("myData", MODE_PRIVATE); boolean showTut = data.getBoolean("showTut", true); Editor myEdit = data.edit(); myEdit.putBoolean("showTut", false); myEdit.commit(); if (showTut) { startActivity(new Intent(getApplicationContext(), Tutorial3.class)); } else { startActivity(new Intent(getApplicationContext(), Start_Menu.class)); } finish(); } else { } } }; task.execute("me"); }
From source file:com.cs411.trackallthethings.ItemsOnLoan.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.itemsonloan); // bind the ArrayList of Item Objects to the Array Adapter // and then bind the Array Adapter to the ListView ListView itemsOnLoanFeed = (ListView) findViewById(R.id.itemsonloanfeed); itemsOnLoanAdapter = new ArrayAdapter<Item>(this, R.layout.item, itemsOnLoan); itemsOnLoanFeed.setAdapter(itemsOnLoanAdapter); // fire up an AsyncTask to get the user's items //show the loading dialog loading = ProgressDialog.show(ItemsOnLoan.this, "", "Getting your items on loan...", true); getItemsOnLoan task = new getItemsOnLoan(ItemsOnLoan.this, "http://www.trackallthethings.com/mobile-api/items_on_loan.php?user_id=" + Main.user_id); task.execute();//from w w w . j a va 2 s. c o m Button back = (Button) findViewById(R.id.backfromloan); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (itemsOnLoanAdapter != null) itemsOnLoanAdapter.clear(); finish(); } }); }
From source file:edu.usf.cutr.opentripplanner.android.tasks.ServerChecker.java
@Override protected void onPreExecute() { if (activity.get() != null) { progressDialog.setIndeterminate(true); progressDialog.setCancelable(true); progressDialog = ProgressDialog.show(activity.get(), "", context.getString(R.string.server_checker_progress), true); }/*from ww w. j a va 2s. co m*/ }
From source file:angeloid.dreamnarae.Delete_Main.java
private void DialogProgress(boolean close) { if (!close) { dialog_delete = ProgressDialog.show(getActivity(), "", "Loading..", true); Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { @Override//from ww w .j a va2 s . c o m public void run() { DialogProgress(true); // . Delete_Helper.instantExec_delete(getActivity(), "busybox mount -o rw,remount /system ; "); StringBuilder delete = new StringBuilder(); try { Thread.sleep(2000); // Mount rw /system delete.append("mount -o rw,remount /system;"); // Delete Flag Files delete.append("rm /system/SPiCa;"); delete.append("rm /system/DN;"); delete.append("rm /system/Miracle;"); delete.append("rm /system/Save;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_spica;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_save;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_prev;"); delete.append("rm /system/98banner_dreamnarae_spica;"); delete.append("rm /system/98banner_dreamnarae_miracle;"); delete.append("rm /system/98banner_dreamnarae_save;"); delete.append("rm /system/98banner_dreamnarae_prev;"); // Delete old Script Manager Files delete.append("rm /system/bin/EnableDN.sh;"); delete.append("rm /data/DNEnable;"); delete.append("rm /system/bin/RemoveDN.sh;"); delete.append("rm /data/DNMiracle.sh;"); delete.append("rm /data/DNSPiCa.sh;"); delete.append("rm /data/DNSave.sh;"); delete.append("rm /data/DNPrev.sh;"); // Delete New Script Manager Files delete.append("rm /system/etc/install-recovery.sh;"); // Delete DreamNarae SPiCa delete.append("rm /system/etc/init.d/00prop;"); delete.append("rm /system/etc/init.d/01io;"); delete.append("rm /system/etc/init.d/02freq;"); delete.append("rm /system/etc/init.d/03zipalign;"); delete.append("rm /system/etc/init.d/01kswapd0;"); delete.append("rm /system/etc/init.d/02io;"); delete.append("rm /system/etc/init.d/03freq;"); delete.append("rm /system/etc/init.d/04zipalign;"); delete.append("rm /system/angeloidteam/dreamnarae/00prop;"); delete.append("rm /system/angeloidteam/dreamnarae/01io;"); delete.append("rm /system/angeloidteam/dreamnarae/02freq;"); //Delete DreamNarae Miracle delete.append("rm /system/etc/init.d/00set;"); delete.append("rm /system/etc/init.d/01property;"); delete.append("rm /system/etc/init.d/02vsls;"); delete.append("rm /system/etc/init.d/03dch;"); delete.append("rm /system/etc/init.d/04zip;"); delete.append("rm /system/angeloidteam/dreamnarae/00set;"); delete.append("rm /system/angeloidteam/dreamnarae/01property;"); delete.append("rm /system/angeloidteam/dreamnarae/02vsls;"); delete.append("rm /system/angeloidteam/dreamnarae/03dch;"); //Delete DreamNarae Save delete.append("rm /system/etc/init.d/00sp;"); delete.append("rm /system/etc/init.d/01v;"); delete.append("rm /system/etc/init.d/02deep;"); delete.append("rm /system/etc/init.d/03zip;"); delete.append("rm /system/angeloidteam/dreamnarae/00sp;"); delete.append("rm /system/angeloidteam/dreamnarae/01v;"); delete.append("rm /system/angeloidteam/dreamnarae/02deep;"); // Delete DreamNarae Prev delete.append("rm /system/etc/init.d/00proppv;"); delete.append("rm /system/etc/init.d/01kswapd0pv;"); delete.append("rm /system/etc/init.d/02iopv;"); delete.append("rm /system/etc/init.d/03freqpv;"); delete.append("rm /system/etc/init.d/04zippv;"); delete.append("rm /system/etc/init.d/01iopv;"); delete.append("rm /system/etc/init.d/02freqpv;"); delete.append("rm /system/angeloidteam/dreamnarae/00propv;"); delete.append("rm /system/angeloidteam/dreamnarae/01iopv;"); delete.append("rm /system/angeloidteam/dreamnarae/02freqpv;"); // Mount ro /system delete.append("busybox mount -o ro,remount /system;"); // Reboot device(Only to Progress1) delete.append("reboot;"); try { Thread.sleep(3000); Delete_Helper.instantExec_delete(getActivity(), delete.toString()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 10000); } else { dialog_delete.dismiss(); // DialogProgress(true) ,false } }
From source file:edu.cwru.apo.Directory.java
private void loadTable() { ProgressDialog progDialog = ProgressDialog.show(this, "Loading", "Please Wait", false); userTable.removeAllViews();/*from ww w .j a v a2s . c o m*/ Cursor results = database.query("phoneDB", new String[] { "first", "last", "_id", "phone" }, null, null, null, null, "first"); String rowText = ""; TableRow row; TextView text; if (!results.moveToFirst()) return; while (!results.isAfterLast()) { String phoneNumber = removeNonDigits(results.getString(3)); if (!(phoneNumber == null || phoneNumber.trim().equals("") || phoneNumber.trim().equals("null"))) { rowText = results.getString(0) + " " + results.getString(1) + " [" + results.getString(2) + "]"; row = new TableRow(this); text = new TextView(this); row.setPadding(0, 5, 0, 5); text.setClickable(true); text.setOnClickListener(this); //text.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); text.setText(rowText); userTable.addView(row); row.addView(text); } results.moveToNext(); } progDialog.cancel(); }
From source file:com.acceleratedio.pac_n_zoom.PickAnmActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pick_anm); progress = ProgressDialog.show(this, "Loading the matching animations", "dialog message", true); EventBus.getDefault().register(this); req_str = getIntent().getExtras().getString("requestString").trim(); mod_str = getIntent().getExtras().getString("mode").trim(); MakePostRequest get_tags = new MakePostRequest(); get_tags.execute(req_str);/* w ww . j a v a 2 s .c om*/ searchEditText = (EditText) findViewById(R.id.ed_tags); searchEditText.setOnClickListener(new View.OnClickListener() { public void onClick(View vw) { Intent intent = new Intent(PickAnmActivity.this, com.acceleratedio.pac_n_zoom.FindTagsActivity.class); intent.putExtra("requestString", req_str); intent.putExtra("tagString", top_dim[1]); startActivity(intent); } }); }
From source file:com.harshad.linconnectclient.ApplicationSettingsActivity.java
private void setupSimplePreferencesScreen() { addPreferencesFromResource(R.xml.pref_application); applicationCategory = (PreferenceCategory) findPreference("header_application"); // Listen for check/uncheck all tap findPreference("pref_all").setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override/*w w w.j ava 2 s .com*/ public boolean onPreferenceChange(Preference arg0, Object arg1) { for (int i = 0; i < applicationCategory.getPreferenceCount(); i++) { // Uncheck or check all items ((CheckBoxPreference) (applicationCategory.getPreference(i))).setChecked((Boolean) arg1); } return true; } }); class ApplicationTask extends AsyncTask<String, Void, List<ApplicationInfo>> { private PackageManager packageManager; @Override protected void onPreExecute() { progressDialog = ProgressDialog.show(ApplicationSettingsActivity.this, null, "Loading...", true); } @Override protected List<ApplicationInfo> doInBackground(String... notif) { packageManager = getApplicationContext().getPackageManager(); // Comparator used to sort applications by name class CustomComparator implements Comparator<ApplicationInfo> { @Override public int compare(ApplicationInfo arg0, ApplicationInfo arg1) { return arg0.loadLabel(packageManager).toString() .compareTo(arg1.loadLabel(packageManager).toString()); } } // Get installed applications Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); List<ApplicationInfo> appList = getApplicationContext().getPackageManager() .getInstalledApplications(PackageManager.GET_META_DATA); // Sort by application name Collections.sort(appList, new CustomComparator()); return appList; } @Override protected void onPostExecute(List<ApplicationInfo> result) { // Add each application to screen for (ApplicationInfo appInfo : result) { CheckBoxPreference c = new CheckBoxPreference(ApplicationSettingsActivity.this); c.setTitle(appInfo.loadLabel(packageManager).toString()); c.setSummary(appInfo.packageName); c.setIcon(appInfo.loadIcon(packageManager)); c.setKey(appInfo.packageName); c.setChecked(true); c.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference arg0, Object arg1) { // On tap, show an enabled/disabled notification on the desktop Object[] notif = new Object[3]; if (arg1.toString().equals("true")) { notif[0] = arg0.getTitle().toString() + " notifications enabled"; notif[1] = "via LinConnect"; notif[2] = arg0.getIcon(); } else { notif[0] = arg0.getTitle().toString() + " notifications disabled"; notif[1] = "via LinConnect"; notif[2] = arg0.getIcon(); } new TestTask().execute(notif); return true; } }); applicationCategory.addPreference(c); } progressDialog.dismiss(); } } new ApplicationTask().execute(); }
From source file:eu.trentorise.smartcampus.ac.authenticator.AuthenticatorActivity.java
@Override protected void setUp() { Intent request = getIntent();/*from www. j a v a 2 s . c o m*/ String authTokenType = request.getStringExtra(Constants.KEY_AUTHORITY) != null ? request.getStringExtra(Constants.KEY_AUTHORITY) : Constants.AUTHORITY_DEFAULT; if (Constants.TOKEN_TYPE_ANONYMOUS.equals(authTokenType)) { new AsyncTask<Void, Void, UserData>() { private ProgressDialog progress = null; protected void onPostExecute(UserData result) { if (progress != null) { try { progress.cancel(); } catch (Exception e) { Log.w(getClass().getName(), "Problem closing progress dialog: " + e.getMessage()); } } if (result != null && result.getToken() != null) { getAuthListener().onTokenAcquired(result); } else { getAuthListener().onAuthFailed("Failed to create anonymous account"); } // TODO } @Override protected void onPreExecute() { progress = ProgressDialog.show(AuthenticatorActivity.this, "", AuthenticatorActivity.this.getString(R.string.auth_in_progress), true); super.onPreExecute(); } @Override protected UserData doInBackground(Void... params) { try { return RemoteConnector.createAnonymousUser(Constants.getAuthUrl(AuthenticatorActivity.this), new DeviceUuidFactory(AuthenticatorActivity.this).getDeviceUuid().toString()); } catch (NameNotFoundException e) { Log.e(Authenticator.class.getName(), "Failed to create anonymous user: " + e.getMessage()); return null; } } }.execute(); } else { super.setUp(); } }