当前位置: 首页>>代码示例>>Java>>正文


Java ProgressDialog.setOnCancelListener方法代码示例

本文整理汇总了Java中android.app.ProgressDialog.setOnCancelListener方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressDialog.setOnCancelListener方法的具体用法?Java ProgressDialog.setOnCancelListener怎么用?Java ProgressDialog.setOnCancelListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.ProgressDialog的用法示例。


在下文中一共展示了ProgressDialog.setOnCancelListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPreExecute

import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getClass().getName());
    wakeLock.acquire();

    progressDialog = new ProgressDialog(context);
    progressDialog.setIcon(R.mipmap.ic_launcher);
    progressDialog.setTitle(R.string.app_name);
    progressDialog.setMessage(context.getString(R.string.msg_downloading, url.toString()));
    progressDialog.setIndeterminate(true);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            DownloadTask.this.cancel(true);
        }
    });
    progressDialog.show();
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:22,代码来源:DownloadTask.java

示例2: LoadingDialog

import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
 * Creates new {@link LoadingDialog}
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            message will be shown in the dialog.
 * @param cancelable
 *            as the name means.
 */
public LoadingDialog(Context context, String msg, boolean cancelable) {
    mDialog = new ProgressDialog(context);
    mDialog.setMessage(msg);
    mDialog.setIndeterminate(true);
    mDialog.setCancelable(cancelable);
    if (cancelable) {
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
                cancel(true);
            }
        });
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:27,代码来源:LoadingDialog.java

示例3: onPreExecute

import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute()
{
	super.onPreExecute();
	mProgressDialog = new ProgressDialog(mActivity);

	mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener()
	{
		public void onCancel(DialogInterface dialog)
		{
			taskCancel();
		}
	});

	mProgressDialog.setMessage(mActivity.getText(R.string.notify_now_in_progress));
	mProgressDialog.show();
	errorOccured = false;

	handler = new Handler();
}
 
开发者ID:monolifed,项目名称:mininoteview,代码行数:21,代码来源:FileOperatorTask.java

示例4: receiveMessages

import android.app.ProgressDialog; //导入方法依赖的package包/类
private void receiveMessages(int i) {
  if (checkState == CheckState.EXIST) {
    changeState(State.RECEIVEING);

    slotIndex = i;
    String address = mainActivity.getSavedValue("REMO_DEVICE_ADDRESS");
    remoController.recevieMessages(address);
    receiveDialog = new ProgressDialog(mainActivity);
    receiveDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        receiveDialog.cancel();
      }
    });
    receiveDialog.setOnCancelListener(new OnCancelListener() {
      @Override
      public void onCancel(DialogInterface dialogInterface) {
        Log.d(TAG, "onCancel: ");
        changeState(State.IDLE);
        remoController.cancelReceiveMessages();
      }
    });
    receiveDialog.setMessage(getString(R.string.remo_receive_dialog));
    receiveDialog.show();
  }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:27,代码来源:RemoConfigFragment.java

示例5: WallpaperDownloader

import android.app.ProgressDialog; //导入方法依赖的package包/类
public WallpaperDownloader(Context context, CatalogItem item) {
    super(context);

    this.context = context;
    this.catalogItem = item;

    progressDialog = new ProgressDialog(context);
    progressDialog.setMessage(context.getString(R.string.main_ongoing_download));
    progressDialog.setIndeterminate(true);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
        }
    });
}
 
开发者ID:lucasax,项目名称:Zero,代码行数:19,代码来源:WallpaperDownloader.java

示例6: WebServiceClient

import android.app.ProgressDialog; //导入方法依赖的package包/类
public WebServiceClient(Context context, WebServiceTaskListener<T> listener) {
    mContext = context;
    mListener = listener;
    if (mContext == null || mListener == null) { 
        throw new IllegalArgumentException();
    }

    mProgressDialog = new ProgressDialog(mContext);
    mProgressDialog.setMessage(mContext.getString(R.string.wsc_please_wait));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setCancelable(true);
    mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dlgInterface) {
            abortTaskIfRunning();
        }
    });

    mHash = getAppSignatureHash(mContext);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:21,代码来源:WebServiceClient.java

示例7: onCreateDialog

