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


Java Builder.create方法代码示例

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


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

示例1: show

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
public void show(IBinder windowToken) {
    MenuBuilder menu = this.mMenu;
    Builder builder = new Builder(menu.getContext());
    this.mPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
    this.mPresenter.setCallback(this);
    this.mMenu.addMenuPresenter(this.mPresenter);
    builder.setAdapter(this.mPresenter.getAdapter(), this);
    View headerView = menu.getHeaderView();
    if (headerView != null) {
        builder.setCustomTitle(headerView);
    } else {
        builder.setIcon(menu.getHeaderIcon()).setTitle(menu.getHeaderTitle());
    }
    builder.setOnKeyListener(this);
    this.mDialog = builder.create();
    this.mDialog.setOnDismissListener(this);
    LayoutParams lp = this.mDialog.getWindow().getAttributes();
    lp.type = CloseFrame.REFUSE;
    if (windowToken != null) {
        lp.token = windowToken;
    }
    lp.flags |= 131072;
    this.mDialog.show();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:MenuDialogHelper.java

示例2: computeDialogDisplay

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
/**
 * Methods that computes and displays the dialog content.
 *
 * @param isForAnnouncement boolean
 */
private final void computeDialogDisplay(boolean isForAnnouncement)
{
  final Builder builder = new Builder(getContext());
  builder.setTitle(R.string.out_of_app_push_notifications_dialog_title);
  final View dialogContainerView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_out_of_app_push_notifications, (ViewGroup) getView().getParent(), false);
  iconTitleMessageButton = dialogContainerView.findViewById(R.id.iconTitleMessageButton);
  iconTitleMessageBigTextButton = dialogContainerView.findViewById(R.id.iconTitleMessageBigTextButton);
  iconTitleMessageBigImageButton = dialogContainerView.findViewById(R.id.iconTitleMessageBigImageButton);

  this.isForAnnouncement = isForAnnouncement;
  iconTitleMessageButton.setOnClickListener(this);
  iconTitleMessageBigTextButton.setOnClickListener(this);
  iconTitleMessageBigImageButton.setOnClickListener(this);

  builder.setView(dialogContainerView);
  this.alertDialog = builder.create();
  this.alertDialog.show();

  AzmeTracker.sendEvent(getActivity(), isForAnnouncement ? "display_out_of_app_announcement" : "display_out_of_app_notification_only");
}
 
开发者ID:Azure,项目名称:azure-mobile-engagement-app-android,代码行数:26,代码来源:OutOfAppPushNotificationsFragment.java

示例3: showAlertDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
/**
 * Shows message in an AlertDialog.
 *
 * @param message contains identify results processed into a string.
 */
