|
|
|
@ -32,6 +32,8 @@ import com.necer.painter.InnerPainter;
@@ -32,6 +32,8 @@ import com.necer.painter.InnerPainter;
|
|
|
|
|
import com.necer.utils.CalendarUtil; |
|
|
|
|
|
|
|
|
|
import org.joda.time.LocalDate; |
|
|
|
|
import org.joda.time.format.DateTimeFormatter; |
|
|
|
|
import org.joda.time.format.ISODateTimeFormat; |
|
|
|
|
import org.reactivestreams.Subscription; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
@ -85,7 +87,11 @@ public class CalendarFragment extends BaseFragment {
@@ -85,7 +87,11 @@ public class CalendarFragment extends BaseFragment {
|
|
|
|
|
|
|
|
|
|
XLog.d("lastDate: {}", lastDate); |
|
|
|
|
if (StrUtil.isNotEmpty(lastDate)) { |
|
|
|
|
binding.miui10Calendar.setInitializeDate(lastDate); |
|
|
|
|
rebuildRecordListViewByDate(lastDate); |
|
|
|
|
|
|
|
|
|
LocalDate localDate = LocalDate.parse(lastDate, ISODateTimeFormat.date()); |
|
|
|
|
setLunarDateLabel(localDate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 构建弹出框内容
|
|
|
|
@ -224,13 +230,7 @@ public class CalendarFragment extends BaseFragment {
@@ -224,13 +230,7 @@ public class CalendarFragment extends BaseFragment {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
XLog.d("当前选中 " + localDate); |
|
|
|
|
Lunar lunar = CalendarUtil.getCalendarDate(localDate).lunar; |
|
|
|
|
String lunarDate = lunar.chineseEra + "年" + lunar.lunarMonthStr + lunar.lunarDayStr; |
|
|
|
|
|
|
|
|
|
// 重置上次选中日期
|
|
|
|
|
lastDate = localDate.toString(); |
|
|
|
|
|
|
|
|
|
binding.tvResult.setText(StrUtil.format("{} | {}", lastDate, lunarDate)); |
|
|
|
|
setLunarDateLabel(localDate); |
|
|
|
|
|
|
|
|
|
// 重组日期
|
|
|
|
|
rebuildRecordListViewByDate(lastDate); |
|
|
|
@ -239,6 +239,16 @@ public class CalendarFragment extends BaseFragment {
@@ -239,6 +239,16 @@ public class CalendarFragment extends BaseFragment {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setLunarDateLabel(LocalDate localDate) { |
|
|
|
|
Lunar lunar = CalendarUtil.getCalendarDate(localDate).lunar; |
|
|
|
|
String lunarDate = lunar.chineseEra + "年" + lunar.lunarMonthStr + lunar.lunarDayStr; |
|
|
|
|
|
|
|
|
|
// 重置上次选中日期
|
|
|
|
|
lastDate = localDate.toString(); |
|
|
|
|
|
|
|
|
|
binding.tvResult.setText(StrUtil.format("{} | {}", lastDate, lunarDate)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void rebuildRecordListViewByDate(String date) { |
|
|
|
|
DateTime dateTime = DateUtil.parseDate(date); |
|
|
|
|
// 移除所有旧内容项
|
|
|
|
|