Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Feature #302 added #305

Merged
merged 5 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SingleDatePickerMainActivity">
<activity android:name=".SingleDatePickerMainActivityWithDoublePicker">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}
})

Expand Down Expand Up @@ -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");
}
})

Expand Down Expand Up @@ -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");
}
})

Expand Down Expand Up @@ -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");
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public void onLoaded(View view) {
@Override
public void onClose() {
SingleDateAndTimePickerDialog.this.onClose();

if (displayListener != null) {
displayListener.onClosed(picker);
}
}
});
}
Expand Down Expand Up @@ -330,6 +334,7 @@ public interface Listener {

public interface DisplayListener {
void onDisplayed(SingleDateAndTimePicker picker);
void onClosed(SingleDateAndTimePicker picker);
}

public static class Builder {
Expand Down