private void showAlertDialog(StringBuilder message) {
  Builder alertDialogBuilder = new Builder(this);

  // set title
  alertDialogBuilder.setTitle("Number of elements found");

  // set dialog message
  alertDialogBuilder
      .setMessage(message)
      .setCancelable(false)
      .setPositiveButton("Ok", new OnClickListener() {
        @Override public void onClick(DialogInterface dialog, int id) {
        }
      });

  // create alert dialog
  AlertDialog alertDialog = alertDialogBuilder.create();

  // show the alert dialog
  alertDialog.show();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:27,代码来源:MainActivity.java

示例4: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
      @NonNull
      @SuppressLint("InflateParams")
public Dialog onCreateDialog(Bundle savedInstanceState) {
	Context context = getActivity();
	LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
	View view = layoutInflater.inflate(R.layout.entity_field_editor_enum_dialog, null);
	listView = (ListView) view.findViewById(R.id.entity_field_editor_enum_dialog_list);
	emptyView = (TextView) view.findViewById(R.id.entity_field_editor_enum_dialog_empty_view);
	progressBar = (ProgressBar) view.findViewById(R.id.entity_field_editor_enum_dialog_progress_bar);
	listView.setOnItemClickListener(this);

          tryLoadValues();
	
	Builder builder = new Builder(context);
	builder.setNegativeButton(android.R.string.cancel, null);
	builder.setView(view);

          //Se o fragmento foi restaurado, o editor pode n ter sido setado ainda.
          if (editor != null) {
	    builder.setTitle(editor.getLabel());
          } else {
              AndroidBugsUtils.applyWorkaroundForAlertDialogWithInvisibleTitleBug(builder);
          }

	return builder.create();
}
 
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:28,代码来源:AbstractEnumFieldEditor.java

示例5: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Create field for username
    mUsernameET = new EditText(getActivity());
    mUsernameET.setHint(getActivity().getText(R.string.auth_username));

    // Create field for password
    mPasswordET = new EditText(getActivity());
    mPasswordET.setHint(getActivity().getText(R.string.auth_password));
    mPasswordET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    // Prepare LinearLayout for dialog
    LinearLayout ll = new LinearLayout(getActivity());
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(mUsernameET);
    ll.addView(mPasswordET);
    
    ll.requestFocus();
    
    setRetainInstance(true);

    Builder authDialog = new AlertDialog
            .Builder(getActivity())
            .setTitle(getActivity().getText(R.string.saml_authentication_required_text))
            .setView(ll)
            .setCancelable(false)
            .setPositiveButton(R.string.common_ok, this)
            .setNegativeButton(R.string.common_cancel, this);

    Dialog d = authDialog.create();
    d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    return d;
}
 
开发者ID:skymania,项目名称:Cirrus,代码行数:35,代码来源:CredentialsDialogFragment.java

示例6: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@NonNull
@SuppressLint("InflateParams")
@Override
   public AppCompatDialog onCreateDialog(Bundle savedInstanceState)
   {
	
   	Builder builder = new AlertDialog.Builder(getActivity());
   	builder.setTitle("test fragment mode");
   	oh = getArguments().getString(KEY_OH);
   	
	builder.setPositiveButton(android.R.string.ok, null);

   	return builder.create();
   }
 
开发者ID:simonpoole,项目名称:OpeningHoursFragment,代码行数:15,代码来源:TestFragment.java

示例7: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
   @NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
	Bundle arguments = getArguments();
       if (arguments == null) {
           throw new IllegalStateException("Arguments are missing");
       }
       Context context = getActivity();
       Builder builder = new Builder(context);

       int titleResId = arguments.getInt(TITLE_ARGUMENT);
       if (titleResId > 0) {
           builder.setTitle(titleResId);
       } else {
           String title = arguments.getString(TITLE_STRING_ARGUMENT);
           if (title != null) {
               builder.setTitle(title);
           }
       }

       int viewLayoutId = arguments.getInt(VIEW_LAYOUT_ARGUMENT);
       if (viewLayoutId > 0) {
           dialogView = LayoutInflater.from(context).inflate(viewLayoutId, null);
           if (savedInstanceState != null) {
               SparseArray<Parcelable> states = savedInstanceState.getSparseParcelableArray(SAVED_DIALOG_VIEW_STATE);
               dialogView.restoreHierarchyState(states);
           }
           builder.setView(dialogView);
       } else {
           int msgResId = arguments.getInt(MESSAGE_ARGUMENT);
           if (msgResId > 0) {
               builder.setMessage(msgResId);
           } else {
               String message = arguments.getString(MESSAGE_STRING_ARGUMENT);
               if (message != null) {
                   builder.setMessage(message);
               }
           }
       }

	builder.setPositiveButton(arguments.getInt(POSITIVE_BUTTON_ARGUMENT, android.R.string.ok), this);
       if (arguments.getBoolean(NEGATIVE_BUTTON_VISIBLE_ARGUMENT, true)) {
	    builder.setNegativeButton(arguments.getInt(NEGATIVE_BUTTON_ARGUMENT, android.R.string.cancel), this);
       }

       AlertDialog alertDialog = builder.create();
       alertDialog.setCanceledOnTouchOutside(arguments.getBoolean(CANCELED_ON_TOUCH_OUTSIDE_ARGUMENT, true));

       if (dialogView != null) {
           //Tem que definir isto para que o teclado abra na View focada.
           alertDialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
       }

       return alertDialog;
}
 
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:56,代码来源:ConfirmationDialogFragment.java

