|
@@ -12,7 +12,7 @@ import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
|
|
|
import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
|
|
import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
|
|
|
import com.sheep.gamegroup.model.api.ApiService;
|
|
import com.sheep.gamegroup.model.api.ApiService;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
-import com.sheep.gamegroup.model.entity.PunchLogEntity;
|
|
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.PunchLog;
|
|
|
import com.sheep.gamegroup.model.entity.StatisticsEntity;
|
|
import com.sheep.gamegroup.model.entity.StatisticsEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
@@ -34,7 +34,7 @@ import rx.schedulers.Schedulers;
|
|
|
* Created by realicing on 2018/9/17.
|
|
* Created by realicing on 2018/9/17.
|
|
|
* realicing@sina.com
|
|
* realicing@sina.com
|
|
|
*/
|
|
*/
|
|
|
-public class FgtSignCardRecord extends BaseListFragment<PunchLogEntity>{
|
|
|
|
|
|
|
+public class FgtSignCardRecord extends BaseListFragment<PunchLog>{
|
|
|
CalendarView sign_card_record_cv;
|
|
CalendarView sign_card_record_cv;
|
|
|
TextView total_award;
|
|
TextView total_award;
|
|
|
TextView total_money;
|
|
TextView total_money;
|
|
@@ -42,7 +42,7 @@ public class FgtSignCardRecord extends BaseListFragment<PunchLogEntity>{
|
|
|
TextView continue_punch_count;
|
|
TextView continue_punch_count;
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
- per_page = 50;
|
|
|
|
|
|
|
+ per_page = 100;
|
|
|
super.initView();
|
|
super.initView();
|
|
|
view_list.setNestedScrollingEnabled(false);
|
|
view_list.setNestedScrollingEnabled(false);
|
|
|
View view = LayoutInflater.from(activity).inflate(R.layout.header_sign_card_record, null);
|
|
View view = LayoutInflater.from(activity).inflate(R.layout.header_sign_card_record, null);
|
|
@@ -65,15 +65,29 @@ public class FgtSignCardRecord extends BaseListFragment<PunchLogEntity>{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public void initListener() {
|
|
|
|
|
+ super.initListener();
|
|
|
|
|
+ sign_card_record_cv.setOnMonthChangeListener(new CalendarView.OnMonthChangeListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onMonthChange(int year, int month) {
|
|
|
|
|
+ if(isNoMore()){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ loadMoreData();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
protected RecyclerView.Adapter getAdapter() {
|
|
protected RecyclerView.Adapter getAdapter() {
|
|
|
- return new RecyclerViewAdapter<PunchLogEntity>(SheepApp.getInstance(), R.layout.item_sign_card_record, list) {
|
|
|
|
|
|
|
+ return new RecyclerViewAdapter<PunchLog>(SheepApp.getInstance(), R.layout.item_sign_card_record, list) {
|
|
|
@Override
|
|
@Override
|
|
|
- public void convert(ViewHolder viewHolder, PunchLogEntity item, int position) {
|
|
|
|
|
|
|
+ public void convert(ViewHolder viewHolder, PunchLog item, int position) {
|
|
|
TextView sign_card_record_date = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_date);
|
|
TextView sign_card_record_date = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_date);
|
|
|
TextView sign_card_record_time = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_time);
|
|
TextView sign_card_record_time = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_time);
|
|
|
TextView sign_card_record_bonus = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_bonus);
|
|
TextView sign_card_record_bonus = (TextView) viewHolder.itemView.findViewById(R.id.sign_card_record_bonus);
|
|
|
- ViewUtil.setTextTime(sign_card_record_date, item.getCreateTime(), "yyyy/MM/dd");
|
|
|
|
|
- ViewUtil.setTextTime(sign_card_record_time, item.getCreateTime(), "HH:mm");
|
|
|
|
|
|
|
+ ViewUtil.setTextTime(sign_card_record_date, item.getCreate_time(), "yyyy/MM/dd");
|
|
|
|
|
+ ViewUtil.setTextTime(sign_card_record_time, item.getCreate_time(), "HH:mm");
|
|
|
ViewUtil.setText(sign_card_record_bonus, item.getAmount() + "元");
|
|
ViewUtil.setText(sign_card_record_bonus, item.getAmount() + "元");
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -90,13 +104,13 @@ public class FgtSignCardRecord extends BaseListFragment<PunchLogEntity>{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- protected Class<PunchLogEntity> getTClass() {
|
|
|
|
|
- return PunchLogEntity.class;
|
|
|
|
|
|
|
+ protected Class<PunchLog> getTClass() {
|
|
|
|
|
+ return PunchLog.class;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void notifyData() {
|
|
public void notifyData() {
|
|
|
- updateCalendarSchemeDate(list);
|
|
|
|
|
|
|
+ updateCalendarSchemeDate(newList);
|
|
|
}
|
|
}
|
|
|
private void initStatistics() {
|
|
private void initStatistics() {
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getStatistics()
|
|
SheepApp.getInstance().getNetComponent().getApiService().getStatistics()
|
|
@@ -118,33 +132,31 @@ public class FgtSignCardRecord extends BaseListFragment<PunchLogEntity>{
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- private boolean theMonthFull = false;
|
|
|
|
|
/**
|
|
/**
|
|
|
* 标记日期时间
|
|
* 标记日期时间
|
|
|
*/
|
|
*/
|
|
|
- public void updateCalendarSchemeDate(List<PunchLogEntity> newList) {
|
|
|
|
|
|
|
+ public void updateCalendarSchemeDate(List<PunchLog> newList) {
|
|
|
if(ListUtil.isEmpty(newList)){
|
|
if(ListUtil.isEmpty(newList)){
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if(theMonthFull){//只加载本月数据
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //只加载当年数据
|
|
|
int year = sign_card_record_cv.getCurYear();
|
|
int year = sign_card_record_cv.getCurYear();
|
|
|
- int month = sign_card_record_cv.getCurMonth();
|
|
|
|
|
- Map<String, Calendar> map = new HashMap<>();
|
|
|
|
|
- for (PunchLogEntity item : newList) {
|
|
|
|
|
- java.util.Calendar date = java.util.Calendar.getInstance(Locale.CHINA);
|
|
|
|
|
- date.setTimeInMillis(item.getCreateTime() * 1000);
|
|
|
|
|
- if(year == date.get(java.util.Calendar.YEAR) && month == 1 + date.get(java.util.Calendar.MONTH)){
|
|
|
|
|
- Calendar calendar = getSchemeCalendar(year, month, date.get(java.util.Calendar.DAY_OF_MONTH));
|
|
|
|
|
- map.put(calendar.toString(), calendar);
|
|
|
|
|
- } else {
|
|
|
|
|
- theMonthFull = true;
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ for (PunchLog item : newList) {
|
|
|
|
|
+ if(timeMap.contains(item.getCreate_time())){
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ timeMap.add(item.getCreate_time());
|
|
|
|
|
+ java.util.Calendar date = java.util.Calendar.getInstance();
|
|
|
|
|
+ date.setTimeInMillis(item.getCreate_time() * 1000);
|
|
|
|
|
+ int month = 1 + date.get(java.util.Calendar.MONTH);
|
|
|
|
|
+ int day = date.get(java.util.Calendar.DAY_OF_MONTH);
|
|
|
|
|
+ Calendar calendar = getSchemeCalendar(year, month, day);
|
|
|
|
|
+ map.put(calendar.toString(), calendar);
|
|
|
}
|
|
}
|
|
|
sign_card_record_cv.setSchemeDate(map);
|
|
sign_card_record_cv.setSchemeDate(map);
|
|
|
}
|
|
}
|
|
|
|
|
+ private Map<String, Calendar> map = new HashMap<>();
|
|
|
|
|
+ private List<Long> timeMap = ListUtil.emptyList();
|
|
|
|
|
|
|
|
private Calendar getSchemeCalendar(int year, int month, int day) {
|
|
private Calendar getSchemeCalendar(int year, int month, int day) {
|
|
|
Calendar calendar = new Calendar();
|
|
Calendar calendar = new Calendar();
|