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

Commit

Permalink
Merge pull request #305 from activesince93/master
Browse files Browse the repository at this point in the history
Feature #302 added
  • Loading branch information
florent37 authored Oct 6, 2020
2 parents e6656f7 + 336865f commit 54f115b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
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

0 comments on commit 54f115b

Please sign in to comment.