List of usage examples for android.app ProgressDialog setMessage
@Override public void setMessage(CharSequence message)
From source file:com.gmail.nagamatu.radiko.installer.RadikoInstallerActivity.java
private Dialog onCreateProgressDialog() { final ProgressDialog dialog = new ProgressDialog(this); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMessage("Loading..."); dialog.setCancelable(false);/*w w w. j a va2s .c o m*/ return dialog; }
From source file:cn.ucai.chatuidemo.activity.ContactlistFragment.java
/** * ?/* www. j a v a 2 s.c om*/ * * @param tobeDeleteUser */ public void deleteContact(final User tobeDeleteUser) { String st1 = getResources().getString(R.string.deleting); final String st2 = getResources().getString(R.string.Delete_failed); final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername()); // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_LONG).show(); } }); } } }).start(); }
From source file:dong.lan.tuyi.activity.ContactlistFragment.java
/** * ?//from w w w . ja va 2s .co m * */ public void deleteContact(final User tobeDeleteUser) { String st1 = getResources().getString(R.string.deleting); final String st2 = getResources().getString(R.string.Delete_failed); final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { BmobQuery<TUser> query = new BmobQuery<TUser>(); query.addWhereEqualTo("tUser", tobeDeleteUser.getUsername()); query.findObjects(getActivity(), new FindListener<TUser>() { @Override public void onSuccess(List<TUser> list) { if (list.isEmpty()) { Config.Show(getActivity(), ""); } else { BmobRelation relation = new BmobRelation(); relation.remove(list.get(0)); Config.tUser.update(getActivity(), new UpdateListener() { @Override public void onSuccess() { try { EMContactManager.getInstance() .deleteContact(tobeDeleteUser.getUsername()); } catch (EaseMobException e) { e.printStackTrace(); } // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); TuApplication.getInstance().getContactList() .remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } @Override public void onFailure(int i, String s) { } }); } } @Override public void onError(int i, String s) { } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:org.alfresco.mobile.android.application.fragments.operations.OperationWaitingDialogFragment.java
public Dialog onCreateDialog(final Bundle savedInstanceState) { setRetainInstance(true);/*www .java2 s. c o m*/ if (getArguments() != null) { operationType = getArguments().getInt(PARAM_TYPEID); intentId = getArguments().getString(PARAM_INTENTID); iconId = getArguments().getInt(PARAM_ICONID); title = getArguments().getString(PARAM_TITLEID); message = getArguments().getString(PARAM_MESSAGEID); parent = getArguments().getParcelable(PARAM_NODEID); nbItems = getArguments().getInt(PARAM_SIZE); } ProgressDialog dialog = new ProgressDialog(getActivity()); if (iconId == 0) { iconId = R.drawable.ic_alfresco_logo; } dialog.setIcon(iconId); dialog.setTitle(title); if (message == null) { message = getString(R.string.waiting_operations); } dialog.setMessage(message); boolean indeterminate = true; if (nbItems > 0) { dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setProgress(0); dialog.setMax(nbItems); indeterminate = false; } else { dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); } dialog.setIndeterminate(indeterminate); dialog.setCancelable(false); dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); getActivity().getLoaderManager().restartLoader(this.hashCode(), null, this); return dialog; }
From source file:com.easemob.chatui.activity.ContactlistFragment.java
/** * ?/*from w ww . j av a 2 s.c om*/ * * @param */ public void deleteContact(final User tobeDeleteUser) { String st1 = getResources().getString(R.string.deleting); final String st2 = getResources().getString(R.string.Delete_failed); final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername()); // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); /**?????*/ HttpUtils httpUtils = new HttpUtils(); MyRequestParams params = new MyRequestParams(); params.addQueryStringParameter("userid", BeewayApplication.getInstance().getmUserid(getActivity())); params.addQueryStringParameter("friendid", tobeDeleteUser.getUsername()); // params.addBodyParameter("iden", iden); String url = params.myRequestParams(params); httpUtils.send(HttpRequest.HttpMethod.POST, UrlPools.DEL_FRIEND + "?" + url, new RequestCallBack<String>() { @Override public void onSuccess(ResponseInfo<String> responseInfo) { String result = responseInfo.result; DelBean delBean = paraseDelData(result); if (delBean.getStatus() == 1) { /**db??*/ FriendDao friendDao = new FriendDao(getActivity()); friendDao.deleteFriend(tobeDeleteUser.getUsername()); Toast.makeText(getActivity(), "?", Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(HttpException e, String s) { LogUtils.e(s); } }); BeewayApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:com.artur.softwareproject.Main.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.disconnect: if (!recording) { stopService(bluetoothServiceIntent); final ProgressDialog disconnectingDialog = new ProgressDialog(Main.this); disconnectingDialog.setMessage("Disconnecting..."); disconnectingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); disconnectingDialog.setCancelable(false); disconnectingDialog.show();//from ww w .j ava 2 s.c o m disconDialog = disconnectingDialog; final DisconnectHandlerClass disconnectHandler = new DisconnectHandlerClass(this); disconnectThread = new Thread(new Runnable() { @Override public void run() { int stop = 0; while (stop == 0) { stop = getDisconnect(); sleep(1500); } disconnectHandler.sendEmptyMessage(0); } }); disconnectThread.start(); } return true; case R.id.record_data: Log.d(TAG, "Record button was Pressed. Gps status: " + gpsStatus); if (!recording && gpsStatus) { Intent resetIntent = new Intent(); resetIntent.putExtra("reset", ""); resetIntent.setAction("resetFilter"); LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(resetIntent); item.setIcon(R.drawable.ic_action_stop); Toast.makeText(getApplicationContext(), "Start recording data", Toast.LENGTH_LONG).show(); currentTime = System.currentTimeMillis(); recordClock.setVisibility(View.VISIBLE); Animation a = AnimationUtils.loadAnimation(this, R.anim.textslide); TextView tv = (TextView) findViewById(R.id.recordClock); tv.startAnimation(a); recording = true; if (!rBound) { Intent intent = new Intent(this, RecordService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } } else if (recording) { stopRecording(); } return true; case R.id.vr_menu: if (!recording) { Intent vrIntent = new Intent(Main.this, VRmenuMap.class); Main.this.startActivity(vrIntent); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.kncwallet.wallet.ui.SendingAddressesFragment.java
private void handleReloadContacts() { final Context context = activity; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String phoneNumber = activity.getWalletApplication().GetPhoneNumber(); final ProgressDialog progressDialog = new ProgressDialog(context); progressDialog.setTitle(R.string.contacts_lookup_refresh_title); progressDialog.setMessage(getString(R.string.contacts_lookup_refresh_message)); progressDialog.setCancelable(false); progressDialog.show();//from ww w .j a v a 2 s . c o m KnCDialog.fixDialogDivider(progressDialog); new ContactsDownloader(context, prefs, phoneNumber, new ContactsDownloader.ContactsDownloaderListener() { @Override public void onSuccess(int newContacts) { progressDialog.dismiss(); if (newContacts > 0) { Toast.makeText(context, getString(R.string.contacts_lookup_contacts_added, "" + newContacts), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(context, R.string.contacts_lookup_success, Toast.LENGTH_SHORT).show(); } } @Override public void onError(String message) { progressDialog.dismiss(); Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } }).doContactsLookup(); }
From source file:com.jwetherell.quick_response_code.EncoderActivity.java
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); com.ranorex.android.RanorexAndroidAutomation.Hook(this); // Get text views textoSsid = (TextView) findViewById(R.id.ssid); textoPassword = (TextView) findViewById(R.id.password); descripcion = (TextView) findViewById(R.id.descripcion); icon = (ImageView) findViewById(R.id.icon); //textoCifrado = (TextView) findViewById(R.id.cifrado); settings = getSharedPreferences(MainActivity.PREFS, 0); // if(settings.contains("connected_wifi_5ghz") && settings.getBoolean("connected_wifi_5ghz", false)) // descripcion.setText(""); final ProgressDialog dialog = new ProgressDialog(EncoderActivity.this); dialog.setMessage("Generando Qr..."); dialog.show();/*from ww w. j a va2 s . c o m*/ dialog.setCancelable(false); try { if (settings.contains("ssid") && settings.contains("password1")) { // Get ssid, psk and encrypted of settings. if (!getIntent().getBooleanExtra("is_5ghz", false)) // Network 2.4 GHz. { cifradoSettings = settings.getString("cifrado", "WPA"); ssidSettings = settings.getString("ssid", ""); pskSettings = settings.getString("password1", ""); if (settings.contains("connected_wifi_5ghz") && !settings.getBoolean("connected_wifi_5ghz", false) || !settings.contains("connected_wifi_5ghz")) { descripcion.setVisibility(View.VISIBLE); } } else // Network 5 GHz. { cifradoSettings = settings.getString("cifrado5ghz", "WPA"); ssidSettings = settings.getString("ssid5ghz", ""); pskSettings = settings.getString("password5ghz", ""); icon.setImageResource(R.drawable.wifiplus120); ((TextView) findViewById(R.id.textView1)).setText("WifiPlus"); if (settings.contains("connected_wifi_5ghz") && settings.getBoolean("connected_wifi_5ghz", false)) { descripcion.setVisibility(View.VISIBLE); } } ssidFull = ssidSettings; pskFull = pskSettings; if (cifradoSettings.contains("WPA")) { cifradoQR = "WPA"; string = "WIFI:T:" + cifradoQR + ";S:" + ssidSettings + ";P:" + pskSettings + ";;"; } else if (cifradoSettings.contains("abierta")) { cifradoQR = "nopass"; string = "WIFI:T:" + cifradoQR + ";S:" + ssidSettings + ";;"; } else if (cifradoSettings.contains("WEP")) { cifradoQR = "WEP"; string = "WIFI:T:" + cifradoQR + ";S:" + ssidSettings + ";P:" + pskSettings + ";;"; } // Update texts textoSsid.setText(ssidSettings); try { if (pskSettings.length() > 39) pskSettings = ellipsis(pskSettings, 39); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (pskSettings.equalsIgnoreCase("sin password") || pskSettings.equalsIgnoreCase("")) pskSettings = "Sin password"; textoPassword.setText(pskSettings); } } catch (IllegalArgumentException e) { Log.e(TAG, "Could not encode barcode", e); } new AsyncTask<String, Integer, Bitmap>() { @Override protected Bitmap doInBackground(String... params) { QRCodeEncoder qrCodeEncoder = null; // This assumes the view is full screen, which is a good assumption WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); int smallerDimension = width < height ? width : height; smallerDimension = smallerDimension * 7 / 8; try { qrCodeEncoder = new QRCodeEncoder(string, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), smallerDimension); Hashtable hints = new Hashtable(); hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); QRCodeWriter qrcw = new QRCodeWriter(); BitMatrix matrix = qrcw.encode(string, BarcodeFormat.QR_CODE, width, height, hints); bm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); for (int y = 0; y < matrix.getHeight(); y++) { for (int x = 0; x < matrix.getWidth(); x++) { if (!matrix.get(x, y)) bm.setPixel(x, y, Color.WHITE); else bm.setPixel(x, y, Color.BLACK); } } } catch (WriterException we) { we.printStackTrace(); Log.e(TAG, "Could not encode barcode", we); } return bm; } protected void onPostExecute(Bitmap bitmap) { if (bitmap != null) { viewCode = (ImageView) findViewById(R.id.image_view); viewCode.setImageBitmap(bitmap);//bitmap); dialog.dismiss(); } else { Toast.makeText(EncoderActivity.this, "Problema al generar Qr", Toast.LENGTH_LONG).show(); } } }.execute(); if (bm != null) { dialog.dismiss(); } }
From source file:com.easemob.chatuidemo.activity.ContactlistFragment.java
/** * ?/*from w w w .java 2 s . c o m*/ * */ public void deleteContact(final User tobeDeleteUser) { String st1 = getResources().getString(R.string.deleting); final String st2 = getResources().getString(R.string.Delete_failed); final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername()); // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:edu.mit.media.funf.funfohmage.OhmageLoginActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog = super.onCreateDialog(id); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); switch (id) { case DIALOG_FIRST_RUN: dialogBuilder.setTitle(R.string.eula_title).setMessage(R.string.eula_text).setCancelable(false) .setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() { @Override/*www . ja v a 2s.c om*/ public void onClick(DialogInterface dialog, int which) { mPreferencesHelper.setFirstRun(false); } }).setNegativeButton(R.string.eula_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { OhmageLoginActivity.this.finish(); } }); dialog = dialogBuilder.create(); break; case DIALOG_LOGIN_ERROR: dialogBuilder.setTitle(R.string.login_error).setMessage(R.string.login_invalid_password) .setCancelable(true).setPositiveButton(R.string.ok, null) /*.setNeutralButton("Help", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(LoginActivity.this, HelpActivity.class)); //put extras for specific help on login error } })*/; //add button for contact dialog = dialogBuilder.create(); break; case DIALOG_USER_DISABLED: dialogBuilder.setTitle(R.string.login_error).setMessage(R.string.login_account_disabled) .setCancelable(true).setPositiveButton(R.string.ok, null) /*.setNeutralButton("Help", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(LoginActivity.this, HelpActivity.class)); //put extras for specific help on login error } })*/; //add button for contact dialog = dialogBuilder.create(); break; case DIALOG_NETWORK_ERROR: dialogBuilder.setTitle(R.string.login_error).setMessage(R.string.login_network_error) .setCancelable(true).setPositiveButton(R.string.ok, null) /*.setNeutralButton("Help", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(LoginActivity.this, HelpActivity.class)); //put extras for specific help on http error } })*/; //add button for contact dialog = dialogBuilder.create(); break; case DIALOG_INTERNAL_ERROR: dialogBuilder.setTitle(R.string.login_error).setMessage(R.string.login_server_error).setCancelable(true) .setPositiveButton(R.string.ok, null) /*.setNeutralButton("Help", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(LoginActivity.this, HelpActivity.class)); //put extras for specific help on http error } })*/; //add button for contact dialog = dialogBuilder.create(); break; case DIALOG_LOGIN_PROGRESS: { ProgressDialog pDialog = new ProgressDialog(this); pDialog.setMessage(getString(R.string.login_authenticating, getString(R.string.server_name))); pDialog.setCancelable(false); //pDialog.setIndeterminate(true); dialog = pDialog; break; } case DIALOG_DOWNLOADING_CAMPAIGNS: { ProgressDialog pDialog = new ProgressDialog(this); pDialog.setMessage(getString(R.string.login_download_campaign)); pDialog.setCancelable(false); //pDialog.setIndeterminate(true); dialog = pDialog; break; } } return dialog; }