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


Java AlertDialog.setOnShowListener方法代码示例

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


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

示例1: createDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public  Dialog createDialog() {
    mAdapter = new ArrayAdapter<String>(CustomizeLaunchersActivity.this, R.layout.add_list_item);
    mAdapter.add(getString(R.string.custom_icon_select_picture));
    mAdapter.add(getString(R.string.custom_icon_icon_packs));
    if (SpecialIconStore.hasBitmap(CustomizeLaunchersActivity.this, mAppClicked.getComponentName(), SpecialIconStore.IconType.Custom)) {
        mAdapter.add(getString(R.string.custom_icon_clear_icon));
    }

    final AlertDialog.Builder builder = new AlertDialog.Builder(CustomizeLaunchersActivity.this);
    builder.setTitle(R.string.custom_icon_select_icon_type);
    builder.setAdapter(mAdapter, this);

    //builder.setInverseBackgroundForced(false);

    AlertDialog dialog = builder.create();
    dialog.setOnCancelListener(this);
    dialog.setOnDismissListener(this);
    dialog.setOnShowListener(this);
    return dialog;
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:21,代码来源:CustomizeLaunchersActivity.java

示例2: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Applies the args
 */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.DialogStyle);

    // Apply args
    final AlertDialog d = builder.setTitle(title)
            .setMessage(message)
            .setNegativeButton("MORE", null)
            .setPositiveButton("OK", (dialog, which) -> dialog.dismiss())
            .create();

    d.setOnShowListener(dialog -> {
        final Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
        View.OnClickListener onMore = view -> {
            final AlertDialog alertDialog = ((AlertDialog) dialog);
            alertDialog.setMessage(ErrorDialog.this.message + "\n\n" + ErrorDialog.this.moreMSG);
            button.setVisibility(View.GONE);
        };
        button.setOnClickListener(onMore);
    });


    return d;
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:29,代码来源:ErrorDialog.java

示例3: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Activity activity = getActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setIcon(BuildConfig.ICON);
    builder.setTitle(R.string.brevent);
    builder.setMessage(R.string.pay_verify);
    builder.setPositiveButton(R.string.pay_alipay, this);
    builder.setNegativeButton(R.string.pay_email, this);
    builder.setNeutralButton(android.R.string.ok, this);
    AlertDialog alertDialog = builder.create();
    alertDialog.setOnShowListener(this);
    return alertDialog;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:15,代码来源:AppsDonateFragment.java

示例4: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
	final View view = getActivity().getLayoutInflater().inflate(R.layout.view_browser_settings_fs_dialog, null);

	this.fillListView(view);
	
	AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
	builder.setTitle(R.string.browser_settings_fs_dlg_title);
	builder.setView(view);
	builder.setPositiveButton(R.string.global_button_ok, null);
	builder.setNegativeButton(R.string.global_button_cancel, null);
	
	final AlertDialog dialog = builder.create();
	
	dialog.setOnShowListener(new OnShowListener() {
		public void onShow(DialogInterface dlg) {
			dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
				public void onClick(View v) {
					if( createSettings(view) ) {
						dialog.dismiss();
					}
				}
			});
		}
	});

	return dialog;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:29,代码来源:TGBrowserSettingsDialog.java

示例5: changeDialogFontColor

import android.app.AlertDialog; //导入方法依赖的package包/类
public static void changeDialogFontColor(final AlertDialog dialog) {
    dialog.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialogInterface) {
            doChangeDialogFontColor(dialog);
        }
    });

}
 
开发者ID:privacyidea,项目名称:privacyidea-authenticator,代码行数:10,代码来源:MainActivity.java

示例6: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstance){
    Task task = (Task) getArguments().getSerializable
            (AppConstants.ADD_VIEW_EXTRA);

    position = getArguments().getInt(POSITION);
    AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());

    String taskString = task == null ? "" : task.toString();

    if (task == null){
        Log.d("ViewTaskFragment", "Task Fragment");
    }

    AlertDialog alertDialog = dialog.setTitle("Task Details")
            .setMessage(taskString)
            //dismiss dialog
            .setPositiveButton("Cancel", (dialogInterface, i) -> dismiss())
            //edit callBack
            .setNegativeButton("Edit", (dialogInterface, i) -> editTask(task))
            .create();

    alertDialog.setOnShowListener(dialogInterface -> {
        alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
                .setTextColor(getResources().getColor(R.color.colorAccent));
        alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
                .setTextColor(getResources().getColor(R.color.colorAccent));
    });

    return alertDialog;
}
 
开发者ID:aumarbello,项目名称:Tasks,代码行数:33,代码来源:ViewTaskFragment.java

示例7: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    activityComponent().inject(this);
    @SuppressLint("InflateParams")
    View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_feedback, null);
    ButterKnife.bind(this, view);
    AlertDialog dialog = new AlertDialog.Builder(getActivity())
        .setTitle(R.string.feedback_title)
        .setView(view)
        .setPositiveButton(R.string.feedback_send, null)
        .setNegativeButton(R.string.dialog_action_cancel, null).create();
    dialog.setOnShowListener(dialog1 ->
        dialog.getButton(DialogInterface.BUTTON_POSITIVE)
            .setOnClickListener(v ->
                mFeedbackPresenter.sendFeedback(
                    getString(R.string.feedback_transmit_format),
                    mEmailInput.getText().toString().trim(),
                    mOpinionInput.getText().toString().trim(),
                    mContextName, mCurrentUser,
                    getString(R.string.feedback_transmit_subject),
                    getString(R.string.feedback_transmit_to))));

    mEmailInput.setText(mEmail);
    mOpinionInput.setText(mOpinion);

    mFeedbackPresenter.attachView(this);

    return dialog;
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:31,代码来源:FeedbackDialog.java

