List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:com.github.naofum.gogakudroid.AsyncDownload.java
@Override protected void onPreExecute() { Log.d(TAG, "onPreExecute"); progressDialog = new ProgressDialog(owner); progressDialog.setMessage(owner.getString(R.string.downloading)); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setCancelable(true);//from w w w . j av a 2 s . com progressDialog.setCanceledOnTouchOutside(false); progressDialog.setProgress(0); progressDialog.show(); }
From source file:github.nisrulz.sampleoptimushttp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Setup Data/*from w ww .j a va 2 s . c o m*/ data = new ArrayList<>(); data.add("POST Request"); data.add("GET Request"); data.add("PUT Request"); data.add("DELETE Request"); data.add("Cancel All Request"); progressDialog = new ProgressDialog(this); progressDialog.setMessage("Connecting"); textView_res = (TextView) findViewById(R.id.txt_res); //ListView lv = (ListView) findViewById(R.id.listView); adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, data); lv.setAdapter(adapter); // Initialize the OptimusHTTP Client client = new OptimusHTTP(this); // Enable Logs client.enableDebugging(); // Store the references of all the requests made in an arraylist for the purpose of cancelling them later on refHttpReqList = new ArrayList<>(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { switch (position) { case 0: { // POST // Create a param key value map to post in body of req ArrayMap<String, String> params = new ArrayMap<>(); params.put("email", "abc@abc.com"); params.put("mobileno", "000000000"); params.put("Key1", "value1"); params.put("key2", "value2"); // Set method client.setMethod(OptimusHTTP.METHOD_POST); // Set Mode client.setMode(OptimusHTTP.MODE_PARALLEL); // Set Connect Timeout client.setConnectTimeout(10 * 1000); //ms // Set Read Timeout client.setReadTimeout(10 * 1000); //ms // Set Content Type client.setContentType(OptimusHTTP.CONTENT_TYPE_JSON); // Create a map of header key value pair and set headers to the client ArrayMap<String, String> headerMap = new ArrayMap<>(); headerMap.put("Accept-Encoding", "gzip, deflate"); headerMap.put("Accept-Language", "en-US"); headerMap.put("Content-Language", "en-US"); client.setHeaderMap(headerMap); try { // makeRequest() returns the reference of the request made // which can be used later to call the cancelReq() if required // if no request is made the makeRequest() returns null progressDialog.show(); req = client.makeRequest(SERVER, params, new OptimusHTTP.ResponseListener() { @Override public void onSuccess(String msg) { progressDialog.dismiss(); getInfoFromJson(msg); } @Override public void onFailure(String msg) { progressDialog.dismiss(); loadInfo(msg); } }); if (req != null) { refHttpReqList.add(req); } } catch (Exception e) { e.printStackTrace(); } } break; case 1: { // GET ArrayMap<String, String> params = new ArrayMap<>(); params.put("email", "abc@abc.com"); params.put("mobileno", "000000000"); client.setMethod(OptimusHTTP.METHOD_GET); client.setMode(OptimusHTTP.MODE_SEQ); try { progressDialog.show(); req = client.makeRequest(SERVER, params, responseListener); if (req != null) { refHttpReqList.add(req); } } catch (Exception e) { e.printStackTrace(); } } break; case 2: { //PUT ArrayMap<String, String> params = new ArrayMap<>(); params.put("email", "abc@abc.com"); params.put("mobileno", "000000000"); params.put("Key1", "value3"); params.put("key2", "value2"); client.setMethod(OptimusHTTP.METHOD_PUT); client.setMode(OptimusHTTP.MODE_SEQ); try { progressDialog.show(); req = client.makeRequest(SERVER, params, responseListener); if (req != null) { refHttpReqList.add(req); } } catch (Exception e) { e.printStackTrace(); } } break; case 3: { // DELETE ArrayMap<String, String> params = new ArrayMap<>(); client.setMethod(OptimusHTTP.METHOD_DELETE); client.setMode(OptimusHTTP.MODE_SEQ); try { progressDialog.show(); req = client.makeRequest(SERVER, params, responseListener); if (req != null) { refHttpReqList.add(req); } } catch (Exception e) { e.printStackTrace(); } } break; case 4: { // Cancel All if (refHttpReqList.size() > 0) { view.setEnabled(false); for (int i = 0; i < refHttpReqList.size(); i++) client.cancelReq(refHttpReqList.get(i)); refHttpReqList.clear(); view.setEnabled(true); } } break; } } }); }
From source file:com.hx.template.ui.RegisterActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); ButterKnife.bind(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*ww w .j a v a2 s. c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); mProgressDialog = new ProgressDialog(this); countDownTimer = new CountDownTimer(60000, 1000) { @Override public void onTick(long millisUntilFinished) { if (getvcode != null) { getvcode.setText((millisUntilFinished / 1000) + ""); } } @Override public void onFinish() { if (getvcode != null) { getvcode.setText("???"); getvcode.setEnabled(true); } } }; }
From source file:com.ankit.touchreview.LoginActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.login);//from ww w. j av a 2s . co m mContext = this; mProcessing = new ProgressDialog(mContext); mProcessing.setCancelable(true); mProcessing.setMessage("Please Wait"); mProcessing.setTitle("Logging in"); mProcessing.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (logging_in) { Intent i = new Intent(LoginActivity.this, HomeActivity.class); startActivity(i); finish(); } } }); username = (TextView) findViewById(R.id.username); password = (TextView) findViewById(R.id.password); String token = Utility.getUserPrefernce(mContext, "token"); if (token != null && !"".equals(token)) { Intent i = new Intent(LoginActivity.this, HomeActivity.class); startActivity(i); finish(); } TextView thanking_text = (TextView) findViewById(R.id.thanking_text); thanking_text.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://touchtoreview.com/thankyou")); startActivity(myIntent); } }); }
From source file:com.ilearnrw.reader.tasks.AddToLibraryTask.java
@Override protected void onPreExecute() { dialog = new ProgressDialog(context); dialog.setTitle(context.getString(R.string.dialog_annotation_title)); dialog.setMessage(context.getString(R.string.dialog_annotation_message)); dialog.setCancelable(true);/* w w w .j av a 2s.c o m*/ dialog.setCanceledOnTouchOutside(false); dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(context, context.getString(R.string.annotation_aborted), Toast.LENGTH_SHORT) .show(); dialog.dismiss(); if (wakeLock.isHeld()) wakeLock.release(); if (wifiLock.isHeld()) wifiLock.release(); cancel(true); } }); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { Toast.makeText(context, context.getString(R.string.annotation_aborted), Toast.LENGTH_SHORT).show(); dialog.dismiss(); if (wakeLock.isHeld()) wakeLock.release(); if (wifiLock.isHeld()) wifiLock.release(); cancel(true); } }); dialog.show(); super.onPreExecute(); }
From source file:eu.codeplumbers.cosi.api.tasks.DeleteDocumentTask.java
public DeleteDocumentTask(String remoteId, Activity activity) { this.activity = activity; this.remoteId = remoteId; result = "";// w w w . j a va2 s. c o m Device device = Device.registeredDevice(); // cozy register device url this.url = device.getUrl() + "/ds-api/data/"; // concatenate username and password with colon for authentication final String credentials = device.getLogin() + ":" + device.getPassword(); authHeader = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); dialog = new ProgressDialog(activity); dialog.setCancelable(false); dialog.setMessage("Please wait"); dialog.setIndeterminate(true); dialog.show(); }
From source file:com.clutch.ClutchView.java
@SuppressLint("SetJavaScriptEnabled") private void clutchInit() { loading = new ProgressDialog(this.getContext()); loading.hide();/*from ww w. j a v a 2s. c om*/ this.setWebChromeClient(new WebChromeClient() { // TODO: Clutch Debug Toolbar @Override public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { if (!"methodCalled".equals(defaultValue)) { return false; } JSONObject jsonMessage = null; String methodName = null; String callbackId = null; JSONObject params = null; try { jsonMessage = new JSONObject(message); methodName = jsonMessage.getString("method"); callbackId = jsonMessage.getString("callbackNum"); params = jsonMessage.getJSONObject("args"); } catch (JSONException e) { Log.e(TAG, "Could not decode JSON: " + message); result.cancel(); return true; } if (methodName.equals("clutch.loading.begin")) { String loadingMessage = params.optString("text"); if (loadingMessage == null) { loadingMessage = "Loading..."; } else if ("null".equals(loadingMessage)) { loadingMessage = "Loading..."; } loading.setMessage(loadingMessage); loading.show(); } else if (methodName.equals("clutch.loading.end")) { loading.hide(); } ClutchCallback callback = null; if (!"0".equals(callbackId)) { callback = new ClutchCallback(ClutchView.this, callbackId); } dispatcher.methodCalled(methodName, params, callback); result.cancel(); return true; } }); ClutchSync.addClutchView(this); WebSettings settings = this.getSettings(); settings.setJavaScriptEnabled(true); settings.setSupportZoom(true); settings.setAppCacheEnabled(false); }
From source file:eu.codeplumbers.cosi.api.tasks.RegisterDeviceTask.java
public RegisterDeviceTask(String url, String password, String deviceString, ConnectFragment connectFragment) { this.connectFragment = connectFragment; this.deviceString = deviceString; resultDevice = null;// w ww. ja va 2 s . co m // cozy register device url this.url = url + "/device/"; this.password = password; // concatenate username and password with colon for authentication final String credentials = "owner" + ":" + password; authHeader = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); dialog = new ProgressDialog(connectFragment.getActivity()); dialog.setCancelable(false); dialog.setMessage("Please wait"); dialog.setIndeterminate(true); dialog.show(); }
From source file:edu.rit.csh.androidwebnews.HttpsGetAsyncTask.java
/** * This is called before the actual network task is done. This starts the progress dialog * with the custom animation if it is specified. *///from www . j a v a 2s. c o m protected void onPreExecute() { super.onPreExecute(); if (showProgress) { p = new ProgressDialog(activity); p.setIndeterminateDrawable(activity.getResources().getDrawable(R.anim.progress)); p.setTitle("Fetching Info"); p.setMessage("Contacting Server..."); p.setCancelable(false); p.show(); } }
From source file:com.nothingoneday.feature.base.api.sync.AsyncTaskActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.async_task); Logger.getInstance().clearCache(); mImageView = (ImageView) findViewById(R.id.image); mButton = (Button) findViewById(R.id.button); mButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { new LoadAsyncTask().execute(IMAGE_PATH); }/*from w ww . j a va 2s .c o m*/ }); mTextView = (TextView) findViewById(R.id.callback); mProgressDialog = new ProgressDialog(this); mProgressDialog.setTitle("?"); mProgressDialog.setMessage("??...."); mProgressDialog.setCancelable(false); mProgressDialog.setProgress(ProgressDialog.STYLE_SPINNER); }