Skip to content

Commit

Permalink
Readme modification
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Oct 12, 2016
1 parent aa74a2d commit da4997f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@ SwitchDateTime use *AppTheme*, for use another theme add in *Android.manifest*:
`tools:replace="android:theme"`

## Use
You can see
https://github.com/J-Jamet/Android-SwitchDateTimePicker/blob/master/sample/src/main/java/com/kunzisoft/switchdatetimesample/Sample.java
for complete sample.


```
// Initialize
SwitchDateTimeDialogFragment dateTimeDialogFragment = SwitchDateTimeDialogFragment.newInstance(
getString(R.string.label_datetime_dialog),
getString(R.string.positive_button_datetime_picker),
getString(R.string.negative_button_datetime_picker)
);
// Assign values
dateTimeDialogFragment.setYear(2016);
dateTimeDialogFragment.setMonth(12);
dateTimeDialogFragment.setMonth(10);
dateTimeDialogFragment.setHour(1);
dateTimeDialogFragment.setMinute(20);
// Set listener
dateTimeDialogFragment.setOnButtonClickListener(new SwitchDateTimeDialogFragment.OnButtonClickListener() {
@Override
public void onPositiveButtonClick(Date date) {
Expand All @@ -27,6 +39,7 @@ dateTimeDialogFragment.setOnButtonClickListener(new SwitchDateTimeDialogFragment
// Date is get on negative button click
}
});
// Show
dateTimeDialogFragment.show(getSupportFragmentManager(), "dialog_time");
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public void onClick(DialogInterface dialog, int which) {
});

// Show datetime from locale format
//TODO DateFormat
dateText.setText(DateFormat.getDateTimeInstance().format(dateTime.getTime()));
AlertDialog dialog = db.show();

Expand Down

0 comments on commit da4997f

Please sign in to comment.