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


Java DialogInterface.OnCancelListener方法代码示例

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


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

示例1: createLoadingDialog

import android.content.DialogInterface; //导入方法依赖的package包/类
/**
 * 有取消回调的进度dialog
 * @param context
 * @param msg
 * @return
 */
public static Dialog createLoadingDialog(Activity context, String msg, DialogInterface.OnCancelListener listener) {
    final Dialog dialog = new Dialog(context , R.style.NoBackGroundDialog);
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
    if(listener != null) dialog.setOnCancelListener(listener);
    Window window = dialog.getWindow();
    assert window != null;
    window.setGravity(Gravity.CENTER);
    int width = ScreenUtil.getWidth(context) * 2 / 3;
    window.setLayout(width,
            android.view.WindowManager.LayoutParams.WRAP_CONTENT);
    View view = context.getLayoutInflater().inflate(
            R.layout.loading_dialog, null);
    TextView tipTextView = (TextView) view.findViewById(R.id.tipTextView);// 提示文字
    if(!TextUtils.isEmpty(msg)){
        tipTextView.setText(msg);// 设置加载信息
    }

    window.setContentView(view);//
    return dialog;

}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:29,代码来源:DialogUtil.java

示例2: createJDLoadingDialog

import android.content.DialogInterface; //导入方法依赖的package包/类
/**
 * gif动画进度
 * @param context
 *
 * @return
 */
public static Dialog createJDLoadingDialog(Activity context, DialogInterface.OnCancelListener listener) {
    final Dialog dialog = new Dialog(context , R.style.NoBackGroundDialog);
    dialog.show();
    dialog.setCanceledOnTouchOutside(false);
    if(listener != null) dialog.setOnCancelListener(listener);
    Window window = dialog.getWindow();
    assert window != null;
    window.setGravity(Gravity.CENTER);
    window.setLayout(android.view.WindowManager.LayoutParams.WRAP_CONTENT,
            android.view.WindowManager.LayoutParams.WRAP_CONTENT);
    View view = context.getLayoutInflater().inflate(
            R.layout.jd_loading_dialog, null);
    window.setContentView(view);//
    return dialog;

}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:23,代码来源:DialogUtil.java

示例3: show

