List of usage examples for android.app ProgressDialog STYLE_SPINNER
int STYLE_SPINNER
To view the source code for android.app ProgressDialog STYLE_SPINNER.
Click Source Link
From source file:es.rgmf.libresportgps.MainActivity.java
/** * These methods are called from fragments through callback in these * fragments to show and dismiss loading dialog. *///ww w. ja v a 2 s . c o m @Override public void onPreExecute() { // Create the progress dialog. mProgressDialog = new ProgressDialog(this); mProgressDialog.setCancelable(false); mProgressDialog.setMessage(getString(R.string.loading_file)); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); // Stop rotation screen. int current_orientation = getResources().getConfiguration().orientation; if (current_orientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } // Show the progress dialog. mProgressDialog.show(); }
From source file:net.gerosyab.dailylog.activity.MainActivity.java
private void importCategory() { DialogProperties properties = new DialogProperties(); properties.selection_mode = DialogConfigs.SINGLE_MODE; properties.selection_type = DialogConfigs.FILE_SELECT; properties.root = new File(DialogConfigs.DEFAULT_DIR); properties.extensions = null;/*ww w. j a va 2 s.co m*/ dialog = new FilePickerDialog(MainActivity.this, properties); dialog.setDialogSelectionListener(new DialogSelectionListener() { @Override public void onSelectedFilePaths(String[] files) { ProgressDialog progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setTitle("Importing data [" + files[0] + "]"); progressDialog.show(); //files is the array of the paths of files selected by the Application User. try { String newCategoryUUID = UUID.randomUUID().toString(); // CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(files[0]), "UTF-8"), '\t'); CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(files[0]), "UTF-8"), ','); String[] nextLine; long lineNum = 0; boolean dbVersionCheck = false, categoryNameCheck = false, categoryUnitCheck = false; boolean categoryTypeCheck = false, defaultValueCheck = false, headerCheck = false; boolean isCategoryNameExists = false, rowDataCheck = false, dataCheck = false; String dbVersion = null, categoryName = null, categoryUnit = null; long categoryType = -1, defaultValue = -1; // Category category = null; List<Record> records = new ArrayList<Record>(); while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line String temp2 = ""; for (int i = 0; i < nextLine.length; i++) { temp2 += nextLine[i] + ", "; } MyLog.d("opencsv", temp2); if (lineNum == 0) { //header MyLog.d("opencsv", "nextLine.length : " + nextLine.length); for (int i = 0; i < nextLine.length; i++) { String[] split2 = nextLine[i].split(":"); MyLog.d("opencsv", "split2.length : " + split2.length); MyLog.d("opencsv", "split2[0] : " + split2[0]); if (split2[0].replaceAll("\\s+", "").equals("Version")) { if (split2[1] != null && !split2[1].equals("")) { dbVersion = split2[1]; dbVersionCheck = true; } } else if (split2[0].replaceAll("\\s+", "").equals("Name")) { if (split2[1] != null && !split2[1].equals("")) { categoryName = split2[1]; if (categoryName.length() <= Category.getMaxCategoryNameLength()) { categoryNameCheck = true; } } } else if (split2[0].replaceAll("\\s+", "").equals("Unit")) { if (split2.length == 1) { categoryUnitCheck = true; } else if (split2[1] != null && !split2[1].equals("")) { categoryUnit = split2[1]; categoryUnitCheck = true; } } else if (split2[0].replaceAll("\\s+", "").equals("Type")) { if (split2[1] != null && !split2[1].equals("")) { if (split2[1].equals("0") || split2[1].equals("1") || split2[1].equals("2")) { categoryType = Long.parseLong(split2[1]); categoryTypeCheck = true; } } } else if (split2[0].replaceAll("\\s+", "").equals("DefaultValue")) { if (split2.length == 1) { defaultValueCheck = true; } else if (split2[1] != null && !split2[1].equals("")) { if (NumberUtils.isDigits(split2[1]) && NumberUtils.isNumber(split2[1])) { defaultValue = Long.parseLong(split2[1]); MyLog.d("opencsv", "split2[1] : " + split2[1]); if (defaultValue >= 0) { defaultValueCheck = true; } } } } } if (dbVersionCheck && categoryNameCheck && categoryTypeCheck) { if (categoryType == 1) { //number if (categoryUnitCheck && defaultValueCheck) { headerCheck = true; } } else { //boolean, string headerCheck = true; } } if (!headerCheck) { break; //header parsing, data checking failed } else if (Category.isCategoryNameExists(realm, categoryName)) { isCategoryNameExists = true; break; } else { // category = new Category(categoryName, categoryUnit, Category.getLastOrderNum(realm), categoryType); } } else { //data Record record; rowDataCheck = true; if (nextLine.length != 2) { rowDataCheck = false; break; } else { record = new Record(); record.setRecordType(categoryType); DateTime dateTime = StaticData.fmtForBackup.parseDateTime(nextLine[0]); if (dateTime != null) { record.setDate(new java.sql.Date(dateTime.toDate().getTime())); } else { rowDataCheck = false; break; } if (categoryType == StaticData.RECORD_TYPE_BOOLEAN) { if (nextLine[1].equals("true")) { record.setBool(true); } else { rowDataCheck = false; break; } } else if (categoryType == StaticData.RECORD_TYPE_NUMBER) { if (NumberUtils.isNumber(nextLine[1]) && NumberUtils.isDigits(nextLine[1])) { long value = Long.parseLong(nextLine[1]); if (value > Category.getMaxValue()) { rowDataCheck = false; break; } else { record.setNumber(value); } } else { dataCheck = false; break; } } else if (categoryType == StaticData.RECORD_TYPE_MEMO) { String value = nextLine[1]; if (value.length() > Category.getMaxMemoLength()) { rowDataCheck = false; break; } else { record.setString(nextLine[1]); } } } if (record != null && rowDataCheck == true) { record.setCategoryId(newCategoryUUID); record.setRecordId(UUID.randomUUID().toString()); records.add(record); } } lineNum++; } if (!headerCheck) { Toast.makeText(context, "Data file's header context/value is not correct", Toast.LENGTH_LONG).show(); } else if (isCategoryNameExists) { Toast.makeText(context, "Category Name [" + categoryName + "] is already exists", Toast.LENGTH_LONG).show(); } else if (!rowDataCheck) { Toast.makeText(context, "Data file's record data is not correct", Toast.LENGTH_LONG).show(); } else { long newOrder = Category.getNewOrderNum(realm); realm.beginTransaction(); Category category = realm.createObject(Category.class, newCategoryUUID); category.setName(categoryName); category.setUnit(categoryUnit); category.setOrder(newOrder); category.setRecordType(categoryType); realm.insert(category); realm.insertOrUpdate(records); realm.commitTransaction(); Toast.makeText(context, "Data import [ " + categoryName + " ] is completed!!", Toast.LENGTH_LONG).show(); // refreshList(); // categoryHolderList.add(getHolderFromCategory(category)); // mDragListView.getAdapter().notifyDataSetChanged(); // mDragListView.getAdapter().notifyItemInserted((int) newOrder); // setCategoryHolderList(); // mDragListView.getAdapter().setItemList(categoryHolderList); adapter.notifyDataSetChanged(); } } catch (FileNotFoundException e) { Toast.makeText(context, "Selected file is not found", Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (IOException e) { Toast.makeText(context, "File I/O exception occured", Toast.LENGTH_LONG).show(); e.printStackTrace(); } finally { progressDialog.dismiss(); } } }); dialog.show(); }
From source file:bikebadger.RideFragment.java
public void SaveGPXFileOnNewThreadWithDialog(final String path) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setProgressStyle(ProgressDialog.STYLE_SPINNER); final File gpxFile = new File(path); pd.setMessage("Saving \"" + gpxFile.getName() + "\""); pd.setIndeterminate(true);//www . j av a2 s . c o m pd.setCancelable(false); pd.show(); Thread mThread = new Thread() { @Override public void run() { mRideManager.ExportWaypointsTrack(); pd.dismiss(); if (mRideManager.mWaypoints != null) { getActivity().runOnUiThread(new Runnable() { public void run() { //Toast.makeText(getActivity(), "Hello", Toast.LENGTH_SHORT).show(); MyToast.Show(getActivity(), "\"" + gpxFile.getName() + "\" saved", Color.BLACK); } }); } } }; mThread.start(); }
From source file:com.android.email.activity.MessageView.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.message_view); mHandler = new MessageViewHandler(); mControllerCallback = new ControllerResults(); mSubjectView = (TextView) findViewById(R.id.subject); mFromView = (TextView) findViewById(R.id.from); mToView = (TextView) findViewById(R.id.to); mCcView = (TextView) findViewById(R.id.cc); mCcContainerView = findViewById(R.id.cc_container); mDateView = (TextView) findViewById(R.id.date); mTimeView = (TextView) findViewById(R.id.time); mMessageContentView = (WebView) findViewById(R.id.message_content); mAttachments = (LinearLayout) findViewById(R.id.attachments); mAttachmentIcon = (ImageView) findViewById(R.id.attachment); mFavoriteIcon = (ImageView) findViewById(R.id.favorite); mShowPicturesSection = findViewById(R.id.show_pictures_section); mInviteSection = findViewById(R.id.invite_section); mSenderPresenceView = (ImageView) findViewById(R.id.presence); mMoveToNewer = findViewById(R.id.moveToNewer); mMoveToOlder = findViewById(R.id.moveToOlder); mScrollView = findViewById(R.id.scrollview); mMoveToNewer.setOnClickListener(this); mMoveToOlder.setOnClickListener(this); mFromView.setOnClickListener(this); mSenderPresenceView.setOnClickListener(this); mFavoriteIcon.setOnClickListener(this); findViewById(R.id.reply).setOnClickListener(this); findViewById(R.id.reply_all).setOnClickListener(this); findViewById(R.id.delete).setOnClickListener(this); findViewById(R.id.show_pictures).setOnClickListener(this); mMeetingYes = (TextView) findViewById(R.id.accept); mMeetingMaybe = (TextView) findViewById(R.id.maybe); mMeetingNo = (TextView) findViewById(R.id.decline); mMeetingYes.setOnClickListener(this); mMeetingMaybe.setOnClickListener(this); mMeetingNo.setOnClickListener(this); findViewById(R.id.invite_link).setOnClickListener(this); mMessageContentView.setVerticalScrollBarEnabled(false); mMessageContentView.getSettings().setBlockNetworkLoads(true); mMessageContentView.getSettings().setSupportZoom(false); mMessageContentView.setWebViewClient(new CustomWebViewClient()); mProgressDialog = new ProgressDialog(this); mProgressDialog.setIndeterminate(true); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mDateFormat = android.text.format.DateFormat.getDateFormat(this); // short format mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format mFavoriteIconOn = getResources().getDrawable(R.drawable.btn_star_big_buttonless_on); mFavoriteIconOff = getResources().getDrawable(R.drawable.btn_star_big_buttonless_off); initFromIntent();//from w w w . j a v a2 s . c om if (icicle != null) { mMessageId = icicle.getLong(STATE_MESSAGE_ID, mMessageId); } mController = Controller.getInstance(getApplication()); // This observer is used to watch for external changes to the message list mCursorObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { // get a new message list cursor, but only if we already had one // (otherwise it's "too soon" and other pathways will cause it to be loaded) if (mLoadMessageListTask == null && mMessageListCursor != null) { mLoadMessageListTask = new LoadMessageListTask(mMailboxId); mLoadMessageListTask.execute(); } } }; messageChanged(); }
From source file:com.example.alyshia.customsimplelauncher.MainActivity.java
public void setStates(int state) { switch (state) { case SAConstants.INITIAL_STATE: if (adminLicensePrefs.getBoolean(SAConstants.ADMIN, false)) { if (adminLicensePrefs.getBoolean(SAConstants.ELM, false)) { if (adminLicensePrefs.getBoolean(SAConstants.KLM, false)) { checkKioskEnabled(); } else { mModelObj.activateKLM(); }/*ww w .jav a 2 s .c o m*/ } else { mModelObj.activateELM(); } } else { mDialog = new ProgressDialog(this, R.style.customDialog); mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mDialog.setMessage("Please wait while applying user's setting"); mDialog.setCancelable(false); mDialog.show(); mModelObj.activateAdmin(); } break; case SAConstants.RESULT_ENABLE_ADMIN: adminLicensePrefsEditor.putBoolean(SAConstants.ADMIN, true); adminLicensePrefsEditor.commit(); mModelObj.activateELM(); break; case SAConstants.RESULT_DISABLE_ADMIN: adminLicensePrefsEditor.putBoolean(SAConstants.ADMIN, false); adminLicensePrefsEditor.putBoolean(SAConstants.ELM, false); adminLicensePrefsEditor.commit(); break; case SAConstants.RESULT_ELM_ACTIVATED: adminLicensePrefsEditor.putBoolean(SAConstants.ELM, true); adminLicensePrefsEditor.commit(); setStates(SAConstants.INITIAL_STATE); break; case SAConstants.RESULT_KLM_ACTIVATED: adminLicensePrefsEditor.putBoolean(SAConstants.KLM, true); adminLicensePrefsEditor.commit(); setStates(SAConstants.INITIAL_STATE); break; default: break; } }
From source file:org.namelessrom.devicecontrol.appmanager.AppDetailsActivity.java
private void uninstall() { // try via native package manager api AppHelper.uninstallPackage(mPm, mAppItem.getPackageName()); // build our command final StringBuilder sb = new StringBuilder(); sb.append(String.format("pm uninstall %s;", mAppItem.getPackageName())); if (mAppItem.isSystemApp()) { sb.append("busybox mount -o rw,remount /system;"); }/*from w ww .j a v a 2s .c o m*/ sb.append(String.format("rm -rf %s;", mAppItem.getApplicationInfo().publicSourceDir)); sb.append(String.format("rm -rf %s;", mAppItem.getApplicationInfo().sourceDir)); sb.append(String.format("rm -rf %s;", mAppItem.getApplicationInfo().dataDir)); if (mAppItem.isSystemApp()) { sb.append("busybox mount -o ro,remount /system;"); } final String cmd = sb.toString(); Logger.v(this, cmd); // create the dialog (will not be shown for a long amount of time though) final ProgressDialog dialog; dialog = new ProgressDialog(this); dialog.setTitle(R.string.uninstalling); dialog.setMessage(getString(R.string.applying_wait)); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setCancelable(false); new AsyncTask<Void, Void, Void>() { @Override protected void onPreExecute() { dialog.show(); } @Override protected Void doInBackground(Void... voids) { Utils.runRootCommand(cmd, true); return null; } @Override protected void onPostExecute(Void aVoid) { dialog.dismiss(); Toast.makeText(AppDetailsActivity.this, getString(R.string.uninstall_success, mAppItem.getLabel()), Toast.LENGTH_SHORT).show(); mAppItem = null; finish(); } }.execute(); }
From source file:org.deviceconnect.android.manager.setting.ReqResDebugActivity.java
/** * ??./*from w ww . jav a 2s . com*/ * ???????? * @return ?????true??????false */ private synchronized boolean showProgressDialog() { if (mProgressDialog != null) { return false; } mProgressDialog = new ProgressDialog(this); mProgressDialog.setTitle("dConnect?"); mProgressDialog.setMessage("????????."); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setCancelable(false); mProgressDialog.show(); return true; }
From source file:org.exobel.routerkeygen.ui.Preferences.java
protected Dialog onCreateDialog(int id) { AlertDialog.Builder builder = new Builder(this); switch (id) { case DIALOG_ABOUT: { LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.about_dialog, (ViewGroup) findViewById(R.id.tabhost)); TabHost tabs = (TabHost) layout.findViewById(R.id.tabhost); tabs.setup();/* w w w.j ava 2 s . c o m*/ TabSpec tspec1 = tabs.newTabSpec("about"); tspec1.setIndicator(getString(R.string.pref_about)); tspec1.setContent(R.id.text_about_scroll); TextView text = ((TextView) layout.findViewById(R.id.text_about)); text.setMovementMethod(LinkMovementMethod.getInstance()); text.append(VERSION + "\n" + LAUNCH_DATE); tabs.addTab(tspec1); TabSpec tspec2 = tabs.newTabSpec("credits"); tspec2.setIndicator(getString(R.string.dialog_about_credits)); tspec2.setContent(R.id.about_credits_scroll); ((TextView) layout.findViewById(R.id.about_credits)) .setMovementMethod(LinkMovementMethod.getInstance()); tabs.addTab(tspec2); TabSpec tspec3 = tabs.newTabSpec("license"); tspec3.setIndicator(getString(R.string.dialog_about_license)); tspec3.setContent(R.id.about_license_scroll); ((TextView) layout.findViewById(R.id.about_license)) .setMovementMethod(LinkMovementMethod.getInstance()); tabs.addTab(tspec3); builder.setNeutralButton(R.string.bt_close, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_ABOUT); } }); builder.setView(layout); break; } case DIALOG_ASK_DOWNLOAD: { DialogInterface.OnClickListener diOnClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Check if we have the latest dictionary version. try { checkCurrentDictionary(); } catch (Exception e) { e.printStackTrace(); } } }; builder.setTitle(R.string.pref_download); builder.setMessage(R.string.msg_dicislarge); builder.setCancelable(false); builder.setPositiveButton(android.R.string.yes, diOnClickListener); builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { removeDialog(DIALOG_ASK_DOWNLOAD); } }); break; } case DIALOG_UPDATE_NEEDED: { builder.setTitle(R.string.update_title) .setMessage(getString(R.string.update_message, lastVersion.version)) .setNegativeButton(R.string.bt_close, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_UPDATE_NEEDED); } }).setPositiveButton(R.string.bt_website, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(lastVersion.url))); } }); break; } case DIALOG_WAIT: { ProgressDialog pbarDialog = new ProgressDialog(Preferences.this); pbarDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); pbarDialog.setMessage(getString(R.string.msg_wait)); return pbarDialog; } case DIALOG_ERROR_TOO_ADVANCED: { builder.setTitle(R.string.msg_error).setMessage(R.string.msg_err_online_too_adv); break; } case DIALOG_ERROR: { builder.setTitle(R.string.msg_error).setMessage(R.string.msg_err_unkown); break; } case DIALOG_CHANGELOG: { LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); ChangeLogListView chgList = (ChangeLogListView) layoutInflater.inflate(R.layout.dialog_changelog, (ViewGroup) this.getWindow().getDecorView().getRootView(), false); builder.setTitle(R.string.pref_changelog).setView(chgList).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }); break; } } return builder.create(); }
From source file:com.android.gallery3d.ingest.IngestActivity.java
private void updateProgressDialog() { ProgressDialog dialog = getProgressDialog(); boolean indeterminate = (mProgressState.max == 0); dialog.setIndeterminate(indeterminate); dialog.setProgressStyle(indeterminate ? ProgressDialog.STYLE_SPINNER : ProgressDialog.STYLE_HORIZONTAL); if (mProgressState.title != null) { dialog.setTitle(mProgressState.title); }/* ww w.j av a2 s . c om*/ if (mProgressState.message != null) { dialog.setMessage(mProgressState.message); } if (!indeterminate) { dialog.setProgress(mProgressState.current); dialog.setMax(mProgressState.max); } if (!dialog.isShowing()) { dialog.show(); } }
From source file:com.beestar.ble.ble.ui.BleScanActivity.java
private void showDialog(String message) { progressDialog = new ProgressDialog(this); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setMessage(message);/*from w w w . j a va2 s.c o m*/ progressDialog.show(); }