diff --git a/common/src/main/res/values-en-rUS/strings.xml b/common/src/main/res/values-en-rUS/strings.xml
index 31c5c0d..a16b1aa 100644
--- a/common/src/main/res/values-en-rUS/strings.xml
+++ b/common/src/main/res/values-en-rUS/strings.xml
@@ -27,4 +27,5 @@
Focus on
See more
close
+ Time cannot be greater than the current time
\ No newline at end of file
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index f75e705..f9997b3 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1492,4 +1492,5 @@
關注
查看更多
收起
+ 时间不能大于当前时间
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index aaf1ba5..200bff4 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1492,4 +1492,5 @@
關注
查看更多
收起
+ 时间不能大于当前时间
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index 99f4032..2d15a99 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -1490,4 +1490,5 @@
關注
查看更多
收起
+ 时间不能大于当前时间
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 1c7f32e..94d835b 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1512,6 +1512,7 @@ Limited ride And limited avatar frame
關注
查看更多
收起
+ 时间不能大于当前时间
diff --git a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java
index 97f620c..2358379 100644
--- a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java
@@ -288,24 +288,31 @@ public class CommunitySendActivity extends AbsActivity {
}
}
+ TimePickerView timePickerView;
+
public void showTimeChooseDialog() {
Calendar startCalendar = Calendar.getInstance();
startCalendar.set(1990, 1, 1);
Calendar endCalendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
- int month = calendar.get(Calendar.MONTH) + 1; // Calendar.MONTH 从0开始计数
+ int month = calendar.get(Calendar.MONTH); // Calendar.MONTH 从0开始计数
int day = calendar.get(Calendar.DAY_OF_MONTH);
- int hour = calendar.get(Calendar.HOUR); // 使用24小时制
+ int hour = calendar.get(Calendar.HOUR_OF_DAY); // 使用24小时制
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
endCalendar.set(year, month, day, hour, minute, second);
- TimePickerView timePickerView = new TimePickerBuilder(CommunitySendActivity.this, new OnTimeSelectListener() {
+ timePickerView = new TimePickerBuilder(CommunitySendActivity.this, new OnTimeSelectListener() {
@SuppressLint("SetTextI18n")
@Override
public void onTimeSelect(Date date, View v) {
- chooseTime.setText(DateFormatUtil.getTimeStrings(date.getTime()));
+ if (date.getTime() > new Date().getTime()) {
+ ToastUtil.show(getResources().getString(com.yunbao.main.R.string.time_cannot_be_greater_than_the_current_time));
+ timePickerView.show();
+ } else {
+ chooseTime.setText(DateFormatUtil.getTimeStrings(date.getTime()));
+ }
}
}).setType(new boolean[]{true, true, true, true, true, false})// 默认全部显示
.setCancelText(getResources().getString(R.string.cancel))//取消按钮文字
@@ -318,12 +325,6 @@ public class CommunitySendActivity extends AbsActivity {
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
.build();
timePickerView.show();
- timePickerView.setOnDismissListener(new OnDismissListener() {
- @Override
- public void onDismiss(Object o) {
-
- }
- });
}
private void openImageChooserActivity() {