import android.app.ProgressDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setTitle(R.string.loading);
    progressDialog.setMessage(getString(R.string.please_wait));
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(this);

    request();
    return progressDialog;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:13,代码来源:ResolveDomainDialog.java

示例8: displayDeepLookingCommentProgress

import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public void displayDeepLookingCommentProgress() {
    mDeepLookingProgressDialog = new ProgressDialog(getActivity());
    mDeepLookingProgressDialog.setMessage(getString(R.string.please_wait));
    mDeepLookingProgressDialog.setCancelable(true);
    mDeepLookingProgressDialog.setOnCancelListener(dialog -> getPresenter().fireDeepLookingCancelledByUser());
    mDeepLookingProgressDialog.show();
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:9,代码来源:CommentsFragment.java

示例9: goToPostEditor

import android.app.ProgressDialog; //导入方法依赖的package包/类
public static void goToPostEditor(@NonNull Activity activity, final int accountId, final Post post){
    ProgressDialog dialog = createProgressDialog(activity);
    WeakReference<Dialog> dialogWeakReference = new WeakReference<>(dialog);
    WeakReference<Activity> reference = new WeakReference<>(activity);

    final int ownerId = post.getOwnerId();

    Set<Integer> ids = new HashSet<>();
    ids.add(accountId);
    ids.add(ownerId);

    Disposable disposable = InteractorFactory.createOwnerInteractor()
            .findBaseOwnersDataAsBundle(accountId, ids, IOwnersInteractor.MODE_NET)
            .compose(RxUtils.applySingleIOToMainSchedulers())
            .subscribe(owners -> {
                WallEditorAttrs attrs = new WallEditorAttrs(owners.getById(ownerId), owners.getById(accountId));

                Dialog d = dialogWeakReference.get();
                if (d != null) {
                    d.dismiss();
                }

                Activity a = reference.get();

                if (a != null) {
                    PlaceFactory.getEditPostPlace(accountId, post, attrs).tryOpenWith(a);
                }
            }, throwable -> safelyShowError(reference, throwable));

    dialog.setOnCancelListener(d -> disposable.dispose());
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:32,代码来源:PlaceUtil.java

示例10: initLoadDialog

import android.app.ProgressDialog; //导入方法依赖的package包/类
private void initLoadDialog() {
        if (mContextSoftReference.get() != null) {
                mDialog = new ProgressDialog(mContextSoftReference.get());
                mDialog.setMessage("正在加载..........请稍候..........");
                mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialog) {
                                dialog.cancel();
                                unsubscribe();
                        }
                });
        }
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:14,代码来源:CommonSubscriber.java

示例11: initUi

import android.app.ProgressDialog; //导入方法依赖的package包/类
@SuppressLint("ShowToast")
private void initUi() {
	mResultEditText = (EditText) findViewById(R.id.edt_result);
	mAuthidEditText = (EditText) findViewById(R.id.set_authId);
	btn_start_record = (Button) findViewById(R.id.isv_reocrd);
	btn_start_record.setOnTouchListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_getpassword).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_search).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_delete).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_identity).setOnClickListener(VocalVerifyDemo.this);


	mToast = Toast.makeText(VocalVerifyDemo.this, "", Toast.LENGTH_SHORT);
	mToast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);

	mProDialog = new ProgressDialog(VocalVerifyDemo.this);
	mProDialog.setCancelable(true);
	mProDialog.setTitle("请稍候");
	// cancel进度框时,取消正在进行的操作
	mProDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

		@Override
		public void onCancel(DialogInterface dialog) {
			if (null != mIdVerifier) {
				mIdVerifier.cancel();
			}
		}
	});

	// 密码选择RadioGroup初始化
	mSstTypeGroup = (RadioGroup) findViewById(R.id.vocal_radioGroup1);
	mSstTypeGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(RadioGroup group, int checkedId) {
			if( null == mIdVerifier ){
				// 创建单例失败,与 21001 错误为同样原因,参考 http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=9688
				showTip( "创建对象失败,请确认 libmsc.so 放置正确,且有调用 createUtility 进行初始化" );
				return;
			}

			// 取消之前操作
			if (mIdVerifier.isWorking()) {
				mIdVerifier.cancel();
			}
			cancelOperation();

			switch (checkedId) {
				case R.id.vocal_radioVerify:
					// 设置会话类型为验证
					mSST = SST_VERIFY;
					mVerifyNumPwd = VerifierUtil.generateNumberPassword(8);

					StringBuffer strBuffer = new StringBuffer();
					strBuffer.append("您的验证密码:" + mVerifyNumPwd + "\n");
					strBuffer.append("请长按“按住说话”按钮进行验证!\n");
					mResultEditText.setText(strBuffer.toString());
					break;
				case R.id.vocal_radioEnroll:
					// 设置会话类型为验证
					mSST = SST_ENROLL;

					if (null == mNumPwdSegs) {
						// 首次注册密码为空时,调用下载密码
						downloadPwd();
					} else {
						mResultEditText.setText("请长按“按住说话”按钮进行注册\n");
					}
					break;
				default:
					break;
			}
		}
	});
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:75,代码来源:VocalVerifyDemo.java

