The Time-Selector
control is used based on jingchenUSTC/TimePicker
:
Add it directly to gradle in Android Studio:
compile 'com.feezu.liuli: timeselector: 1.0.8+'
Please download the source code under Eclipse (it is recommended to migrate to Studio as soon as possible)
Construct 1:
TimeSelector(Context context, ResultHandler resultHandler, String startDate, String endDate)
Parameter description: ResultHandler is the callback startDate after the selected time, and endDate is the optional start time and end time of the time control.
TimeSelector timeSelector = new TimeSelector(this, new TimeSelector.ResultHandler() { @Override public void handle(String time) { } }, "2015-11-22 17:34", "2015-12-1 15:20");
Construct 2:
TimeSelector(Context context, ResultHandler resultHandler, String startDate, String endDate, String workStartTime, String workEndTime)
Parameter description: pass in workStartTime. The optional time of workEndTime is the start and end time of the daily "hour:minute" within the range of start time and end time. For example, the optional time limit is: 9 to 5.
TimeSelector timeSelector = new TimeSelector(this, new TimeSelector.ResultHandler() { @Override public void handle(String time) { Toast.makeText(getApplicationContext(), time, Toast.LENGTH_LONG).show(); } }, "2015-10-30 10:34", "2015-12-1 17:34","9:00","17:00");
use:
timeSelector.show();