Java Code Examples for android.app.ProgressDialog#show()
The following examples show how to use
android.app.ProgressDialog#show() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Search.java From JotaTextEditor with Apache License 2.0 | 6 votes |
@Override protected void onPreExecute() { mCancelled=false; mProgressDialog = new ProgressDialog(mParent); mProgressDialog.setTitle(R.string.spinner_message); mProgressDialog.setMessage(mQuery); mProgressDialog.setIndeterminate(true); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setCancelable(true); mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { mCancelled=true; cancel(false); } }); mProgressDialog.show(); mParent = null; }
Example 2
Source File: DexDex.java From pokemon-go-xposed-mitm with GNU General Public License v3.0 | 6 votes |
public static void showUiBlocker(Activity startActivity, CharSequence title, CharSequence msg) { if(debug) { Log.d(TAG, "showUiBlocker() for " + startActivity); } uiBlockedActivity = startActivity; final ProgressDialog progressDialog = new ProgressDialog(startActivity); progressDialog.setMessage(msg); progressDialog.setTitle(title); progressDialog.setIndeterminate(true); dexOptProgressObserver = new Observer() { @Override public void update(Observable observable, Object o) { if(o==Integer.valueOf(PROGRESS_COMPLETE)) { progressDialog.dismiss(); } } }; progressDialog.show(); }
Example 3
Source File: PhonkScriptHelper.java From PHONK with GNU General Public License v3.0 | 6 votes |
public static void shareProtoFileDialog(Context c, String folder, String name) { final ProgressDialog progress = new ProgressDialog(c); progress.setTitle("Exporting .proto"); progress.setMessage("Your project will be ready soon!"); progress.setCancelable(true); progress.setCanceledOnTouchOutside(false); progress.show(); Project p = new Project(folder, name); String zipFilePath = exportProjectAsProtoFile(p); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(zipFilePath))); shareIntent.setType("application/zip"); progress.dismiss(); c.startActivity(Intent.createChooser(shareIntent, c.getResources().getText(R.string.share_phonk_file))); }
Example 4
Source File: Id3TagEditorActivity.java From Rey-MusicPlayer with Apache License 2.0 | 5 votes |
private void updateFile() { mProgressUpdateDialog = new ProgressDialog(this); mProgressUpdateDialog.setMessage(getResources().getString(R.string.updating_tags)); mProgressUpdateDialog.setCancelable(false); mProgressUpdateDialog.show(); mCompositeDisposable.add(Observable.fromCallable(() -> embedDataFile()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribeWith(new DisposableObserver<Boolean>() { @Override public void onNext(Boolean aBoolean) { } @Override public void onError(Throwable e) { Log.d(TAG, "ERROR " + e.getMessage()); mProgressUpdateDialog.dismiss(); Toast.makeText(Id3TagEditorActivity.this, "Sorry, Could not update changes.", Toast.LENGTH_SHORT).show(); } @Override public void onComplete() { } })); }
Example 5
Source File: Comment.java From iZhihu with GNU General Public License v2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); progressDialog = ProgressDialog.show(Comment.this, getString(R.string.app_name), getString(R.string.loading), false, false); answerId = getIntent().getIntExtra(ANSWER_ID, 0); if (answerId == 0) { showErrorAndFinish(""); } getActionBar().setDisplayHomeAsUpEnabled(true); }
Example 6
Source File: SettingsActivity.java From wear-notify-for-reddit with Apache License 2.0 | 5 votes |
private void syncSubreddits() { final ProgressDialog spinner = ProgressDialog.show(getActivity(), "", getString(R.string.syncing_subreddits)); mRedditService.subredditSubscriptions() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<SubscriptionResponse>() { @Override public void onNext(SubscriptionResponse response) { if (response.hasErrors()) { throw new RuntimeException("Failed to sync subreddits: " + response); } SubredditPreference pref = (SubredditPreference) findPreference( getString(R.string.prefs_key_subreddits)); pref.saveSubreddits(response.getSubreddits()); } @Override public void onCompleted() { spinner.dismiss(); mAnalytics.sendEvent(Logger.LOG_EVENT_SYNC_SUBREDDITS, Logger.LOG_EVENT_SUCCESS); Toast.makeText(getActivity(), R.string.successfully_synced_subreddits, Toast.LENGTH_SHORT).show(); } @Override public void onError(Throwable e) { mAnalytics.sendEvent(Logger.LOG_EVENT_SYNC_SUBREDDITS, Logger.LOG_EVENT_FAILURE); Timber.e(e, "Failed to sync subreddits"); spinner.dismiss(); Toast.makeText(getActivity(), R.string.failed_to_sync_subreddits, Toast.LENGTH_SHORT).show(); } }); }
Example 7
Source File: DeviceListFragment.java From Demo_Public with MIT License | 5 votes |
public void onInitiateDiscovery(){ if(progressDialog != null && progressDialog.isShowing()) progressDialog.dismiss(); progressDialog = ProgressDialog.show(getActivity(), "Press back to channel", "finding peers",true,true, new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }); }
Example 8
Source File: PAudioRecorder.java From PHONK with GNU General Public License v3.0 | 5 votes |
@PhonkMethod(description = "Starts recording", example = "") @PhonkMethodParam(params = {"showProgressBoolean"}) public PAudioRecorder record(String fileName) { init(); recorder.setOutputFile(getAppRunner().getProject().getFullPathForFile(fileName)); try { recorder.prepare(); } catch (Exception e) { e.printStackTrace(); } if (showProgress && getActivity() != null) { mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setTitle("Record!"); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Stop recording", (dialog, whichButton) -> { mProgressDialog.dismiss(); stop(); }); mProgressDialog.setOnCancelListener(p1 -> stop()); mProgressDialog.show(); } recorder.start(); return this; }
Example 9
Source File: DialogActivity.java From sa-sdk-android with Apache License 2.0 | 5 votes |
private void showWaitingDialog() { /* 等待Dialog具有屏蔽其他控件的交互能力 * @setCancelable 为使屏幕不可点击,设置为不可取消(false) * 下载等事件完成后,主动调用函数关闭该Dialog */ ProgressDialog waitingDialog = new ProgressDialog(DialogActivity.this); waitingDialog.setTitle("我是一个等待Dialog"); waitingDialog.setMessage("等待中..."); waitingDialog.setIndeterminate(true); waitingDialog.setCancelable(true); waitingDialog.show(); }
Example 10
Source File: SettingsFragment.java From SimplicityBrowser with MIT License | 5 votes |
private void deleteCache(){ try{ FileUtils.deleteQuietly(context.getCacheDir()); pDialog = new ProgressDialog(getActivity()); pDialog.setMessage(getResources().getString(R.string.trimming)); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); final Handler handler = new Handler(); handler.postDelayed(() -> { long size = getDirSize(context.getCacheDir()); try { if (cache != null) { cache.setSummary(getResources().getString(R.string.current_cache_size) + ": " + readableFileSize(size)); //if (deleted) { Toast.makeText(context, context.getResources().getString(R.string.success), Toast.LENGTH_SHORT).show(); if (pDialog != null && pDialog.isShowing()) { pDialog.dismiss(); } } else { Toast.makeText(context, context.getResources().getString(R.string.error), Toast.LENGTH_SHORT).show(); if (pDialog != null && pDialog.isShowing()) { pDialog.dismiss(); } } } catch (IllegalStateException e) { Toast.makeText(context, context.getResources().getString(R.string.error), Toast.LENGTH_SHORT).show(); } }, 5000); }catch (Exception z){ z.printStackTrace(); } }
Example 11
Source File: ResultActivity.java From TextOcrExample with Apache License 2.0 | 5 votes |
private void init() { File dataDir = new File(tessdata); if (!dataDir.exists()) { dataDir.mkdirs(); mDialog = new ProgressDialog(ResultActivity.this); mDialog.setMessage("拷贝训练数据中......"); mDialog.setCanceledOnTouchOutside(false); mDialog.show(); ThreadManager.getInstance().createLongPool().execute(new Runnable() { @Override public void run() { Message msg; try { FileUtil.assets2SDCard(ResultActivity.this, "chi_sim.traineddata", tessdata + File.separator + language + ".traineddata"); msg = Message.obtain(); msg.what = 2; } catch (IOException e) { msg = Message.obtain(); msg.what = 0; msg.obj = e.getMessage(); } mHandler.sendMessage(msg); } }); } else { handleBitmap(); } }
Example 12
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 5 votes |
public static ProgressDialog showProgressDlg(final Context context, final String title, final String message, final boolean indeterminate, final boolean cancelable, final OnCancelListener lCancel) { MMAppMgr.activate(true); return ProgressDialog.show(context, title, message, indeterminate, cancelable, new DialogInterface.OnCancelListener() { @Override public void onCancel(final DialogInterface dialog) { if (lCancel != null) { lCancel.onCancel(dialog); } MMAppMgr.activate(false); } }); }
Example 13
Source File: TraitEditorActivity.java From Field-Book with GNU General Public License v2.0 | 5 votes |
@Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(thisActivity); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setMessage(Html .fromHtml(thisActivity.getString(R.string.import_dialog_importing))); dialog.show(); }
Example 14
Source File: Utils.java From android-utils with MIT License | 5 votes |
/** * Shows a progress dialog with a spinning animation in it. This method must preferably called * from a UI thread. * * @param ctx Activity context * @param title Title of the progress dialog * @param body Body/Message to be shown in the progress dialog * @param icon Icon to show in the progress dialog. It can be null. * @param isCancellable True if the dialog can be cancelled on back button press, false otherwise **/ public static void showProgressDialog(Context ctx, String title, String body, Drawable icon, boolean isCancellable) { if (ctx instanceof Activity) { if (!((Activity) ctx).isFinishing()) { mProgressDialog = ProgressDialog.show(ctx, title, body, true); mProgressDialog.setIcon(icon); mProgressDialog.setCancelable(isCancellable); } } }
Example 15
Source File: EaseContactListFragment.java From monolog-android with MIT License | 5 votes |
/** * 把user移入到黑名单 */ 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 { //加入到黑名单 EMContactManager.getInstance().addUserToBlackList(username,false); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2, 0).show(); refresh(); } }); } catch (EaseMobException e) { e.printStackTrace(); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st3, 0).show(); } }); } } }).start(); }
Example 16
Source File: GroupMemberAddTask.java From YiBo with Apache License 2.0 | 5 votes |
@Override protected void onPreExecute() { super.onPreExecute(); List<BaseUser> targetList = new ArrayList<BaseUser>(); UserGroupDao dao = new UserGroupDao(context); StringBuffer sb = new StringBuffer(); for (BaseUser user : userList) { boolean isExist = dao.isExist(group, user); if (!isExist) { targetList.add(user); } else { sb.append(user.getMentionName() + " "); } } userList = targetList; if (sb.length() > 0) { String msg = context.getString(R.string.msg_group_member_exist, sb.toString()); Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); } if (ListUtil.isNotEmpty(userList)) { dialog = ProgressDialog.show(context, null, context.getString(R.string.msg_group_member_add)); dialog.setCancelable(true); dialog.setOnCancelListener(onCancelListener); dialog.setOwnerActivity((Activity)context); } else { cancel(true); } }
Example 17
Source File: ProfileActivity.java From android-oauth-linkedin-example with MIT License | 4 votes |
@Override protected void onPreExecute(){ pd = ProgressDialog.show(ProfileActivity.this, "", ProfileActivity.this.getString(R.string.loading),true); }
Example 18
Source File: PhotoPickerActivity.java From PhotoPicker with Apache License 2.0 | 4 votes |
@Override protected void onPreExecute() { mProgressDialog = ProgressDialog.show(PhotoPickerActivity.this, null, "loading..."); }
Example 19
Source File: ChannelInfoActivity.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void onPreExecute() { super.onPreExecute(); progressDialog = ProgressDialog.show(context, "", context.getString(R.string.please_wait_info), true); }
Example 20
Source File: MainActivity.java From NewAndroidTwitter with Apache License 2.0 | 3 votes |
private void getCredentials() { final ProgressDialog progressDlg = new ProgressDialog(this); progressDlg.setMessage("Getting credentials..."); progressDlg.setCancelable(false); progressDlg.show(); TwitterRequest request = new TwitterRequest(mTwitter.getConsumer(), mTwitter.getAccessToken()); request.verifyCredentials(new TwitterRequest.VerifyCredentialListener() { @Override public void onSuccess(TwitterUser user) { progressDlg.dismiss(); showToast("Hello " + user.name); saveCredential(user.screenName, user.name, user.profileImageUrl); startActivity(new Intent(getActivity(), UserActivity.class)); finish(); } @Override public void onError(String error) { progressDlg.dismiss(); showToast(error); } }); }