fix [修复动态发布,时间选择问题]

This commit is contained in:
hch 2024-03-26 16:48:37 +08:00
parent 80fd2a1bbc
commit e386fbfdbb
6 changed files with 16 additions and 10 deletions

View File

@ -27,4 +27,5 @@
<string name="focus_on">Focus on</string>
<string name="see_more">See more</string>
<string name="close">close</string>
<string name="time_cannot_be_greater_than_the_current_time">Time cannot be greater than the current time</string>
</resources>

View File

@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@ -1490,4 +1490,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@ -1512,6 +1512,7 @@ Limited ride And limited avatar frame</string>
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@ -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() {