Skip to content

Commit 56089ee

Browse files
author
杨宏伟
committed
增加时分秒范围控制
1 parent a61184a commit 56089ee

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/src/main/java/com/bigkoo/pickerviewdemo/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void onClick(View v) {
9898
/* pvTime.show(); //show timePicker*/
9999
initTimePicker();
100100
Calendar date = Calendar.getInstance();
101-
date.set(2020, 1, 23, 12, 10, 30);
101+
date.set(2021, 8, 15, 14, 10, 30);
102102
pvTime.setDate(date);
103103
pvTime.show(v);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view
104104
} else if (v.getId() == R.id.btn_Options && pvOptions != null) {

pickerview/src/main/java/com/bigkoo/pickerview/view/WheelTime.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private void setSolar(int year, final int month, int day, int h, int m, int s) {
379379
wv_day.setGravity(gravity);
380380
//时
381381
wv_hours = (WheelView) view.findViewById(R.id.hour);
382-
if (year < endYear || month + 1 < endMonth || day < endDay || h < endHour) {
382+
if (year < endYear || month + 1 < endMonth || day < endDay) {
383383
wv_hours.setAdapter(new NumericWheelAdapter(0, DEFAULT_END_HOUR));
384384
} else {
385385
wv_hours.setAdapter(new NumericWheelAdapter(0, endHour));
@@ -389,7 +389,7 @@ private void setSolar(int year, final int month, int day, int h, int m, int s) {
389389
wv_hours.setGravity(gravity);
390390
//分
391391
wv_minutes = (WheelView) view.findViewById(R.id.min);
392-
if (year < endYear || month + 1 < endMonth || day < endDay || h < endHour || m < endMinute) {
392+
if (year < endYear || month + 1 < endMonth || day < endDay || h < endHour) {
393393
wv_minutes.setAdapter(new NumericWheelAdapter(0, DEFAULT_END_SECOND));
394394
} else {
395395
wv_minutes.setAdapter(new NumericWheelAdapter(0, endMinute));
@@ -399,7 +399,7 @@ private void setSolar(int year, final int month, int day, int h, int m, int s) {
399399
wv_minutes.setGravity(gravity);
400400
//秒
401401
wv_seconds = (WheelView) view.findViewById(R.id.second);
402-
if (year < endYear || month + 1 < endMonth || day < endDay || h < endHour || m < endMinute || s < endSecond) {
402+
if (year < endYear || month + 1 < endMonth || day < endDay || h < endHour || m < endMinute) {
403403
wv_seconds.setAdapter(new NumericWheelAdapter(0, DEFAULT_END_SECOND));
404404
} else {
405405
wv_seconds.setAdapter(new NumericWheelAdapter(0, endSecond));

0 commit comments

Comments
 (0)