List of usage examples for android.app ProgressDialog setMessage
@Override public void setMessage(CharSequence message)
From source file:com.zigvine.zagriculture.UIActivity.java
private void manualUpdateCheck() { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(""); pd.setCanceledOnTouchOutside(false); pd.show();/* ww w. j ava 2s . co m*/ MainApp.getInstance().startCheck(new UpdateCheckListener() { @Override public void onCheckedOver(int result) { pd.dismiss(); if (result == MainApp.CHECKED_NO_NEED) { UI.toast("?"); } else if (result == MainApp.UNCHECKED) { UI.toast(""); } } }, true); }
From source file:cn.ucai.superwechat.fragment.ContactlistFragment.java
/** * ?/*from www .ja v a2s .c om*/ * * @param */ public void deleteContact(final Contact tobeDeleteUser) { String st1 = getResources().getString(cn.ucai.superwechat.R.string.deleting); final String st2 = getResources().getString(cn.ucai.superwechat.R.string.Delete_failed); final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); try { String path = new ApiParams() .with(I.Contact.USER_NAME, superWeChatApplication.getInstance().getUserName()) .with(I.Contact.CU_NAME, tobeDeleteUser.getMUserName()).getRequestUrl(I.REQUEST_DELETE_CONTACT); ((MainActivity) getActivity()).executeRequest(new GsonRequest<Boolean>(path, Boolean.class, responseDeleteContactListener(tobeDeleteUser), ((MainActivity) getActivity()).errorListener())); } catch (Exception e) { e.printStackTrace(); } new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getMContactCname()); // db? EMUserDao dao = new EMUserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getMContactCname()); ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .remove(tobeDeleteUser.getMContactCname()); 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:cn.ucai.fulicenter.fragment.ContactlistFragment.java
/** * ?/*from www. j av a 2 s.c o m*/ * * @param tobeDeleteUser */ public void deleteContact(final Contact 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(); try { } catch (Exception e) { e.printStackTrace(); } new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getMContactCname()); // db? EMUserDao dao = new EMUserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getMContactCname()); ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .remove(tobeDeleteUser.getMContactCname()); 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:cn.hbm.superwechat.activity.ContactlistFragment.java
/** * ?/*from w w w . java 2 s .c o m*/ * * @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()); //?? deleteMyContact(toBeProcessUser); // 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:com.juick.android.UserCenterActivity.java
private void enableJAM(final Runnable then) { if (!MainActivity.isJAMServiceRunning(UserCenterActivity.this)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true);/* w ww . j a va 2 s . c o m*/ builder.setMessage(R.string.JAMNotEnabledEnable); builder.setTitle(getString(R.string.JuickAdvancedFunctionality)); builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(UserCenterActivity.this); sp.edit().putBoolean("enableJAMessaging", true).commit(); MainActivity.toggleJAMessaging(UserCenterActivity.this, true); final ProgressDialog pd = new ProgressDialog(UserCenterActivity.this); dialog.cancel(); pd.setIndeterminate(true); pd.setMessage(getString(R.string.WaitingForService)); final Thread thread = new Thread() { @Override public void run() { while (true) { try { JAMService instance = JAMService.instance; if (instance != null) { JAXMPPClient client = instance.client; if (client != null && client.loggedIn) { runOnUiThread(new Runnable() { @Override public void run() { pd.cancel(); then.run(); } }); } } Thread.sleep(500); } catch (InterruptedException e) { break; } } super.run(); //To change body of overridden methods use File | Settings | File Templates. } }; thread.start(); pd.setCancelable(true); pd.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { thread.interrupt(); } }); pd.show(); } }); builder.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else { then.run(); } return; }
From source file:org.alfresco.mobile.android.ui.operation.OperationWaitingDialogFragment.java
public Dialog onCreateDialog(final Bundle savedInstanceState) { if (getArguments() != null) { operationType = getArguments().getInt(ARGUMENT_TYPEID); intentId = getArguments().getString(ARGUMENT_INTENTID); iconId = getArguments().getInt(ARGUMENT_ICONID); title = getArguments().getString(ARGUMENT_TITLEID); message = getArguments().getString(ARGUMENT_MESSAGEID); parent = getArguments().getParcelable(ARGUMENT_NODEID); nbItems = getArguments().getInt(ARGUMENT_SIZE); operationId = getArguments().getString(ARGUMENT_OPERATIONID); }/*w w w. j a v a 2 s .c om*/ ProgressDialog dialog = new ProgressDialog(getActivity()); if (iconId == 0) { iconId = R.drawable.ic_application_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) { if (operationId != null) { Operator.with(getActivity()).cancel(operationId); } dialog.dismiss(); } }); getActivity().getLoaderManager().restartLoader(this.hashCode(), null, this); return dialog; }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_PROGRESS: final ProgressDialog dialog = new ProgressDialog(this); dialog.setMessage(getText(R.string.login_message_authenticating)); dialog.setIndeterminate(true);/* www . j ava 2 s . c o m*/ dialog.setCancelable(true); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { if (BuildConfig.DEBUG) { Log.i(TAG, "dialog cancel has been invoked"); } if (mAuthenticationTask != null) { mAuthenticationTask.cancel(true); mAuthenticationTask = null; finish(); } } }); return dialog; default: return null; } }
From source file:com.quickcar.thuexe.UI.ListPassengerActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); GPSTracker gps = new GPSTracker(mContext); if (!gps.canGetLocation()) { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle("Thng bo"); // GPS not found builder.setMessage(/*w ww. j a va 2 s .c om*/ "Chc nng ny cn ly v tr hin ti ca bn.Bn c mun bt nh v?"); // Want to enable? builder.setPositiveButton("Tip tc", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 1); } }); builder.setNegativeButton("Khng", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); return; } final ProgressDialog locate = new ProgressDialog(mContext); locate.setIndeterminate(true); locate.setCancelable(false); locate.setMessage("?ang ly v tr..."); locate.show(); if (gps.getLongitude() == 0 && gps.getLatitude() == 0) { gps.getLocationCoodinate(new GPSTracker.LocateListener() { @Override public void onLocate(double mlongitude, double mlatitude) { if (dataMap != null) dataMap.OnDataMap(); if (dataPasser != null) dataPasser.onDataPass(); locate.dismiss(); //Toast.makeText(mContext, mlongitude+","+mlatitude,Toast.LENGTH_SHORT).show(); } }); } else { if (dataMap != null) dataMap.OnDataMap(); if (dataPasser != null) dataPasser.onDataPass(); //Toast.makeText(mContext, gps.getLongitude()+","+gps.getLatitude(),Toast.LENGTH_SHORT).show(); locate.dismiss(); } }
From source file:cn.ucai.superwechart.activity.ContactlistFragment.java
/** * ?/*from w w w .j a v a 2 s . c o m*/ * * @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()); ((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(); String userName = SuperWeChatApplication.getInstance().getUserName(); OkHttpUtils2<Result> utils2 = new OkHttpUtils2<>(); utils2.setRequestUrl(I.REQUEST_DELETE_CONTACT).addParam(I.Contact.USER_NAME, userName) .addParam(I.Contact.CU_NAME, tobeDeleteUser.getUsername()).targetClass(Result.class) .execute(new OkHttpUtils2.OnCompleteListener<Result>() { @Override public void onSuccess(Result result) { if (result.isRetMsg()) { UserAvatar ua = SuperWeChatApplication.getInstance().getContactMap() .get(tobeDeleteUser.getUsername()); SuperWeChatApplication.getInstance().getUserContactList().remove(ua); SuperWeChatApplication.getInstance().getContactMap() .remove(tobeDeleteUser.getUsername()); getActivity().sendStickyBroadcast(new Intent("update_contact_list")); Log.e(TAG, "delUsername=" + tobeDeleteUser.getUsername()); } } @Override public void onError(String error) { Log.e(TAG, "error=" + error); } }); }
From source file:com.hyphenate.easeui.ui.EaseContactListFragment.java
/** * move user to blacklist/*from ww w .j a va2 s . co m*/ */ protected void moveToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(getActivity()); String st1 = getResources().getString(R.string.Is_moved_into_blacklist); final String st2 = getResources().getString(R.string.Move_into_blacklist_success); final String st3 = getResources().getString(R.string.Move_into_blacklist_failure); pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { //move to blacklist EMClient.getInstance().contactManager().addUserToBlackList(username, false); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2, Toast.LENGTH_SHORT).show(); refresh(); } }); } catch (HyphenateException e) { e.printStackTrace(); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st3, Toast.LENGTH_SHORT).show(); } }); } } }).start(); }