List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:com.imalu.alyou.activity.FriendlistFragment.java
/** * ?/* w ww . jav a 2 s . c om*/ * * @param toDeleteUser */ public void deleteContact(final HXUser tobeDeleteUser) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("..."); 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()); // AlUApplication.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(), ": " + e.getMessage(), 1).show(); // } // }); // // } // // } // }).start(); }
From source file:tr.com.turkcellteknoloji.turkcellupdater.UpdaterDialogManager.java
private void initializeUpdatesFoundDialogButtons(final AlertDialog.Builder builder, final Update update) { if (!update.forceExit) { Intent launchIntent = null;// ww w. java2s .c o m try { if (isAlreadyInstalled(activity, update)) { launchIntent = activity.getPackageManager().getLaunchIntentForPackage(update.targetPackageName); } } catch (Exception e) { Log.e("Couldn't get launch intent for application: " + update.targetPackageName, e); } if (launchIntent != null) { final Intent i = launchIntent; builder.setPositiveButton(R.string.launch, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { activity.startActivity(i); onExit(); } }); } else { builder.setPositiveButton(R.string.install, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { updateProgressDialog = new ProgressDialog(activity); updateProgressDialog.setMax(100); updateProgressDialog.setTitle(getActivity().getString(R.string.downloading_new_version)); updateProgressDialog.setCancelable(false); updateProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); updateProgressDialog.setIndeterminate(false); UpdaterDialogManager.this.update = update; updateProgressDialog.show(); updateManager.applyUpdate(activity, update, UpdaterDialogManager.this); } }); } } if (update.forceExit || update.forceUpdate) { builder.setNegativeButton(R.string.exit_application, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onExit(); } }); } else { builder.setNegativeButton(R.string.remind_me_later, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onCompleted(); } }); } }
From source file:com.example.sergey.currentweather.ui.fragment.MainFragment.java
private void setupDialog() { mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setCancelable(false); mProgressDialog.setMessage(getContext().getResources().getString(R.string.message_dialog)); }
From source file:edu.cnu.PowerTutor.ui.PowerViewer.java
/** * ? ? ? ? ?. ? ? ? ? ? ? .//from ww w. j a v a2 s . c o m */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_PROBABILITY_PROGRESS: mWriteProgressDialog = new ProgressDialog(this); mWriteProgressDialog.setIcon(android.R.drawable.ic_dialog_info); mWriteProgressDialog.setTitle(getString(R.string.progress_title)); mWriteProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mWriteProgressDialog.setCancelable(false); mWriteProgressDialog.setMessage(getString(R.string.write_progress_message)); // progress bar ? . mWriteProgressDialog.setMax(PROGRESS_MAX); Log.d(TAG, "onCreateDialog pass"); return mWriteProgressDialog; } return null; }
From source file:net.gerosyab.dailylog.activity.MainActivity.java
private void exportCategory(final long id) { //?? ? ?? csv //? ?? ?? /* w w w . j a v a2 s . c o m*/ // ? ? ? ? Category category = categories.get((int) id); ProgressDialog progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setTitle("Exporting data [" + category.getName() + "]"); progressDialog.show(); String filename = category.getName() + "" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".data"; FileOutputStream outputStream = null; File resultFilePath = null; File resultFile = null; CSVWriter cw = null; try { resultFile = new File(context.getCacheDir(), filename); outputStream = new FileOutputStream(resultFile.getAbsolutePath()); // cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"),'\t', '"'); cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"), ',', '"'); // Export Data String[] metaDataStr = { "Version:" + AppDatabase.VERSION, "Name:" + category.getName(), "Unit:" + category.getUnit(), "Type:" + category.getRecordType(), "DefaultValue:" + category.getDefaultValue(), "Columns:date(yyyy-MM-dd 24HH:mm:ss)/value(boolean|numeric|string)" }; cw.writeNext(metaDataStr); List<Record> records = category.getRecordsOrderByDateAscending(realm); for (Record record : records) { String value = null; if (category.getRecordType() == StaticData.RECORD_TYPE_BOOLEAN) { value = "true"; } else if (category.getRecordType() == StaticData.RECORD_TYPE_NUMBER) { value = "" + record.getNumber(); } else if (category.getRecordType() == StaticData.RECORD_TYPE_MEMO) { value = record.getString(); } String[] s = { record.getDateString(StaticData.fmtForBackup), value }; cw.writeNext(s); } cw.close(); outputStream.close(); progressDialog.dismiss(); Uri fileUri = FileProvider.getUriForFile(context, "net.gerosyab.dailylog.fileprovider", resultFile); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri); shareIntent.setType("text/plain"); startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); } catch (UnsupportedEncodingException e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } catch (IllegalArgumentException e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } catch (Exception e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } finally { progressDialog.dismiss(); } }
From source file:com.getkickbak.plugin.NotificationPlugin.java
/** * Show the progress dialog.// w w w .j av a 2s . c o m * * @param title * Title of the dialog * @param message * The message of the dialog */ public synchronized void progressStart(final String title, final String message) { if (this.progressDialog != null) { this.progressDialog.dismiss(); this.progressDialog = null; } final NotificationPlugin notification = this; final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { notification.progressDialog = new ProgressDialog(cordova.getActivity()); notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); notification.progressDialog.setTitle(title); notification.progressDialog.setMessage(message); notification.progressDialog.setCancelable(true); notification.progressDialog.setMax(100); notification.progressDialog.setProgress(0); notification.progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.progressDialog = null; } }); notification.progressDialog.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); }
From source file:com.zsxj.pda.ui.client.LoginActivity.java
private void initData() { mWdtLogin = WDTLogin.getinstance();// ww w . j a va 2 s .c o m // Init progress dialog mProgressDialog = new ProgressDialog(this); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setTitle(R.string.please_wait); mProgressDialog.setMessage(getString(R.string.login) + "..."); mProgressDialog.setCancelable(false); readLoginInfo(); if (checkInputStatus() == INPUT_OK && mAutoLoginCheck.isChecked()) { autoLoginPrepare(); } else { // mSellerNickEdit.setText("duoduoyun"); // mUserNameEdit.setText("admin"); // mPasswordEdit.setText("ddy!@#$%^"); // mSellerNickEdit.setText("demo"); // mUserNameEdit.setText("ws"); // mPasswordEdit.setText("123"); // mSellerNickEdit.setText("xiaobaxi"); // mUserNameEdit.setText("admin"); // mPasswordEdit.setText("xiaobaxi"); // mSellerNickEdit.setText("duoduotest"); // mUserNameEdit.setText("admin"); // mPasswordEdit.setText("123456"); // mSellerNickEdit.setText("haoxu"); // mUserNameEdit.setText("admin"); // mPasswordEdit.setText("172c3a"); // mSellerNickEdit.setText("yinpai"); // mUserNameEdit.setText("pda"); // mPasswordEdit.setText("1234"); // mSellerNickEdit.setText("qiqu"); // mUserNameEdit.setText(""); // mPasswordEdit.setText("123456"); // mSellerNickEdit.setText("joyvio"); // mUserNameEdit.setText(""); // mPasswordEdit.setText("666666"); mSellerNickEdit.setText("jiulong"); mUserNameEdit.setText("admin"); mPasswordEdit.setText("wenwen0023"); } }
From source file:com.saulcintero.moveon.fragments.History.java
private void importRoute(int activity, int type, String date, String time, String[] files, boolean deleteOnFinish) { importTask = null;/*from w ww . j a v a2 s. com*/ DialogInterface.OnCancelListener dialogCancelled = new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { UIFunctionUtils.showMessage(mContext, true, getString(R.string.import_canceled)); importTask = null; } }; pd = new ProgressDialog(act); pd.setTitle(R.string.dialog_import_importing); pd.setProgressStyle(ProgressDialog.STYLE_SPINNER); pd.setCancelable(false); pd.setOnCancelListener(dialogCancelled); pd.setMessage(getString(R.string.dialog_import_text)); importTask = new ImportPracticesTask(pd, act, mContext, type, date, time, activity, files, deleteOnFinish); importTask.execute(); }
From source file:gov.nasa.arc.geocam.geocam.CameraActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_SAVE_PROGRESS: mSaveProgressDialog = new ProgressDialog(this); mSaveProgressDialog.setMessage(getResources().getString(R.string.camera_saving)); mSaveProgressDialog.setIndeterminate(true); mSaveProgressDialog.setCancelable(false); return mSaveProgressDialog; case DIALOG_HIDE_KEYBOARD: mHideKeyboardDialog = new Dialog(this); mHideKeyboardDialog.setTitle(getResources().getString(R.string.camera_hide_keyboard)); return mHideKeyboardDialog; default:/*from www .j a v a 2s . co m*/ break; } return null; }
From source file:com.easemob.chatuidemo.activity.ContactlistFragment.java
/** * ?/*from w w w . j a v a2 s. c om*/ * */ 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(); }