List of usage examples for android.app ProgressDialog dismiss
@Override public void dismiss()
From source file:net.networksaremadeofstring.pulsant.portal.TicketLanding.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); super.onCreate(savedInstanceState); setContentView(R.layout.ticketlanding); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Tickets"); final ListView list = (ListView) findViewById(R.id.TicketList); final ProgressDialog dialog = ProgressDialog.show(this, "Pulsant Portal", "Please wait: loading tickets....", true); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); if (Success.equals("true")) { UpdateErrorMessage(ErrorMessage); OpenTicketsAdaptor adapter = new OpenTicketsAdaptor(TicketLanding.this, listOfTickets, API.SessionID);// ww w .j a v a2 s .com list.setAdapter(adapter); } else { UpdateErrorMessage(ErrorMessage); } } }; Thread dataPreload = new Thread() { public void run() { try { TicketAPI = API.PortalQuery("tickets", "none"); Success = TicketAPI.getString("success"); } catch (JSONException e) { ErrorMessage = "An unrecoverable JSON Exception occured."; Success = "false"; } if (Success.equals("false")) { try { ErrorMessage = TicketAPI.getString("msg"); } catch (JSONException e) { ErrorMessage = "A JSON parsing error prevented an exact error message to be determined."; } } else { Log.i("APIFuncs", TicketAPI.toString()); try { Tickets = TicketAPI.getJSONArray("tickets"); ErrorMessage = ""; } catch (JSONException e) { ErrorMessage = "There are no open tickets for your account."; } //OK lets actually do something useful //ListView list = (ListView)findViewById(R.id.TicketList); //List<OpenTickets> listOfTickets = new ArrayList<OpenTickets>(); int TicketCount = Tickets.length(); if (TicketCount == 0) { ErrorMessage = "There are no open tickets for your account."; handler.sendEmptyMessage(0); return; } for (int i = 0; i < TicketCount; i++) { JSONObject CurrentTicket = null; try { CurrentTicket = Tickets.getJSONObject(i); } catch (JSONException e1) { Log.e("APIFuncs", e1.getMessage()); } try { listOfTickets.add(new OpenTickets(CurrentTicket.getString("status"), CurrentTicket.getInt("id"), CurrentTicket.getString("server"), CurrentTicket.getString("email"), CurrentTicket.getString("subject"), CurrentTicket.getInt("createdat"), CurrentTicket.getInt("lastupdate"), false)); //CurrentTicket.getBoolean("subscriber"))); } catch (JSONException e) { Log.e("APIFuncs", e.getMessage()); } } } handler.sendEmptyMessage(0); } }; dataPreload.start(); }
From source file:pranav.apps.amazing.hppoliceassistant.Search.java
@Override public boolean onQueryTextSubmit(String query) { ProgressDialog pg = ProgressDialog.show(Search.this, "Searching Challan", "Searching..."); final List<ChallanDetails> filteredChallan = filter(offlineList, query); adapterOffline.setFilter(filteredChallan); adapterOffline.notifyDataSetChanged(); pg.dismiss(); return true;/*from www .j a v a 2 s . co m*/ }
From source file:org.travey.travey.SurveysFragment.java
public void timerDelayRemoveDialog(long time, final ProgressDialog d) { new Handler().postDelayed(new Runnable() { public void run() { if (d.isShowing()) { TextView textView = (TextView) rootView.findViewById(R.id.textView); textView.setText(R.string.surveys_nointernet); d.dismiss(); }//from ww w. j av a 2 s . com } }, time); }
From source file:com.softminds.matrixcalculator.OperationFragments.DeterminantFragment.java
public void RunToGetDeterminant(final int pos, final ProgressDialog px) { Runnable runnable = new Runnable() { @Override//from w w w .ja v a 2 s. c om public void run() { double var = SquareList.get(pos).getDeterminant(px); Message message = new Message(); Bundle bundle = new Bundle(); bundle.putDouble("RESULTANT", var); message.setData(bundle); px.dismiss(); myhandler.sendMessage(message); } }; Thread thread = new Thread(runnable); thread.start(); }
From source file:com.dedipower.portal.android.CDNLanding.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); super.onCreate(savedInstanceState); setContentView(R.layout.cdnlanding); //Progress test list = (ListView) findViewById(R.id.CDNList); final ProgressDialog dialog = ProgressDialog.show(this, "DediPortal", "Please wait: loading data....", true);/* w w w . ja v a 2 s . c o m*/ final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); if (Success.equals("true")) { UpdateErrorMessage(ErrorMessage); CDNAdaptor adapter = new CDNAdaptor(CDNLanding.this, listOfCDNs); list.setAdapter(adapter); } else { UpdateErrorMessage(ErrorMessage); } } }; Thread dataPreload = new Thread() { public void run() { try { CDNs = API.PortalQuery("cdn", "none"); Success = CDNs.getString("success"); } catch (JSONException e) { ErrorMessage = "An unrecoverable JSON Exception occured."; //UpdateErrorMessage("An unrecoverable JSON Exception occured."); } if (Success.equals("false")) { try { //UpdateErrorMessage(CDNs.getString("msg")); ErrorMessage = CDNs.getString("msg"); } catch (JSONException e) { //UpdateErrorMessage("A JSON parsing error prevented an exact error message to be determined."); ErrorMessage = "A JSON parsing error prevented an exact error message to be determined."; } } else { try { CDNNodes = CDNs.getJSONArray("cdns"); //UpdateErrorMessage(""); ErrorMessage = ""; } catch (JSONException e) { //UpdateErrorMessage("There are no CDN nodes in your account."); ErrorMessage = "There are no CDN nodes in your account."; } int CDNCount = CDNNodes.length(); if (CDNCount == 0) { //UpdateErrorMessage("There are no CDN nodes for your account."); ErrorMessage = "There are no CDN nodes for your account."; Success = "false"; handler.sendEmptyMessage(0); } for (int i = 0; i < CDNCount; i++) { try { CurrentCDN = CDNNodes.getJSONObject(i); } catch (JSONException e1) { Log.e("APIFuncs", e1.getMessage()); } listOfCDNs.add(new CDN(GetString("name"), GetString("backend"), GetInt("bandwidthemea"), GetInt("bandwidthapac"), GetInt("bandwidthamericas"), GetBool("loadbalanced"))); } } handler.sendEmptyMessage(0); } }; dataPreload.start(); //Progress test /*try { CDNs = API.PortalQuery("cdn", "none"); Success = CDNs.getString("success"); } catch (JSONException e) { UpdateErrorMessage("An unrecoverable JSON Exception occured."); //Toast.makeText(ColoLanding.this, "An unrecoverable JSON Exception occured.", Toast.LENGTH_LONG).show(); } if(Success == "false") { try { UpdateErrorMessage(CDNs.getString("msg")); } catch (JSONException e) { UpdateErrorMessage("A JSON parsing error prevented an exact error message to be determined."); } } else { Log.i("APIFuncs",CDNs.toString()); try { CDNNodes = CDNs.getJSONArray("cdns"); UpdateErrorMessage(""); } catch (JSONException e) { UpdateErrorMessage("There are no CDN nodes in your account."); } //OK lets actually do something useful ListView list = (ListView)findViewById(R.id.CDNList); List<CDN> listOfCDNs = new ArrayList<CDN>(); int CDNCount = CDNNodes.length(); if(CDNCount == 0) { UpdateErrorMessage("There are no CDN nodes for your account."); return; } for(int i = 0; i < CDNCount; i++) { try { CurrentCDN = CDNNodes.getJSONObject(i); } catch (JSONException e1) { Log.e("APIFuncs",e1.getMessage()); } listOfCDNs.add(new CDN(GetString("name"), GetString("backend"), GetInt("bandwidthemea"), GetInt("bandwidthapac"), GetInt("bandwidthamericas"), GetBool("loadbalanced"))); } CDNAdaptor adapter = new CDNAdaptor(this, listOfCDNs); list.setAdapter(adapter); }*/ }
From source file:com.lauszus.dronedraw.DroneDrawActivity.java
private void uploadFileToDropbox(File file) { DbxClientV2 client;//from ww w.ja va2 s . c om try { client = DropboxClientFactory.getClient(); } catch (IllegalStateException e) { Toast.makeText(DroneDrawActivity.this, "Please setup your Dropbox account", Toast.LENGTH_SHORT).show(); return; } final ProgressDialog dialog = new ProgressDialog(this); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setCancelable(false); dialog.setMessage("Uploading to Dropbox"); dialog.show(); new UploadFileTask(client, new UploadFileTask.Callback() { @Override public void onUploadComplete(FileMetadata result) { dialog.dismiss(); Toast.makeText(DroneDrawActivity.this, "Path uploaded to Dropbox", Toast.LENGTH_SHORT).show(); } @Override public void onError(Exception e) { dialog.dismiss(); if (D) Log.e(TAG, "Failed to upload file: ", e); Toast.makeText(DroneDrawActivity.this, "Failed to upload path to Dropbox", Toast.LENGTH_SHORT) .show(); } }).execute(Uri.fromFile(file).toString(), ""); }
From source file:com.microsoft.live.sample.hotmail.ContactsActivity.java
private void loadContacts() { final ProgressDialog progDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true); mClient.getAsync("me/contacts", new LiveOperationListener() { @Override/*from ww w . j a va 2 s . co m*/ public void onError(LiveOperationException exception, LiveOperation operation) { progDialog.dismiss(); showToast(exception.getMessage()); } @Override public void onComplete(LiveOperation operation) { progDialog.dismiss(); JSONObject result = operation.getResult(); if (result.has(JsonKeys.ERROR)) { JSONObject error = result.optJSONObject(JsonKeys.ERROR); String message = error.optString(JsonKeys.MESSAGE); String code = error.optString(JsonKeys.CODE); showToast(code + ": " + message); return; } ArrayList<Contact> contacts = mAdapter.getContacts(); contacts.clear(); JSONArray data = result.optJSONArray(JsonKeys.DATA); for (int i = 0; i < data.length(); i++) { Contact contact = new Contact(data.optJSONObject(i)); contacts.add(contact); } mAdapter.notifyDataSetChanged(); } }); }
From source file:com.dedipower.portal.android.ColoLanding.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); super.onCreate(savedInstanceState); setContentView(R.layout.cololanding_iclone); //Temp//w ww .ja va 2 s. com list = (ListView) findViewById(R.id.ColoCabList); final ProgressDialog dialog = ProgressDialog.show(this, "DediPortal", "Please wait: loading data....", true); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); if (Success.equals("true")) { UpdateErrorMessage(ErrorMessage); ColoRacksAdaptor adapter = new ColoRacksAdaptor(ColoLanding.this, listOfColoRacks); list.setAdapter(adapter); } else { UpdateErrorMessage(ErrorMessage); } } }; Thread dataPreload = new Thread() { public void run() { try { Colo = API.PortalQuery("colocation", "none"); Success = Colo.getString("success"); } catch (JSONException e) { ErrorMessage = "An unrecoverable JSON Exception occurred."; //UpdateErrorMessage("An unrecoverable JSON Exception occurred."); } if (Success.equals("false")) { try { //UpdateErrorMessage(Colo.getString("msg")); ErrorMessage = Colo.getString("msg"); } catch (JSONException e) { ErrorMessage = "An unrecoverable JSON Exception occured."; //UpdateErrorMessage("An unrecoverable JSON Exception occured."); } } else { Log.i("APIFuncs", Colo.toString()); try { ColoCabs = Colo.getJSONArray("colocation"); ErrorMessage = ""; //UpdateErrorMessage(""); } catch (JSONException e) { ErrorMessage = "There are no Co-Location Cabinets in your account."; //UpdateErrorMessage("There are no Co-Location Cabinets in your account."); } int ColoCount = ColoCabs.length(); if (ColoCount == 0) { //UpdateErrorMessage("There are no colocation cabinets for your account."); ErrorMessage = "There are no colocation cabinets for your account."; handler.sendEmptyMessage(0); return; } for (int i = 0; i < ColoCount; i++) { JSONObject CurrentColo = null; try { CurrentColo = ColoCabs.getJSONObject(i); } catch (JSONException e1) { Log.e("APIFuncs", e1.getMessage()); } try { listOfColoRacks.add(new ColoRacks(CurrentColo.getString("ip"), CurrentColo.getString("servercode"), CurrentColo.getString("facility"), CurrentColo.getInt("bandwidth"), CurrentColo.getString("bandwidthTotal"), CurrentColo.getInt("transferlimit"), CurrentColo.getString("state"))); } catch (JSONException e) { Log.e("APIFuncs", e.getMessage()); } } } handler.sendEmptyMessage(0); } }; dataPreload.start(); //temp /*try { Colo = API.PortalQuery("colocation", "none"); Success = Colo.getString("success"); } catch (JSONException e) { UpdateErrorMessage("An unrecoverable JSON Exception occured."); //Toast.makeText(ColoLanding.this, "An unrecoverable JSON Exception occured.", Toast.LENGTH_LONG).show(); } if(Success == "false") { try { UpdateErrorMessage(Colo.getString("msg")); } catch (JSONException e) { UpdateErrorMessage("An unrecoverable JSON Exception occured."); } } else { Log.i("APIFuncs",Colo.toString()); try { ColoCabs = Colo.getJSONArray("colocation"); UpdateErrorMessage(""); } catch (JSONException e) { UpdateErrorMessage("There are no Co-Location Cabinets in your account."); } //OK lets actually do something useful ListView list = (ListView)findViewById(R.id.ColoCabList); List<ColoRacks> listOfColoRacks = new ArrayList<ColoRacks>(); int ColoCount = ColoCabs.length(); if(ColoCount == 0) { UpdateErrorMessage("There are no colocation cabinets for your account."); return; } for(int i = 0; i < ColoCount; i++) { JSONObject CurrentColo = null; try { CurrentColo = ColoCabs.getJSONObject(i); } catch (JSONException e1) { Log.e("APIFuncs",e1.getMessage()); } try { listOfColoRacks.add(new ColoRacks(CurrentColo.getString("ip"), CurrentColo.getString("servercode"), CurrentColo.getString("facility"), CurrentColo.getInt("bandwidth"), CurrentColo.getString("bandwidthTotal"), CurrentColo.getInt("transferlimit"), CurrentColo.getString("state"))); } catch (JSONException e) { Log.e("APIFuncs",e.getMessage()); } } ColoRacksAdaptor adapter = new ColoRacksAdaptor(this, listOfColoRacks); list.setAdapter(adapter); }*/ }
From source file:net.networksaremadeofstring.pulsant.portal.ManagedServerLanding.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); super.onCreate(savedInstanceState); setContentView(R.layout.managedserverlanding); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Managed Servers"); //temp/*from w w w. java 2 s. c o m*/ list = (ListView) findViewById(R.id.ManagedServerList); final ProgressDialog dialog = ProgressDialog.show(this, "Pulsant Portal", "Please wait: loading data....", true); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); if (Success.equals("true")) { UpdateErrorMessage(ErrorMessage); ManagedServerAdaptor adapter = new ManagedServerAdaptor(ManagedServerLanding.this, listOfManagedServers, API.SessionID); list.setAdapter(adapter); /*list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View view) { if (mActionMode != null) { Log.i("onLongClick","Nuhuh"); return false; } // Start the CAB using the ActionMode.Callback defined above mActionMode = startActionMode(mActionModeCallback); view.setSelected(true); return true; } });*/ } else { UpdateErrorMessage(ErrorMessage); } } }; Thread dataPreload = new Thread() { int ServerCount = 0; public void run() { try { Servers = API.PortalQuery("servers", "none"); Success = Servers.getString("success"); } catch (JSONException e) { //UpdateErrorMessage("An unrecoverable JSON Exception occured."); ErrorMessage = "An unrecoverable JSON Exception occured."; } if (Success.equals("false")) { try { //UpdateErrorMessage(Servers.getString("msg")); ErrorMessage = Servers.getString("msg"); } catch (JSONException e) { //UpdateErrorMessage("An unrecoverable JSON Exception occured."); ErrorMessage = "An unrecoverable JSON Exception occured."; } } else { Log.i("APIFuncs", Servers.toString()); try { ManagedServers = Servers.getJSONArray("servers"); //UpdateErrorMessage(""); ErrorMessage = ""; } catch (JSONException e) { //UpdateErrorMessage("There are no Managed servers in your account."); ErrorMessage = "There are no Managed servers in your account."; } try { ServerCount = ManagedServers.length(); } catch (Exception e) { ServerCount = 0; } if (ServerCount == 0) { ErrorMessage = "There are no Managed servers for your account."; handler.sendEmptyMessage(0); return; } for (int i = 0; i < ServerCount; i++) { try { CurrentServer = ManagedServers.getJSONObject(i).getJSONObject("Server"); } catch (JSONException e1) { Log.e("APIFuncs", e1.getMessage()); } //Log.e("APIFuncs",CurrentServer.toString(3)); listOfManagedServers.add(new ManagedServer(GetString("ip"), GetString("servercode"), GetString("description"), GetString("facility"), GetInt("bandwidth"), GetString("bandwidthTotal"), GetBool("monitored"), GetInt("transferlimit"), GetString("software"), GetString("state"), GetBool("managedbackupenabled"))); } } handler.sendEmptyMessage(0); } }; dataPreload.start(); }
From source file:org.catnut.fragment.TransientUsersFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { final TransientUser user = mUsers.get(position); CatnutAPI api = UserAPI.profile(user.id); final ProgressDialog loading = ProgressDialog.show(getActivity(), null, getString(R.string.loading)); loading.show();/* w ww . jav a 2s. co m*/ mRequestQueue.add(new CatnutRequest(getActivity(), api, new UserProcessor.UserProfileProcessor(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { loading.dismiss(); ProfileActivity activity = (ProfileActivity) getActivity(); activity.flipCard(ProfileFragment.getFragment(user.id, user.screenName), null, true); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { loading.dismiss(); Log.d(TAG, "load user profile error!", error); WeiboAPIError weiboAPIError = WeiboAPIError.fromVolleyError(error); Toast.makeText(getActivity(), weiboAPIError.error, Toast.LENGTH_LONG).show(); } })); }