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.mediaexplorer.remote.MexRemoteActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//from w w w . j av a 2 s .co m this.setTitle(R.string.app_name); dbg = "MexWebremote"; text_view = (TextView) findViewById(R.id.text); web_view = (WebView) findViewById(R.id.link_view); web_view.getSettings().setJavaScriptEnabled(true);/* /* Future: setOverScrollMode is API level >8 * web_view.setOverScrollMode (OVER_SCROLL_NEVER); */ web_view.setBackgroundColor(0); web_view.setWebViewClient(new WebViewClient() { /* for some reason we only get critical errors so an auth error * is not handled here which is why there is some crack that test * the connection with a special httpclient */ @Override public void onReceivedHttpAuthRequest(final WebView view, final HttpAuthHandler handler, final String host, final String realm) { String[] userpass = new String[2]; userpass = view.getHttpAuthUsernamePassword(host, realm); HttpResponse response = null; HttpGet httpget; DefaultHttpClient httpclient; String target_host; int target_port; target_host = MexRemoteActivity.this.target_host; target_port = MexRemoteActivity.this.target_port; /* We may get null from getHttpAuthUsernamePassword which will * break the setCredentials so junk used instead to keep * it happy. */ Log.d(dbg, "using the set httpauth, testing auth using client"); try { if (userpass == null) { userpass = new String[2]; userpass[0] = "none"; userpass[1] = "none"; } } catch (Exception e) { userpass = new String[2]; userpass[0] = "none"; userpass[1] = "none"; } /* Log.d ("debug", * "trying: GET http://"+userpass[0]+":"+userpass[1]+"@"+target_host+":"+target_port+"/"); */ /* We're going to test the authentication credentials that we * have before using them so that we can act on the response. */ httpclient = new DefaultHttpClient(); httpget = new HttpGet("http://" + target_host + ":" + target_port + "/"); httpclient.getCredentialsProvider().setCredentials(new AuthScope(target_host, target_port), new UsernamePasswordCredentials(userpass[0], userpass[1])); try { response = httpclient.execute(httpget); } catch (IOException e) { Log.d(dbg, "Problem executing the http get"); e.printStackTrace(); } Log.d(dbg, "HTTP reponse:" + Integer.toString(response.getStatusLine().getStatusCode())); if (response.getStatusLine().getStatusCode() == 401) { /* We got Authentication failed (401) so ask user for u/p */ /* login dialog box */ final AlertDialog.Builder logindialog; final EditText user; final EditText pass; LinearLayout layout; LayoutParams params; TextView label_username; TextView label_password; logindialog = new AlertDialog.Builder(MexRemoteActivity.this); logindialog.setTitle("Mex Webremote login"); user = new EditText(MexRemoteActivity.this); pass = new EditText(MexRemoteActivity.this); layout = new LinearLayout(MexRemoteActivity.this); pass.setTransformationMethod(new PasswordTransformationMethod()); layout.setOrientation(LinearLayout.VERTICAL); params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); layout.setLayoutParams(params); user.setLayoutParams(params); pass.setLayoutParams(params); label_username = new TextView(MexRemoteActivity.this); label_password = new TextView(MexRemoteActivity.this); label_username.setText("Username:"); label_password.setText("Password:"); layout.addView(label_username); layout.addView(user); layout.addView(label_password); layout.addView(pass); logindialog.setView(layout); logindialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); logindialog.setPositiveButton("Login", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String uvalue = user.getText().toString().trim(); String pvalue = pass.getText().toString().trim(); view.setHttpAuthUsernamePassword(host, realm, uvalue, pvalue); handler.proceed(uvalue, pvalue); } }); logindialog.show(); /* End login dialog box */ } else /* We didn't get a 401 */ { handler.proceed(userpass[0], userpass[1]); } } /* End onReceivedHttpAuthRequest */ }); /* End Override */ /* Run mdns to check for service in a "runnable" (async) */ handler.post(new Runnable() { public void run() { startMdns(); } }); dialog = ProgressDialog.show(MexRemoteActivity.this, "", "Searching...", true); /* Let's put something in the webview while we're waiting */ String summary = "<html><head><style>body { background-color: #000000; color: #ffffff; }></style></head><body><p>Searching for the media explorer webservice</p><p>More infomation on <a href=\"http://media-explorer.github.com\" >Media Explorer's home page</a></p></body></html>"; web_view.loadData(summary, "text/html", "utf-8"); }
From source file:angeloid.dreamnarae.Delete_Main.java
private void DialogProgress2(boolean close) { if (!close) { dialog_delete2 = ProgressDialog.show(getActivity(), "", "Loading..", true); Handler mHandler2 = new Handler(); mHandler2.postDelayed(new Runnable() { @Override//from www. jav a2 s .c o m public void run() { DialogProgress2(true); // . Delete_Helper2.instantExec_delete2(getActivity(), "busybox mount -o rw,remount /system ; "); StringBuilder delete2 = new StringBuilder(); try { Thread.sleep(2000); // Mount rw /system delete2.append("mount -o rw,remount /system;"); // Delete Flag Files delete2.append("rm /system/SPiCa;"); delete2.append("rm /system/DN;"); delete2.append("rm /system/Miracle;"); delete2.append("rm /system/Save;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_spica;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_save;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_prev;"); delete2.append("rm /system/98banner_dreamnarae_spica;"); delete2.append("rm /system/98banner_dreamnarae_miracle;"); delete2.append("rm /system/98banner_dreamnarae_save;"); delete2.append("rm /system/98banner_dreamnarae_prev;"); // Delete old Script Manager Files delete2.append("rm /system/bin/EnableDN.sh;"); delete2.append("rm /data/DNEnable;"); delete2.append("rm /system/bin/RemoveDN.sh;"); delete2.append("rm /data/DNMiracle.sh;"); delete2.append("rm /data/DNSPiCa.sh;"); delete2.append("rm /data/DNSave.sh;"); delete2.append("rm /data/DNPrev.sh;"); // Delete New Script Manager Files delete2.append("rm /system/etc/install-recovery.sh;"); // Delete DreamNarae SPiCa delete2.append("rm /system/etc/init.d/00prop;"); delete2.append("rm /system/etc/init.d/01io;"); delete2.append("rm /system/etc/init.d/02freq;"); delete2.append("rm /system/etc/init.d/03zipalign;"); delete2.append("rm /system/etc/init.d/01kswapd0;"); delete2.append("rm /system/etc/init.d/02io;"); delete2.append("rm /system/etc/init.d/03freq;"); delete2.append("rm /system/etc/init.d/04zipalign;"); delete2.append("rm /system/angeloidteam/dreamnarae/00prop;"); delete2.append("rm /system/angeloidteam/dreamnarae/01io;"); delete2.append("rm /system/angeloidteam/dreamnarae/02freq;"); //Delete DreamNarae Miracle delete2.append("rm /system/etc/init.d/00set;"); delete2.append("rm /system/etc/init.d/01property;"); delete2.append("rm /system/etc/init.d/02vsls;"); delete2.append("rm /system/etc/init.d/03dch;"); delete2.append("rm /system/etc/init.d/04zip;"); delete2.append("rm /system/angeloidteam/dreamnarae/00set;"); delete2.append("rm /system/angeloidteam/dreamnarae/01property;"); delete2.append("rm /system/angeloidteam/dreamnarae/02vsls;"); delete2.append("rm /system/angeloidteam/dreamnarae/03dch;"); //Delete DreamNarae Save delete2.append("rm /system/etc/init.d/00sp;"); delete2.append("rm /system/etc/init.d/01v;"); delete2.append("rm /system/etc/init.d/02deep;"); delete2.append("rm /system/etc/init.d/03zip;"); delete2.append("rm /system/angeloidteam/dreamnarae/00sp;"); delete2.append("rm /system/angeloidteam/dreamnarae/01v;"); delete2.append("rm /system/angeloidteam/dreamnarae/02deep;"); // Delete DreamNarae Prev delete2.append("rm /system/etc/init.d/00proppv;"); delete2.append("rm /system/etc/init.d/01kswapd0pv;"); delete2.append("rm /system/etc/init.d/02iopv;"); delete2.append("rm /system/etc/init.d/03freqpv;"); delete2.append("rm /system/etc/init.d/04zippv;"); delete2.append("rm /system/etc/init.d/01iopv;"); delete2.append("rm /system/etc/init.d/02freqpv;"); delete2.append("rm /system/angeloidteam/dreamnarae/00propv;"); delete2.append("rm /system/angeloidteam/dreamnarae/01iopv;"); delete2.append("rm /system/angeloidteam/dreamnarae/02freqpv;"); // Mount ro /system delete2.append("busybox mount -o ro,remount /system;"); try { Thread.sleep(3000); Delete_Helper2.instantExec_delete2(getActivity(), delete2.toString()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 15000); } else { dialog_delete2.dismiss(); // DialogProgress(true) ,false } }
From source file:com.kinvey.scrumptious.SelectionFragment.java
private void handleAnnounce() { pendingAnnounce = false;/* w ww . ja v a2s. co m*/ for (BaseListElement element : listElements) { element.populateOGAction(eatAction); } Session session = Session.getActiveSession(); // Show a progress dialog because sometimes the requests can take a while. progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getResources().getString(R.string.progress_dialog_text), true); if (!kinveyClient.user().isUserLoggedIn() && session != null) { kinveyClient.user().loginFacebook(session.getAccessToken(), new KinveyUserCallback() { @Override public void onFailure(Throwable t) { dismissProgressListener(); Log.e(TAG, "Login Failure"); Toast.makeText(getActivity(), "Failed to login", Toast.LENGTH_LONG).show(); } @Override public void onSuccess(User result) { Log.i(TAG, "User logged into Kinvey"); sendPicture(); } }); } else { sendPicture(); } }
From source file:eu.dirtyharry.androidopsiadmin.Main.java
public void buttonListener(final View view) { if (vibrate) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); }// w w w .ja v a 2 s .c o m // new Functions().noPreferences(Main.this, // getString(R.string.gen_title_error), // getString(R.string.gen_setpreferences)); if (!new Functions().checkPreferences(Main.this)) { new Functions().noPreferences(Main.this, getString(R.string.gen_title_error), getString(R.string.gen_setserverpreferences)); return; } // noPreferences(Main.this, // getString(R.string.gen_title_error), // getString(R.string.gen_setpreferences)); switch (view.getId()) { case R.id.bt_scanqr: // Intent intent = new // Intent("com.google.zxing.client.android.SCAN"); // intent.setPackage("com.google.zxing.client.android"); // intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); // setResult(RESULT_OK, intent); // startActivityForResult(intent, 0); Intent qrDroid = new Intent("la.droid.qr.scan"); qrDroid.putExtra("la.droid.qr.complete", true); try { startActivityForResult(qrDroid, GET_QR); } catch (ActivityNotFoundException activity) { Functions.qrDroidRequired(Main.this); } break; case R.id.bt_getopsiclients: Log.d("Barcode", "getopsiclient"); // if (Networking.isConnected(Main.this)) { getOpsiClientsTask(); // } else { // Toast.makeText(Main.this, R.string.to_wifinotconnected, // Toast.LENGTH_LONG).show(); // } break; case R.id.bt_defineclientselection: if (Networking.isConnected(Main.this)) { final ProgressDialog dialog = ProgressDialog.show(Main.this, getString(R.string.gen_title_pleasewait), getString(R.string.pd_getclients), true); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); if (GlobalVar.getInstance().getError().equals("null")) { if (doit.equals("serverdown")) { Toast.makeText(Main.this, String.format(getString(R.string.to_servernotrechable), serverip), Toast.LENGTH_LONG).show(); } } else { new Functions().msgBox(Main.this, getString(R.string.gen_title_error), GlobalVar.getInstance().getError(), false); } } }; Thread checkUpdate = new Thread() { public void run() { Looper.prepare(); if (Networking.isServerUp(serverip, serverport, serverusername, serverpasswd)) { doit = "true"; Intent i = new Intent(Main.this, ShowOpsiClientFilter.class); startActivity(i); } else { doit = "serverdown"; } handler.sendEmptyMessage(0); } }; checkUpdate.start(); } else { Toast.makeText(Main.this, R.string.to_wifinotconnected, Toast.LENGTH_LONG).show(); } break; case R.id.bt_createopsiclient: // new Functions().notImplementet(Main.this); Intent i = new Intent(Main.this, ShowOpsiCreateClient.class); startActivity(i); break; case R.id.bt_showdepotconfig: // new Functions().notImplementet(Main.this); Log.d("Barcode", "depotconfig"); if (Networking.isConnected(Main.this)) { getOPSIDepots(); } else { Toast.makeText(Main.this, R.string.to_wifinotconnected, Toast.LENGTH_LONG).show(); } break; // case R.id.bt_test: // ArrayList<String> test = new ArrayList<String>(); // test.add("test1"); // test.add("test2"); // test.add("test3"); // test.add("test4"); // ShowOpsiClientOptionsButtonDialog buttondialog = new // ShowOpsiClientOptionsButtonDialog(Main.this,test); // buttondialog.setTitle("testtitle"); // buttondialog.show(); // break; } }
From source file:fi.mikuz.boarder.gui.DropboxMenu.java
private void loadCbla() throws NullPointerException { mCbla = new ExtendedCheckBoxListAdapter(this); if (mOperation == UPLOAD_OPERATION) { setTitle("Dropbox - Upload"); for (File file : SoundboardMenu.mSbDir.listFiles()) { if (file.isDirectory()) { mCbla.addItem(new ExtendedCheckBox(file.getName(), false)); }/*from w w w .j av a 2s . c o m*/ } mHandler.post(mUpdateList); } else if (mOperation == DOWNLOAD_OPERATION) { setTitle("Dropbox - Download"); mWaitDialog = ProgressDialog.show(this, "", "Please wait", true); mWaitDialog.setCancelable(true); t = new Thread() { public void run() { Looper.prepare(); try { DropboxAPI.Account account = null; try { account = mApi.accountInfo(); } catch (DropboxException e) { Log.e(TAG, "Account info missing", e); } if (account != null) { for (Entry board : mApi.metadata("/", 0, null, true, null).contents) { if (board.isDir) { mCbla.addItem(new ExtendedCheckBox(board.fileName(), false)); } } } else { mWaitDialog.dismiss(); } } catch (DropboxException e) { Log.e(TAG, "Error getting Dropbox content", e); } mHandler.post(mUpdateList); mWaitDialog.dismiss(); } }; t.start(); } }
From source file:com.cs411.trackallthethings.Scan.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // show that we're doing shit bro gettingItem = ProgressDialog.show(scanContext, "", "Getting item...", true); // the scan string result String result = data.getExtras().getString("la.droid.qr.result"); Log.d("result: ", result); String[] resultSplit = result.split("\\|"); // the case where there is no item_id in the scan result if (resultSplit.length < 1) { gettingItem.dismiss();/*from ww w . j a va 2 s . co m*/ return; } // get the item's information for (int i = 0; i < resultSplit.length; i++) { Log.d("resultSplit " + i, resultSplit[i]); } String item_id = resultSplit[resultSplit.length - 1]; Log.d("item_id: ", item_id); String responseString = ""; try { HttpGet httpget = new HttpGet( "http://www.trackallthethings.com/mobile-api/search_item?item_id=" + item_id); HttpResponse response; response = Main.httpclient.execute(httpget); HttpEntity entity = response.getEntity(); InputStream in = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String input = null; try { while ((input = reader.readLine()) != null) { sb.append(input + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } //parse the response responseString = sb.toString(); in.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // if the response was bad if (responseString.equals("") || responseString.contains("INVALID QR SCAN")) { gettingItem.dismiss(); return; } // make the item try { JSONObject itemData = new JSONObject(responseString); scannedItem = new Item(itemData); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // if the item was made properly, let's display its info if (scannedItem != null) { TextView scanItemInfo = (TextView) findViewById(R.id.scaniteminfo); scanItemInfo.setText(scannedItem.toString()); } gettingItem.dismiss(); }
From source file:com.baozi.activity.NpcBusinessRegisterActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.tianjiayingyezhizhao: iv = yingyezhizhao;// w ww.j av a 2s .c om // if (mSelectPath != null && mSelectPath.size() > 0) { intent.putExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, mSelectPath); } startActivityForResult(intent, REQUEST_IMAGE); break; case R.id.tianjiashenfenzheng: iv = farenshenfenzhengzhao; // if (mSelectPath != null && mSelectPath.size() > 0) { intent.putExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, mSelectPath); } startActivityForResult(intent, REQUEST_IMAGE); break; case R.id.zhuce: if (flag == 1 && yingyezhizhao.getDrawable() != null && farenshenfenzhengzhao.getDrawable() != null) { progressDialog = ProgressDialog.show(NpcBusinessRegisterActivity.this, "", "...", true); Message msg = myHandler.obtainMessage(); msg.what = Constants.REQUEST_OK; msg.obj = "{state:Success}"; myHandler.sendMessage(msg); } break; } }
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//w w w .jav a 2 s .c o 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.facebook.reflection.SelectionFragment.java
private void handleGraphApiAnnounce() { Session session = Session.getActiveSession(); List<String> permissions = session.getPermissions(); if (!permissions.contains(PERMISSION)) { pendingAnnounce = true;/*from w w w . j a va2 s . c o m*/ requestPublishPermissions(session); return; } // Show a progress dialog because sometimes the requests can take a while. progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getResources().getString(R.string.progress_dialog_text), true); // Run this in a background thread so we can process the list of responses and extract errors. AsyncTask<Void, Void, List<Response>> task = new AsyncTask<Void, Void, List<Response>>() { @Override protected List<Response> doInBackground(Void... voids) { EatAction eatAction = createEatAction(); RequestBatch requestBatch = new RequestBatch(); String photoStagingUri = null; if (photoUri != null) { try { Pair<File, Integer> fileAndMinDimemsion = getImageFileAndMinDimension(); if (fileAndMinDimemsion != null) { Request photoStagingRequest = Request.newUploadStagingResourceWithImageRequest( Session.getActiveSession(), fileAndMinDimemsion.first, null); photoStagingRequest.setBatchEntryName("photoStaging"); requestBatch.add(photoStagingRequest); // Facebook SDK * pro-tip * // We can use the result from one request in the batch as the input to another request. // In this case, the result from the staging upload is "uri", which we will use as the // input into the "url" field for images on the open graph action below. photoStagingUri = "{result=photoStaging:$.uri}"; eatAction.setImage(getImageListForAction(photoStagingUri, fileAndMinDimemsion.second >= USER_GENERATED_MIN_SIZE)); } } catch (FileNotFoundException e) { // NOOP - if we can't upload the image, just skip it for now } } MealGraphObject meal = eatAction.getMeal(); if (meal.getCreateObject()) { Request createObjectRequest = Request.newPostOpenGraphObjectRequest(Session.getActiveSession(), meal, null); createObjectRequest.setBatchEntryName("createObject"); requestBatch.add(createObjectRequest); eatAction.setProperty("meal", "{result=createObject:$.id}"); } Request request = Request.newPostOpenGraphActionRequest(Session.getActiveSession(), eatAction, null); requestBatch.add(request); return requestBatch.executeAndWait(); } @Override protected void onPostExecute(List<Response> responses) { // We only care about the last response, or the first one with an error. Response finalResponse = null; for (Response response : responses) { finalResponse = response; if (response != null && response.getError() != null) { break; } } onPostActionResponse(finalResponse); } }; task.execute(); }