import android.content.DialogInterface; //导入方法依赖的package包/类
public void show(Context context, @StringRes int titleId, @StringRes int messageId,
                 DialogInterface.OnCancelListener listener) {
    dismiss();
    DialogBuilder builder = new DialogBuilder(context);
    if (titleId > 0) {
        builder.setTitle(titleId);
    }
    LayoutInflater inflater = LayoutInflater.from(context);
    View itemView = inflater.inflate(R.layout.row_progress, null);
    messageTextView = (TextView) itemView.findViewById(R.id.text_progress);
    if (messageId > 0) {
        messageTextView.setText(messageId);
    }
    builder.addItem(itemView);
    builder.setOnCancelListener(listener);
    dialog = builder.show();
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:ProgressDialogHolder.java

示例4: showAlert

import android.content.DialogInterface; //导入方法依赖的package包/类
public static AlertDialog showAlert(final Context context, final String title, final View view, final DialogInterface.OnCancelListener lCancel) {
	if (context instanceof Activity && ((Activity) context).isFinishing()) {
		return null;
	}

	final Builder builder = new AlertDialog.Builder(context);
	builder.setTitle(title);
	builder.setView(view);
	// builder.setCancelable(true);
	builder.setOnCancelListener(lCancel);
	final AlertDialog alert = builder.create();
	alert.show();
	return alert;
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:15,代码来源:MMAlert.java

示例5: showProgressDialog

import android.content.DialogInterface; //导入方法依赖的package包/类
protected void showProgressDialog(String msg , DialogInterface.OnCancelListener listener){
    if(loadingDialog == null){
        loadingDialog = DialogUtil.createLoadingDialog(this, msg, listener);
    }else if(!loadingDialog.isShowing()){
        loadingDialog.show();
    }

}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:9,代码来源:BaseActivity.java

示例6: executeCropTaskAfterPrompt

import android.content.DialogInterface; //导入方法依赖的package包/类
/**
 * Calls cropTask.execute(), once the user has selected which wallpaper to set. On pre-N
 * devices, the prompt is not displayed since there is no API to set the lockscreen wallpaper.
 * <p>
 * TODO: Don't use CropAndSetWallpaperTask on N+, because the new API will handle cropping instead.
 */
public static void executeCropTaskAfterPrompt(
        Context context, final AsyncTask<Integer, ?, ?> cropTask,
        DialogInterface.OnCancelListener onCancelListener) {
    if (Utilities.isNycOrAbove()) {
        new AlertDialog.Builder(context)
                .setTitle(R.string.wallpaper_instructions)
                .setItems(R.array.which_wallpaper_options, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int selectedItemIndex) {
                        int whichWallpaper;
                        if (selectedItemIndex == 0) {
                            whichWallpaper = WallpaperManagerCompat.FLAG_SET_SYSTEM;
                        } else if (selectedItemIndex == 1) {
                            whichWallpaper = WallpaperManagerCompat.FLAG_SET_LOCK;
                        } else {
                            whichWallpaper = WallpaperManagerCompat.FLAG_SET_SYSTEM
                                    | WallpaperManagerCompat.FLAG_SET_LOCK;
                        }
                        cropTask.execute(whichWallpaper);
                    }
                })
                .setOnCancelListener(onCancelListener)
                .show();
    } else {
        cropTask.execute(WallpaperManagerCompat.FLAG_SET_SYSTEM);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:34,代码来源:DialogUtils.java

示例7: CommonDialog

import android.content.DialogInterface; //导入方法依赖的package包/类
protected CommonDialog(Context context, boolean flag,
                       DialogInterface.OnCancelListener listener) {
    super(context, flag, listener);
    contentPadding = (int) getContext().getResources().getDimension(
            R.dimen.global_dialog_padding);
    init(context);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:8,代码来源:CommonDialog.java

示例8: showProgressDialog

import android.content.DialogInterface; //导入方法依赖的package包/类
private void showProgressDialog(
        @Nullable final String message,
        final boolean cancelable,
        @Nullable final DialogInterface.OnCancelListener cancelListener) {
    final ProgressDialog prevDialog = dialogAtomicReference.getAndSet(null);
    if (prevDialog != null && prevDialog.isShowing()) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                prevDialog.dismiss();
            }
        });
    }

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final ProgressDialog newDialog = ProgressDialog.show(
                    // Context
                    MainActivity.this,
                    // Title
                    null,
                    // Message
                    message,
                    // Indeterminate
                    true,
                    // Cancelable
                    cancelable,
                    // CancelListener
                    cancelListener
            );
            if (!dialogAtomicReference.compareAndSet(null, newDialog)) {
                newDialog.dismiss();
            }
        }
    });
}
 
开发者ID:powdream,项目名称:google-speech-api-android,代码行数:38,代码来源:MainActivity.java

示例9: setOnCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
public Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    builder.setOnCancelListener(onCancelListener);
    return this;
}
 
开发者ID:yanzhenjie,项目名称:CompatAlertDialog,代码行数:5,代码来源:AlertDialog.java

示例10: setOnCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:4,代码来源:TimePickerDialog.java

示例11: setOnCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
    mOnCancelListener = onCancelListener;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:5,代码来源:DatePickerDialog.java

示例12: setOnCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
public DialogBuilder setOnCancelListener(DialogInterface.OnCancelListener listener) {
    getDialog().setOnCancelListener(listener);
    return this;
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:5,代码来源:DialogBuilder.java

示例13: setOnCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
public void setOnCancelListener(DialogInterface.OnCancelListener listener){
    dialog.setOnCancelListener(listener);
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:4,代码来源:LoadingDialog.java

示例14: getOnDialogCancelListener

import android.content.DialogInterface; //导入方法依赖的package包/类
public DialogInterface.OnCancelListener getOnDialogCancelListener() {
    return mOnDialogCancelListener;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:4,代码来源:WallpaperCropActivity.java

示例15: showError

import android.content.DialogInterface; //导入方法依赖的package包/类
/**
 * Shows an error message.
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            the message.
 * @param listener
 *            will be called after the user cancelled the dialog.
 */
public static void showError(Context context, CharSequence msg,
        DialogInterface.OnCancelListener listener) {
    AlertDialog dlg = newAlertDlg(context);
    dlg.setIcon(android.R.drawable.ic_dialog_alert);
    dlg.setTitle(R.string.afc_title_error);
    dlg.setMessage(msg);
    dlg.setOnCancelListener(listener);
    dlg.show();
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:20,代码来源:Dlg.java


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