Example usage for android.app TimePickerDialog setButton

List of usage examples for android.app TimePickerDialog setButton

Introduction

In this page you can find the example usage for android.app TimePickerDialog setButton.

Prototype

public void setButton(int whichButton, CharSequence text, Message msg) 

Source Link

Document

Set a message to be sent when a button is pressed.

Usage

From source file:org.libreoffice.impressremote.fragment.TimerSettingDialog.java

@Override
public Dialog onCreateDialog(Bundle aSavedInstanceState) {
    TimePickerDialog aDialog = new TimePickerDialog(getActivity(), this, INITIAL_HOUR, INITIAL_MINUTE,
            IS_24_HOUR_VIEW);//  w w  w .  ja v  a2s  .  c  o m

    aDialog.setTitle(R.string.title_timer);

    aDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.button_start), this);

    return aDialog;
}

From source file:org.alfresco.mobile.android.application.ui.form.picker.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);
    if (getArguments() != null && getArguments().containsKey(ARGUMENT_DATE)) {
        calendar = (GregorianCalendar) getArguments().get(ARGUMENT_DATE);
    }/*from  w  w  w  .  java2  s. c o  m*/

    final TimePickerDialog picker = new TimePickerDialog(getActivity(), mListener, hourOfDay, minute, true);

    picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEUTRAL, getActivity().getString(R.string.clear),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    clearValue = true;
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    isCancelled = true;
                    dismiss();
                }
            });
    return picker;

}

From source file:com.activiti.android.ui.fragments.form.picker.TimePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
    int minute = c.get(Calendar.MINUTE);
    if (getArguments() != null && getArguments().containsKey(ARGUMENT_DATE)) {
        calendar = (GregorianCalendar) getArguments().get(ARGUMENT_DATE);
    }//w w w  .j a  va2  s .c  om

    final TimePickerDialog picker = new TimePickerDialog(getActivity(), mListener, hourOfDay, minute, true);

    picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEUTRAL, getActivity().getString(R.string.clear),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    clearValue = true;
                    dismiss();
                }
            });
    picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(R.string.general_action_cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    isCancelled = true;
                    dismiss();
                }
            });
    return picker;

}

From source file:org.libreoffice.impressremote.fragment.TimerEditingDialog.java

@Override
public Dialog onCreateDialog(Bundle aSavedInstanceState) {
    TimePickerDialog aDialog = new TimePickerDialog(getActivity(), this, getHours(mMinutes),
            getMinutes(mMinutes), IS_24_HOUR_VIEW);

    aDialog.setTitle(R.string.title_timer);

    aDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.button_save), this);
    aDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getString(R.string.button_remove), this);

    return aDialog;
}