示例12: ApiSubscriber

import android.app.ProgressDialog; //导入方法依赖的package包/类
public ApiSubscriber(Context context, boolean cancleable, @NonNull ProgressDialog dialog){
    this.context = new WeakReference<>(context);
    this.dialog = dialog;
    this.cancleable = cancleable;
    dialog.setCancelable(cancleable);
    dialog.setOnCancelListener(this);
}
 
开发者ID:qiaop,项目名称:basicapp,代码行数:8,代码来源:ApiSubscriber.java

示例13: onPreExecute

import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
    super.onPreExecute();

    progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setMessage("Please wait!");
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
        }
    });
    progressDialog.show();
}
 
开发者ID:wangwang4git,项目名称:ReadInJoy-And-Train,代码行数:16,代码来源:MainActivity.java

示例14: editTextAction

import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public void editTextAction(String url, Bundle args) {

    // Fill missing url data
    if(!url.startsWith("http://") && !url.startsWith("https://") ){
        url = "http://" + url;
    }
    // Create spinner
    progress = new ProgressDialog(this);
    progress.setTitle(getString(R.string.importing_wordpack));
    progress.setCancelable(true);
    progress.show();

    // Start asynctask dowloading json data
    wwd = (WebWordpackDownloader) new WebWordpackDownloader(){
        @Override
        protected void onPostExecute(String data) {
            progress.dismiss();
            if (data != null && !data.isEmpty()) {
                // Save wordpack, add it to list
                Wordpack wordpack = new WordpackParser().getWordpackFromText(data);
                if (!(wordpack == null)) { strMgr.addWordpackToMemory(wordpack);
                    refreshList();
                }
            } else {
                new AlertDialog.Builder(WordpacksListActivity.this)
                        .setTitle(R.string.error)
                        .setMessage(R.string.im_error)
                        .setPositiveButton(android.R.string.ok, null).show();
            }
        }
    }.execute(url);
    // Cancel asynctask when you cancel the dialog
    progress.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            wwd.cancel(true);
        }
    });
}
 
开发者ID:feelfreelinux,项目名称:WordLing,代码行数:41,代码来源:WordpacksListActivity.java

示例15: showMapWithLocationClient

import android.app.ProgressDialog; //导入方法依赖的package包/类
private void showMapWithLocationClient() {
	String str1 = getResources().getString(R.string.Making_sure_your_location);
	progressDialog = new ProgressDialog(this);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	progressDialog.setMessage(str1);

	progressDialog.setOnCancelListener(new OnCancelListener() {

		public void onCancel(DialogInterface arg0) {
			if (progressDialog.isShowing()) {
				progressDialog.dismiss();
			}
			Log.d("map", "cancel retrieve location");
			finish();
		}
	});

	progressDialog.show();

	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);

	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// open gps
	// option.setCoorType("bd09ll"); 
	// Johnson change to use gcj02 coordination. chinese national standard
	// so need to conver to bd09 everytime when draw on baidu map
	option.setCoorType("gcj02");
	option.setScanSpan(30000);
	option.setAddrType("all");
	mLocClient.setLocOption(option);
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:34,代码来源:EaseBaiduMapActivity.java


注:本文中的android.app.ProgressDialog.setOnCancelListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。