示例8: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
   @NonNull
   @SuppressLint("InflateParams")
public Dialog onCreateDialog(Bundle savedInstanceState) {
	//Obtém os argumentos (opcionais)
	int titleId = 0;
	ArrayList<MessageGroup> messageGroups = null;

	Bundle arguments = getArguments();
	if (arguments != null) {
		titleId = arguments.getInt(DIALOG_TITLE_ARGUMENT);
		messageGroups = arguments.getParcelableArrayList(MESSAGE_GROUPS_ARGUMENT);
	}

	//Cria a View customizada do dialog.
	Context context = getActivity();
	LayoutInflater layoutInflater = LayoutInflater.from(context);
	View view = layoutInflater.inflate(R.layout.entity_editing_message_list_dialog, null);
	TextView messageView = (TextView) view.findViewById(R.id.entity_editing_message_list_dialog_text);

	if (messageGroups == null || messageGroups.isEmpty()) {
		messageView.setText(R.string.entity_editing_message_list_dialog_message_empty);
	} else {
		messageView.setText(R.string.entity_editing_message_list_dialog_message);

		//Só define o adapter se houver mensagens.
		ListView listView = (ListView) view.findViewById(R.id.entity_editing_message_list_dialog_list);
		listView.setAdapter(new MessageAdapter(context, messageGroups));
	}

	Builder builder = new Builder(context);
	builder.setPositiveButton(android.R.string.ok, null);
	builder.setView(view);

	//Define o título do dialog, se houver.
	if (titleId != 0) {
		builder.setTitle(titleId);
	}

       AlertDialog dialog = builder.create();
       AndroidBugsUtils.applyWorkaroundForAlertDialogWithFlexibleListViewBug(dialog, view);
       return dialog;
}
 
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:44,代码来源:EntityEditingMessageListDialogFragment.java

示例9: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@NonNull
@SuppressLint("InflateParams")
@Override
public AppCompatDialog onCreateDialog(Bundle savedInstanceState) {
    int title = getArguments().getInt(TITLE);
    final int min = getArguments().getInt(MIN);
    final int max = getArguments().getInt(MAX);
    int startCurrent = getArguments().getInt(START_CURRENT);
    int endCurrent = getArguments().getInt(END_CURRENT);
    final SetRangeListener listener = (SetRangeListener) getParentFragment();

    // Preferences prefs= new Preferences(getActivity());
    Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(title);

    final LayoutInflater inflater = getActivity().getLayoutInflater(); // ThemeUtils.getLayoutInflater(getActivity());

    // DoNothingListener doNothingListener = new DoNothingListener();
    View layout = inflater.inflate(R.layout.rangepicker, null);
    builder.setView(layout);

    String[] startValues = new String[max - min + 1];
    for (int i = min; i <= max; i++) {
        startValues[i - min] = Integer.toString(i);
    }
    final NumberPickerView npvStart = (NumberPickerView) layout.findViewById(R.id.start);
    npvStart.setDisplayedValues(startValues);
    npvStart.setMinValue(min);
    npvStart.setMaxValue(max);
    npvStart.setValue(startCurrent);

    String[] endValues = new String[max - min + 2];
    endValues[0] = "-";
    for (int i = min; i <= max; i++) {
        endValues[i - min + 1] = Integer.toString(i);
    }
    final NumberPickerView npvEnd = (NumberPickerView) layout.findViewById(R.id.end);
    npvEnd.setDisplayedValues(endValues);
    npvEnd.setMinValue(min - 1);
    npvEnd.setMaxValue(max);
    if (endCurrent == NOTHING_SELECTED) {
        endCurrent = min - 1;
    }
    npvEnd.setValue(endCurrent);

    builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            int endValue = npvEnd.getValue();
            if (endValue == min - 1) {
                endValue = NOTHING_SELECTED;
            }
            listener.setRange(npvStart.getValue(), endValue);
        }
    });
    builder.setNeutralButton(android.R.string.cancel, null);

    return builder.create();
}
 
