Ejemplo n.º 1
0
 @Override
 public void onPrepareDialogBuilder(final AlertDialog.Builder builder) {
   super.onPrepareDialogBuilder(builder);
   prefs = getSharedPreferences();
   if (prefs == null) return;
   final int length = mKeys.length;
   for (int i = 0; i < length; i++) {
     mValues[i] = prefs.getBoolean(mKeys[i], mDefaultValues[i]);
   }
   builder.setPositiveButton(android.R.string.ok, this);
   builder.setNegativeButton(android.R.string.cancel, null);
   builder.setMultiChoiceItems(mNames, mValues, this);
   if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
     new Thread() {
       @Override
       public void run() {
         Dialog dialog = null;
         while (dialog == null) {
           dialog = getDialog();
           if (dialog != null) {
             final Message msg = new Message();
             msg.obj = dialog;
             mDialogWorkaroundHandler.sendMessage(msg);
           }
           try {
             sleep(50L);
           } catch (final InterruptedException e) {
           }
         }
       }
     }.start();
   }
 }
  /** {@inheritDoc} */
  @Override
  protected void onPrepareDialogBuilder(Builder builder) {
    super.onPrepareDialogBuilder(builder);

    // Configure the dialog
    this.mColorDlg = new ColorDialogView(getContext());
    this.mColorDlg.setColor(this.mColor);
    this.mColorDlg.showAlphaSlider(true);
    this.mColorDlg.setAlphaSliderText(
        getContext().getString(R.string.color_picker_alpha_slider_text));
    this.mColorDlg.setCurrentColorText(getContext().getString(R.string.color_picker_current_text));
    this.mColorDlg.setNewColorText(getContext().getString(R.string.color_picker_new_text));
    this.mColorDlg.setColorLabelText(getContext().getString(R.string.color_picker_color));
    builder.setView(this.mColorDlg);

    // The color is selected by the user and confirmed by clicking ok
    builder.setPositiveButton(
        android.R.string.ok,
        new OnClickListener() {
          @Override
          @SuppressWarnings("synthetic-access")
          public void onClick(DialogInterface dialog, int which) {
            int color = ColorPickerPreference.this.mColorDlg.getColor();
            if (callChangeListener(Integer.valueOf(color))) {
              setColor(color);
            }
            dialog.dismiss();
          }
        });
  }
Ejemplo n.º 3
0
 @Override
 protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   super.onPrepareDialogBuilder(builder);
   builder.setNegativeButton(null, null);
   builder.setPositiveButton(null, null);
   builder.setTitle(null);
 }
Ejemplo n.º 4
0
 @Override
 protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   // we get rid of the default buttons (that close the dialog every time)
   builder.setPositiveButton(null, null);
   builder.setNegativeButton(null, null);
   super.onPrepareDialogBuilder(builder);
 }
  @Override
  protected void onPrepareDialogBuilder(Builder builder) {
    super.onPrepareDialogBuilder(builder);
    OnColorChangedListener l =
        new OnColorChangedListener() {
          public void colorChanged(int color) {
            mCurrentColor = color;
            onDialogClosed(true);
            getDialog().dismiss();
          }
        };

    LinearLayout layout = new LinearLayout(getContext());
    layout.setPadding(20, 20, 20, 20);
    layout.setOrientation(LinearLayout.VERTICAL);
    mCPView = new ColorPickerView(getContext(), l, mCurrentColor);

    LinearLayout.LayoutParams params1 =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    params1.gravity = Gravity.CENTER;
    mCPView.setLayoutParams(params1);
    layout.addView(this.mCPView);
    layout.setId(android.R.id.widget_frame);
    builder.setView(layout);
  }
 @Override
 protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   super.onPrepareDialogBuilder(builder);
   builder.setAdapter(new AppListAdapter(getContext()), null);
   mNewValues.clear();
   mNewValues.addAll(mValues);
 }
  @Override
  protected void onPrepareDialogBuilder(Builder builder) {
    super.onPrepareDialogBuilder(builder);

    mAdapter = new SelectionListAdapter(mSimItemList);
    mListView = new ListView(mContext);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);
    mListView.setItemsCanFocus(false);
    builder.setView(mListView, 0, 0, 0, 0);
    builder.setNegativeButton(android.R.string.cancel, null);
  }
Ejemplo n.º 8
0
  @Override
  protected void onPrepareDialogBuilder(Builder builder) {
    super.onPrepareDialogBuilder(builder);

    if (mAdapter != null) {
      mListView = new ListView(mContext);
      mListView.setAdapter(mAdapter);
      mListView.setOnItemClickListener(this);
      builder.setView(mListView);
    } else {
      Log.d(TAG, "Error with null adapter");
    }
    builder.setPositiveButton(null, null);
  }
Ejemplo n.º 9
0
 @Override
 protected void onPrepareDialogBuilder(Builder builder) {
   LinearLayout layout = new LinearLayout(context);
   layout.setLayoutParams(
       new LinearLayout.LayoutParams(
           LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
   layout.setMinimumWidth(200);
   TextView tv = new TextView(context);
   tv.setText("Press a key!");
   layout.addView(tv);
   builder.setView(layout);
   builder.setOnKeyListener(this);
   super.onPrepareDialogBuilder(builder);
 }
  @Override
  protected void onPrepareDialogBuilder(final Builder builder) {
    super.onPrepareDialogBuilder(builder);

    mNumberPicker = new NumberPicker(this.getContext());
    mNumberPicker.setMinValue(mMinValue);
    mNumberPicker.setMaxValue(mMaxValue);
    mNumberPicker.setValue(mSelectedValue);
    mNumberPicker.setWrapSelectorWheel(mWrapSelectorWheel);
    mNumberPicker.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    final LinearLayout linearLayout = new LinearLayout(this.getContext());
    linearLayout.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.addView(mNumberPicker);

    builder.setView(linearLayout);
  }
Ejemplo n.º 11
0
 @Override
 protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
   super.onPrepareDialogBuilder(builder);
   /* Take the title from the preference, not the xml file */
   builder.setTitle(getTitle());
 }
 protected void onPrepareDialogBuilder(AlertDialog.Builder paramBuilder) {
   super.onPrepareDialogBuilder(paramBuilder);
   paramBuilder.setTitle(getContext().getString(2131296481)).setCancelable(true);
 }