総額表示実装 WIP

This commit is contained in:
ろむねこ 2024-07-23 11:41:58 +09:00
parent 7f8c9d74fa
commit 7ecd46fb98
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -1,6 +1,5 @@
package one.nem.kidshift.wallet; package one.nem.kidshift.wallet;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -152,7 +151,7 @@ public class HistoryItemListAdapter extends RecyclerView.Adapter<HistoryItemList
if (holder instanceof MonthHeaderViewHolder) { if (holder instanceof MonthHeaderViewHolder) {
// ((MonthHeaderViewHolder) holder).monthHeaderTextView.setText(historyData.getRegisteredAt().getMonth() + ""); // ((MonthHeaderViewHolder) holder).monthHeaderTextView.setText(historyData.getRegisteredAt().getMonth() + "");
// DEBUG: 月をまたぐデータがないので // DEBUG: 月をまたぐデータがないので
((MonthHeaderViewHolder) holder).monthHeaderTextView.setText(historyData.getRegisteredAt().getDate() + ""); ((MonthHeaderViewHolder) holder).monthHeaderTitle.setText(historyData.getRegisteredAt().getDate() + "");
} }
} }
@ -169,6 +168,16 @@ public class HistoryItemListAdapter extends RecyclerView.Adapter<HistoryItemList
} }
} }
private int getMonthTotal(HistoryModel historyModel) {
int total = historyModel.getReward();
int index = historyDataList.getList().indexOf(historyModel) + 1;
while (!isFirstOfMonth(this.historyDataList.getList().get(index))) {
total += historyModel.getReward();
index++;
}
return total;
}
@Override @Override
public int getItemCount() { public int getItemCount() {
return historyDataList == null ? 0 : historyDataList.getList().size(); return historyDataList == null ? 0 : historyDataList.getList().size();
@ -189,11 +198,13 @@ public class HistoryItemListAdapter extends RecyclerView.Adapter<HistoryItemList
public static class MonthHeaderViewHolder extends HistoryItemListAdapter.ViewHolder { public static class MonthHeaderViewHolder extends HistoryItemListAdapter.ViewHolder {
// かなり邪道な方法だけどとりあえず取得できるので // かなり邪道な方法だけどとりあえず取得できるので
TextView monthHeaderTextView; TextView monthHeaderTitle;
TextView monthTotalTextView;
public MonthHeaderViewHolder(@NonNull View itemView) { public MonthHeaderViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
monthHeaderTextView = itemView.findViewById(R.id.monthHeaderTextView); monthHeaderTitle = itemView.findViewById(R.id.monthHeaderTitle);
monthTotalTextView = itemView.findViewById(R.id.monthTotalTextView);
} }
} }
} }