开发者ID:simonpoole,项目名称:OpeningHoursFragment,代码行数:60,代码来源:RangePicker.java

示例10: onCreateDialog

import android.support.v7.app.AlertDialog.Builder; //导入方法依赖的package包/类
@NonNull
@SuppressLint("InflateParams")
@Override
public AppCompatDialog onCreateDialog(Bundle savedInstanceState) {
    int title = getArguments().getInt(TITLE);

    int startHour = getArguments().getInt(START_HOUR);
    int startMinute = getArguments().getInt(START_MINUTE);
    int endHour = getArguments().getInt(END_HOUR);
    int endMinute = getArguments().getInt(END_MINUTE);

    boolean startOnly = getArguments().getBoolean(START_ONLY);

    final SetTimeRangeListener listener = (SetTimeRangeListener) getParentFragment();

    // Preferences prefs= new Preferences(getActivity());
    Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(title);

    final LayoutInflater inflater = getActivity().getLayoutInflater(); // ThemeUtils.getLayoutInflater(getActivity());

    // DoNothingListener doNothingListener = new DoNothingListener();
    View layout = inflater.inflate(R.layout.timerangepicker, null);
    builder.setView(layout);

    String[] hourValues = new String[48];
    for (int i = 0; i < 48; i++) {
        hourValues[i] = String.format("%02d", i);
    }
    final NumberPickerView npvStartHour = (NumberPickerView) layout.findViewById(R.id.startHour);
    npvStartHour.setDisplayedValues(hourValues);
    npvStartHour.setMinValue(0);
    npvStartHour.setMaxValue(23);
    npvStartHour.setValue(startHour);

    String[] minValues = new String[60];
    for (int i = 0; i < 60; i++) {
        minValues[i] = String.format("%02d", i);
    }

    final NumberPickerView npvStartMinute = (NumberPickerView) layout.findViewById(R.id.startMinute);

    npvStartMinute.setDisplayedValues(minValues);
    npvStartMinute.setMinValue(0);
    npvStartMinute.setMaxValue(59);
    npvStartMinute.setValue(startMinute);

    final NumberPickerView npvEndHour = (NumberPickerView) layout.findViewById(R.id.endHour);
    final NumberPickerView npvEndMinute = (NumberPickerView) layout.findViewById(R.id.endMinute);
    if (startOnly) {
        npvEndHour.setVisibility(View.GONE);
        npvEndMinute.setVisibility(View.GONE);
    } else {
        npvEndHour.setVisibility(View.VISIBLE);
        npvEndMinute.setVisibility(View.VISIBLE);
        npvEndHour.setDisplayedValues(hourValues);
        npvEndHour.setMinValue(0);
        npvEndHour.setMaxValue(47);
        npvEndHour.setValue(endHour);

        npvEndMinute.setDisplayedValues(minValues);
        npvEndMinute.setMinValue(0);
        npvEndMinute.setMaxValue(59);
        npvEndMinute.setValue(endMinute);
    }

    builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            int startHourValue = npvStartHour.getValue();
            int startMinuteValue = npvStartMinute.getValue();
            int endHourValue = npvEndHour.getValue();
            int endMinuteValue = npvEndMinute.getValue();

            listener.setTimeRange(startHourValue, startMinuteValue, endHourValue, endMinuteValue);
        }
    });
    builder.setNeutralButton(android.R.string.cancel, null);

    return builder.create();
}
 
开发者ID:simonpoole,项目名称:OpeningHoursFragment,代码行数:82,代码来源:TimeRangePicker.java


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