|
|
@@ -6,6 +6,7 @@ import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.SpannableString;
|
|
|
import android.text.Spanned;
|
|
|
import android.text.style.AbsoluteSizeSpan;
|
|
|
+import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
@@ -16,6 +17,9 @@ import com.sheep.gamegroup.model.entity.PunchLogEntity;
|
|
|
import com.sheep.gamegroup.model.entity.StatisticsEntity;
|
|
|
import com.sheep.gamegroup.presenter.SignRecordContract;
|
|
|
import com.sheep.gamegroup.presenter.SignRecordPresenter;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
+import com.sheep.gamegroup.util.MathUtil;
|
|
|
import com.sheep.gamegroup.view.adapter.expandadapter.RecyclerViewData;
|
|
|
import com.sheep.gamegroup.view.adapter.expandadapter.SignRecordAdapter;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
@@ -55,6 +59,7 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
|
|
|
private List<RecyclerViewData> mDatas;
|
|
|
private SignRecordAdapter adapter;
|
|
|
+ View empty_view;
|
|
|
|
|
|
int index = 0;
|
|
|
Calendar calendar;
|
|
|
@@ -67,24 +72,29 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
activity = this;
|
|
|
+ empty_view = findViewById(R.id.download_mgr_empty_view);
|
|
|
TitleBarUtils
|
|
|
.getInstance()
|
|
|
.setTitle(activity, "我的战绩")
|
|
|
- .setTitleFinish(activity);
|
|
|
+ .setTitleFinish(activity)
|
|
|
+ .setRightImgBotton(activity, R.drawable.sign_right_record_bg, new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ Jump2View.getInstance().goSignRankingsAct(activity, null);
|
|
|
+ }
|
|
|
+ });
|
|
|
DaggerSignRecordComponent.builder()
|
|
|
.netComponent(SheepApp.get(this).getNetComponent())
|
|
|
.signRecordModule(new SignRecordModule(this))
|
|
|
.build()
|
|
|
.inject(this);
|
|
|
mDatas = new ArrayList<>();
|
|
|
-// adapter = new SignRecordAdapter(activity, mDatas);
|
|
|
recyclerview.setLayoutManager(new LinearLayoutManager(activity));
|
|
|
-// recyclerview.setAdapter(adapter);
|
|
|
calendar = Calendar.getInstance();
|
|
|
presenter.getStatistics();
|
|
|
- presenter.getPunchLog(1);
|
|
|
- presenter.getPunchLog(2);
|
|
|
- presenter.getPunchLog(3);
|
|
|
+ presenter.getPunchLog(1);//获取当月
|
|
|
+ presenter.getPunchLog(2);//获取上月
|
|
|
+ presenter.getPunchLog(3);//获取上上月
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -95,14 +105,6 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
-
|
|
|
-
|
|
|
- //test
|
|
|
-// signTvRecord.setText(String.format(getString(R.string.sign_tv_srecord_money),"12","80"));
|
|
|
-// signTvLjtr.setText(getSpannableString("10"));
|
|
|
-// signTvLjjj.setText(getSpannableString("101"));
|
|
|
-// signTvLjzq.setText(getSpannableString("11"));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -110,12 +112,10 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
public void succStatistics(BaseMessage o) {
|
|
|
// {"total_money":1,"continue_punch_count":1,"total_award":2.8,"total_punch_count":1}
|
|
|
StatisticsEntity statisticsEntity = o.getData(StatisticsEntity.class);
|
|
|
-
|
|
|
signTvRecord.setText(String.format(getString(R.string.sign_tv_srecord_money),statisticsEntity.getContinue_punch_count(),statisticsEntity.getTotal_punch_count()));
|
|
|
- signTvLjtr.setText(getSpannableString(statisticsEntity.getTotal_money()));
|
|
|
- signTvLjjj.setText(getSpannableString(statisticsEntity.getTotal_award()));
|
|
|
- float zq = Float.valueOf(statisticsEntity.getTotal_award()) - Float.valueOf(statisticsEntity.getTotal_money());
|
|
|
- signTvLjzq.setText(getSpannableString(""+ zq));
|
|
|
+ signTvLjtr.setText(getSpannableString(MathUtil.twoNumber(statisticsEntity.getTotal_money())));
|
|
|
+ signTvLjjj.setText(getSpannableString(MathUtil.twoNumber(statisticsEntity.getTotal_award())));
|
|
|
+ signTvLjzq.setText(getSpannableString(MathUtil.subtract(statisticsEntity.getTotal_award(),statisticsEntity.getTotal_money())));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -125,18 +125,29 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
@Override
|
|
|
public void succPunchLog(BaseMessage o,int action) {
|
|
|
List<PunchLogEntity> list = o.getDatas(PunchLogEntity.class);
|
|
|
- int month = calendar.get(Calendar.MONTH) + 1;
|
|
|
- if(action == 1){
|
|
|
- mDatas.add(action - 1,new RecyclerViewData(month + "月", list, true));
|
|
|
- }else if(action == 2){
|
|
|
- mDatas.add(action - 1,new RecyclerViewData((month - 1) + "月", list, false));
|
|
|
- }else if(action == 3){
|
|
|
- mDatas.add(action - 1,new RecyclerViewData((month - 2) + "月", list, false));
|
|
|
+ if(!ListUtil.isEmpty(list)){
|
|
|
+ int month = calendar.get(Calendar.MONTH) + 1;
|
|
|
+ if(action == 1){
|
|
|
+ mDatas.add(new RecyclerViewData(month + "月", list, true));
|
|
|
+ }else if(action == 2){
|
|
|
+ mDatas.add(new RecyclerViewData((month - 1) + "月", list, false));
|
|
|
+ }else if(action == 3){
|
|
|
+ mDatas.add(new RecyclerViewData((month - 2) + "月", list, false));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
index ++;
|
|
|
if(index == 3){
|
|
|
- adapter = new SignRecordAdapter(activity, mDatas);
|
|
|
- recyclerview.setAdapter(adapter);
|
|
|
+
|
|
|
+ if(ListUtil.isEmpty(mDatas)){
|
|
|
+ empty_view.setVisibility(View.VISIBLE);
|
|
|
+ recyclerview.setVisibility(View.GONE);
|
|
|
+ }else{
|
|
|
+ empty_view.setVisibility(View.GONE);
|
|
|
+ recyclerview.setVisibility(View.VISIBLE);
|
|
|
+ adapter = new SignRecordAdapter(activity, mDatas);
|
|
|
+ recyclerview.setAdapter(adapter);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -160,50 +171,4 @@ public class SignRecordAct extends BaseActivity implements SignRecordContract.Vi
|
|
|
return spannableString;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-// private void initBooks() {
|
|
|
-// List<SignRecord> bean1 = new ArrayList<>();
|
|
|
-// List<SignRecord> bean2 = new ArrayList<>();
|
|
|
-// List<SignRecord> bean3 = new ArrayList<>();
|
|
|
-// List<SignRecord> bean4 = new ArrayList<>();
|
|
|
-// // id , pid , label , 其他属性
|
|
|
-// bean1.add(new SignRecord("文件管理系统"));
|
|
|
-// bean1.add(new SignRecord("游戏"));
|
|
|
-// bean1.add(new SignRecord("文档"));
|
|
|
-// bean1.add(new SignRecord("程序"));
|
|
|
-// bean2.add(new SignRecord("war3"));
|
|
|
-// bean2.add(new SignRecord("刀塔传奇"));
|
|
|
-//
|
|
|
-// bean1.add(new SignRecord("面向对象"));
|
|
|
-// bean2.add(new SignRecord("非面向对象"));
|
|
|
-//
|
|
|
-// bean2.add(new SignRecord("C++"));
|
|
|
-// bean2.add(new SignRecord("JAVA"));
|
|
|
-// bean2.add(new SignRecord("Javascript"));
|
|
|
-// bean2.add(new SignRecord("C"));
|
|
|
-//
|
|
|
-// bean3.add(new SignRecord("文件管理系统"));
|
|
|
-// bean3.add(new SignRecord("游戏"));
|
|
|
-// bean4.add(new SignRecord("文档"));
|
|
|
-// bean4.add(new SignRecord("程序"));
|
|
|
-// bean4.add(new SignRecord("war3"));
|
|
|
-// bean3.add(new SignRecord("刀塔传奇"));
|
|
|
-//
|
|
|
-// bean3.add(new SignRecord("面向对象"));
|
|
|
-// bean4.add(new SignRecord("非面向对象"));
|
|
|
-//
|
|
|
-// bean3.add(new SignRecord("文件管理系统"));
|
|
|
-// bean3.add(new SignRecord("游戏"));
|
|
|
-// bean4.add(new SignRecord("文档"));
|
|
|
-// bean4.add(new SignRecord("程序"));
|
|
|
-// bean4.add(new SignRecord("war3"));
|
|
|
-// bean4.add(new SignRecord("刀塔传奇"));
|
|
|
-//
|
|
|
-// mDatas.add(new RecyclerViewData("分组0", bean1, true));
|
|
|
-// mDatas.add(new RecyclerViewData("分组1", bean2, false));
|
|
|
-// mDatas.add(new RecyclerViewData("分组2", bean3, false));
|
|
|
-// mDatas.add(new RecyclerViewData("分组3", bean4, false));
|
|
|
-// }
|
|
|
-
|
|
|
}
|