2323
2424import android .app .ActionBar .LayoutParams ;
2525import android .content .Context ;
26+ import android .content .DialogInterface ;
2627import android .content .res .Resources ;
2728import android .os .Bundle ;
2829import android .support .v4 .app .DialogFragment ;
@@ -68,6 +69,7 @@ public class RadialTimePickerDialog extends DialogFragment implements OnValueSel
6869 // Delay before starting the pulse animation, in ms.
6970 private static final int PULSE_ANIMATOR_DELAY = 300 ;
7071
72+ private OnDialogDismissListener mDimissCallback ;
7173 private OnTimeSetListener mCallback ;
7274
7375 private TextView mDoneButton ;
@@ -118,6 +120,11 @@ public interface OnTimeSetListener {
118120 void onTimeSet (RadialPickerLayout view , int hourOfDay , int minute );
119121 }
120122
123+ public static interface OnDialogDismissListener {
124+
125+ public abstract void onDialogDismiss (DialogInterface dialoginterface );
126+ }
127+
121128 public RadialTimePickerDialog () {
122129 // Empty constructor required for dialog fragment.
123130 }
@@ -144,6 +151,10 @@ public void initialize(OnTimeSetListener callback,
144151 mInKbMode = false ;
145152 }
146153
154+ public void setOnDismissListener (OnDialogDismissListener ondialogdismisslistener ) {
155+ mDimissCallback = ondialogdismisslistener ;
156+ }
157+
147158 public void setOnTimeSetListener (OnTimeSetListener callback ) {
148159 mCallback = callback ;
149160 }
@@ -154,6 +165,14 @@ public void setStartTime(int hourOfDay, int minute) {
154165 mInKbMode = false ;
155166 }
156167
168+ @ Override
169+ public void onDismiss (DialogInterface dialoginterface ) {
170+ super .onDismiss (dialoginterface );
171+ if (mDimissCallback != null ) {
172+ mDimissCallback .onDialogDismiss (dialoginterface );
173+ }
174+ }
175+
157176 @ Override
158177 public void onCreate (Bundle savedInstanceState ) {
159178 super .onCreate (savedInstanceState );
@@ -662,7 +681,7 @@ private int getValFromKeyCode(int keyCode) {
662681 * the caller to know whether zeros had been explicitly entered as either hours of minutes. This is helpful for
663682 * deciding whether to show the dashes, or actual 0's.
664683 * @return A size-3 int array. The first value will be the hours, the second value will be the minutes, and the
665- * third will be either TimePickerDialog.AM or TimePickerDialog.PM.
684+ * third will be either TimePickerDialog.AM or TimePickerDialog.PM.
666685 */
667686 private int [] getEnteredTime (Boolean [] enteredZeros ) {
668687 int amOrPm = -1 ;
0 commit comments