diff --git a/README.md b/README.md index f256c74e..5520c1bb 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,16 @@ new SingleDateAndTimePickerDialog.Builder(context) //.displayMinutes(false) //.todayText("aujourd'hui") .displayListener(new SingleDateAndTimePickerDialog.DisplayListener() { - @Override - public void onDisplayed(SingleDateAndTimePicker picker) { - //retrieve the SingleDateAndTimePicker - } - }) - + @Override + public void onDisplayed(SingleDateAndTimePicker picker) { + // Retrieve the SingleDateAndTimePicker + } + + @Override + public void onClosed(SingleDateAndTimePicker picker) { + // On dialog closed + } + }) .title("Simple") .listener(new SingleDateAndTimePickerDialog.Listener() { @Override diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f0377e3f..4b6b4a8e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/com/github/florent37/sample/singledateandtimepicker/SingleDatePickerMainActivityWithDoublePicker.java b/app/src/main/java/com/github/florent37/sample/singledateandtimepicker/SingleDatePickerMainActivityWithDoublePicker.java index d543e691..c6846449 100644 --- a/app/src/main/java/com/github/florent37/sample/singledateandtimepicker/SingleDatePickerMainActivityWithDoublePicker.java +++ b/app/src/main/java/com/github/florent37/sample/singledateandtimepicker/SingleDatePickerMainActivityWithDoublePicker.java @@ -1,7 +1,9 @@ package com.github.florent37.sample.singledateandtimepicker; import android.os.Bundle; +import android.util.Log; import android.widget.TextView; +import android.widget.Toast; import com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker; import com.github.florent37.singledateandtimepicker.dialog.DoubleDateAndTimePickerDialog; @@ -45,6 +47,8 @@ public class SingleDatePickerMainActivityWithDoublePicker extends AppCompatActiv SingleDateAndTimePickerDialog.Builder singleBuilder; DoubleDateAndTimePickerDialog.Builder doubleBuilder; + private static String TAG = "SingleDatePickerMainActivityWithDoublePicker"; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -94,14 +98,19 @@ public void simpleTimeClicked() { .displayMinutes(true) .displayHours(true) - .displayDays(true) + .displayDays(false) //.displayMonth(true) //.displayYears(true) .displayListener(new SingleDateAndTimePickerDialog.DisplayListener() { @Override public void onDisplayed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog displayed"); + } + @Override + public void onClosed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog closed"); } }) @@ -138,7 +147,12 @@ public void simpleDateClicked() { .displayListener(new SingleDateAndTimePickerDialog.DisplayListener() { @Override public void onDisplayed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog displayed"); + } + @Override + public void onClosed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog closed"); } }) @@ -192,7 +206,12 @@ public void simpleClicked() { .displayListener(new SingleDateAndTimePickerDialog.DisplayListener() { @Override public void onDisplayed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog displayed"); + } + @Override + public void onClosed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog closed"); } }) @@ -268,7 +287,12 @@ public void singleDateLocaleClicked() { .displayListener(new SingleDateAndTimePickerDialog.DisplayListener() { @Override public void onDisplayed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog displayed"); + } + @Override + public void onClosed(SingleDateAndTimePicker picker) { + Log.d(TAG, "Dialog closed"); } }) diff --git a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/DoubleDateAndTimePickerDialog.java b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/DoubleDateAndTimePickerDialog.java index 4bd6cfcf..54d3c8c3 100644 --- a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/DoubleDateAndTimePickerDialog.java +++ b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/DoubleDateAndTimePickerDialog.java @@ -424,8 +424,8 @@ public DoubleDateAndTimePickerDialog setFocusable(boolean focusable) { private DoubleDateAndTimePickerDialog setTimeZone(TimeZone timeZone) { dateHelper.setTimeZone(timeZone); - pickerTab0.setTimeZone(timeZone); - pickerTab1.setTimeZone(timeZone); +// pickerTab0.setTimeZone(timeZone); +// pickerTab1.setTimeZone(timeZone); return this; } diff --git a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/SingleDateAndTimePickerDialog.java b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/SingleDateAndTimePickerDialog.java index 49263935..7307e624 100644 --- a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/SingleDateAndTimePickerDialog.java +++ b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/dialog/SingleDateAndTimePickerDialog.java @@ -64,6 +64,10 @@ public void onLoaded(View view) { @Override public void onClose() { SingleDateAndTimePickerDialog.this.onClose(); + + if (displayListener != null) { + displayListener.onClosed(picker); + } } }); } @@ -330,6 +334,7 @@ public interface Listener { public interface DisplayListener { void onDisplayed(SingleDateAndTimePicker picker); + void onClosed(SingleDateAndTimePicker picker); } public static class Builder {