示例8: onPreferenceClick

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public boolean onPreferenceClick(final Preference preference) {
    final TwoStatePreference syncPreference = (TwoStatePreference) preference;
    if (syncPreference.isChecked()) {
        // Uncheck for now.
        syncPreference.setChecked(false);

        // Show opt-in.
        final AlertDialog optInDialog = new AlertDialog.Builder(getActivity())
                .setTitle(R.string.cloud_sync_title)
                .setMessage(R.string.cloud_sync_opt_in_text)
                .setPositiveButton(R.string.account_select_ok,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(final DialogInterface dialog,
                                                final int which) {
                                if (which == DialogInterface.BUTTON_POSITIVE) {
                                    final Context context = getActivity();
                                    final String[] accountsForLogin =
                                            LoginAccountUtils.getAccountsForLogin(context);
                                    createAccountPicker(accountsForLogin,
                                            getSignedInAccountName(),
                                            new AccountChangedListener(syncPreference))
                                            .show();
                                }
                            }
                })
                .setNegativeButton(R.string.cloud_sync_cancel, null)
                .create();
        optInDialog.setOnShowListener(this);
        optInDialog.show();
    }
    return true;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:35,代码来源:AccountsSettingsFragment.java

示例9: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstance){
    AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());

    View view = View.inflate(getActivity(), R.layout.edit_task_layout, null);
    unbinder = ButterKnife.bind(this, view);
    if (savedInstance != null){
        String title = savedInstance.getString(TASK_TITLE);
        String desc = savedInstance.getString(TASK_DESC);
        Calendar newCal = Calendar.getInstance();
        long dateInMillSecs = savedInstance.getLong(TASK_DATE);
        newCal.setTimeInMillis(dateInMillSecs);

        taskTitle.setText(title);
        taskDesc.setText(desc);

        dateView.setText(dateString(newCal));
        timeView.setText(timeString(newCal));
    }else {
        taskTitle.setText(currentTask.getTaskTitle());
        taskDesc.setText(currentTask.getTaskDesc());

        dateView.setText(dateString(currentTask.getTaskDate()));
        timeView.setText(timeString(currentTask.getTaskDate()));
    }


    dateView.setOnClickListener(v -> openDateDialog());
    timeView.setOnClickListener(v -> openTimeDialog());

    setUpRepeatTaskSpinner();
    setUpAlarmTimeSpinner();

    AlertDialog alertDialog = dialog.setView(view)
            .setTitle("Edit Task")
            .setPositiveButton("Delete", (dialogInterface, i) -> {
                if (currentTask.getRepeatCategory() == 0){
                    presenter.deleteTask(currentTask, false);
                    callBack.updateAfterDelete(currentTask);
                }else {
                    showDeleteAllDialog();
                }
            })
            .setNegativeButton("Save", ((dialogInterface, i) -> {
                saveTask();
                callBack.updateView(currentTask);
            }))
            .create();

    alertDialog.setOnShowListener(dialogInterface -> {
        alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
                .setTextColor(getResources().getColor(R.color.colorAccent));
        alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
                .setTextColor(getResources().getColor(R.color.colorAccent));
    });

    return alertDialog;
}
 
开发者ID:aumarbello,项目名称:Tasks,代码行数:60,代码来源:EditTaskFragment.java

示例10: onCreateDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final View view = LayoutInflater.from(activity).inflate(R.layout.backup_wallet_dialog, null);

    passwordView = (EditText) view.findViewById(R.id.backup_wallet_dialog_password);
    passwordView.setText(null);

    passwordAgainView = (EditText) view.findViewById(R.id.backup_wallet_dialog_password_again);
    passwordAgainView.setText(null);

    passwordStrengthView = (TextView) view.findViewById(R.id.backup_wallet_dialog_password_strength);

    passwordMismatchView = view.findViewById(R.id.backup_wallet_dialog_password_mismatch);

    showView = (CheckBox) view.findViewById(R.id.backup_wallet_dialog_show);

    final TextView warningView = (TextView) view.findViewById(R.id.backup_wallet_dialog_warning_encrypted);
    warningView.setVisibility(wallet.isEncrypted() ? View.VISIBLE : View.GONE);

    final DialogBuilder builder = new DialogBuilder(activity);
    builder.setTitle(R.string.export_keys_dialog_title);
    builder.setView(view);
    builder.setPositiveButton(R.string.button_ok, null); // dummy, just to make it show
    builder.setNegativeButton(R.string.button_cancel, null);
    builder.setCancelable(false);

    final AlertDialog dialog = builder.create();

    dialog.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(final DialogInterface d) {
            positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
            positiveButton.setTypeface(Typeface.DEFAULT_BOLD);
            positiveButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {
                    handleGo();
                }
            });

            passwordView.addTextChangedListener(textWatcher);
            passwordAgainView.addTextChangedListener(textWatcher);

            showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView, passwordAgainView));

            BackupWalletDialogFragment.this.dialog = dialog;
            updateView();
        }
    });

    return dialog;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:53,代码来源:BackupWalletDialogFragment.java


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