修复开服表过年无法显示问题,修改开服表显示规则
This commit is contained in:
@ -216,7 +216,7 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
|
||||
// 获取当前月的初始时间的时间戳
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.MONTH, 0);
|
||||
calendar.add(Calendar.MONTH, -1); // 上一个月时间
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
|
||||
@ -93,18 +93,19 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
|
||||
private void checkExistCurSerer() {
|
||||
long curDate = System.currentTimeMillis();
|
||||
SimpleDateFormat formatMonth = new SimpleDateFormat("MM", Locale.CHINA);
|
||||
int curMonth = Integer.parseInt(formatMonth.format(curDate));
|
||||
|
||||
for (KaiFuServerEntity kaiFuServerEntity : mServerList) { // 判断当月是否有开服
|
||||
long time = kaiFuServerEntity.getTime();
|
||||
int serverMonth = Integer.parseInt(formatMonth.format(time * 1000));
|
||||
if (serverMonth == curMonth) {
|
||||
isExistCurServer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isExistCurServer = true; // 此参数控制是否显示当月开服表(无论有没有开服信息),为防止需求变更先设死这个参数
|
||||
// long curDate = System.currentTimeMillis();
|
||||
// SimpleDateFormat formatMonth = new SimpleDateFormat("MM", Locale.CHINA);
|
||||
// int curMonth = Integer.parseInt(formatMonth.format(curDate));
|
||||
//
|
||||
// for (KaiFuServerEntity kaiFuServerEntity : mServerList) { // 判断当月是否有开服
|
||||
// long time = kaiFuServerEntity.getTime();
|
||||
// int serverMonth = Integer.parseInt(formatMonth.format(time * 1000));
|
||||
// if (serverMonth == curMonth) {
|
||||
// isExistCurServer = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void initView(final GameDetailKaiFuViewHolder viewHolder) {
|
||||
@ -118,14 +119,14 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
int lastMonth = -1;
|
||||
|
||||
for (KaiFuServerEntity kaiFuServerEntity : mServerList) {
|
||||
lastTime = kaiFuServerEntity.getTime();
|
||||
lastMonth = Integer.parseInt(formatMonth.format(lastTime * 1000));
|
||||
if (lastMonth > curMonth) break;
|
||||
lastTime = kaiFuServerEntity.getTime() * 1000;
|
||||
lastMonth = Integer.parseInt(formatMonth.format(lastTime));
|
||||
if (lastMonth != curMonth && lastTime > curDate) break;
|
||||
}
|
||||
|
||||
viewHolder.curMonth.setText(format.format(curDate));
|
||||
if (lastMonth > curMonth) {
|
||||
viewHolder.nextMonth.setText(format.format(lastTime * 1000));
|
||||
if (lastMonth != curMonth && lastTime > curDate) {
|
||||
viewHolder.nextMonth.setText(format.format(lastTime));
|
||||
viewHolder.nextMonth.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.nextMonth.setVisibility(View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user