コード例 #1
0
 @Override
 protected void onClick() {
   super.onClick();
   ColorDialogFragment fragment = ColorDialogFragment.newInstance();
   fragment.setSelector(colorSelector);
   fragment.setPreference(this);
   AppCompatActivity activity = (AppCompatActivity) getContext();
   activity
       .getSupportFragmentManager()
       .beginTransaction()
       .add(fragment, getFragmentTag())
       .commit();
 }
コード例 #2
0
  @Override
  protected void onClick() {
    super.onClick();

    boolean newValue = !isChecked();

    //        mSendClickAccessibilityEvent = true;

    if (!callChangeListener(newValue)) {
      return;
    }

    setChecked(newValue);
  }
コード例 #3
0
  @Override
  protected void onClick() {
    super.onClick();

    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    builder.setTitle("Select weekdays");

    final boolean[] selection = stringToArray(selectedValuesString);
    builder.setMultiChoiceItems(
        weekdayNames,
        selection,
        new OnMultiChoiceClickListener() {
          public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            selection[which] = isChecked;
          }
        });

    builder.setPositiveButton(
        "Ok",
        new OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {

            selectedValuesString = arrayToString(selection);

            if (!callChangeListener(selectedValuesString)) {
              return;
            }

            persistString(selectedValuesString);
            notifyChanged();
          }
        });

    builder.setNegativeButton(
        "Cancel",
        new OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        });

    AlertDialog dialog = builder.create();
    dialog.show();
  }
コード例 #4
0
  @Override
  protected void onClick() {
    super.onClick();

    ColorPickerDialog colorPickerDialog =
        ColorPickerDialog.newInstance(
            R.string.color_picker_default_title,
            mColorChoices,
            getValue(),
            mNumColumns,
            isTablet(getContext()) ? ColorPickerDialog.SIZE_LARGE : ColorPickerDialog.SIZE_SMALL);

    // colorcalendar.setPreference(this);

    Activity activity = (Activity) getContext();
    activity
        .getFragmentManager()
        .beginTransaction()
        .add(colorPickerDialog, getFragmentTag())
        .commit();

    colorPickerDialog.setOnColorSelectedListener(listener);
  }