public void updateUI() { adapter.setReporteDate(curDate); txtDate.setText(TimeUtils.getShortDate(curDate)); ArrayList<Report> reports = reportDAO.getAllFromStartedDate(TimeUtils.getSQLDate(curDate)); long workedTime = TimeUtils.getReportsTotalTime(reports); if (workedTime > 0) { txtWorkedHours.setText(TimeUtils.TimeDHMtoString(workedTime)); } else { txtWorkedHours.setText(R.string.lbl_time_not_set); } updateNextDateButton(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_report, container, false); view.findViewById(R.id.btnPrevDate).setOnClickListener(this); btnNextDate = (Button) view.findViewById(R.id.btnNextDate); btnNextDate.setOnClickListener(this); adapter = new ReporListAdapter(getActivity()); ListView list = (ListView) view.findViewById(R.id.taskList); list.setAdapter(adapter); txtWorkedHours = (TextView) view.findViewById(R.id.txtWorkedTime); txtDate = (TextView) view.findViewById(R.id.txtDate); reportDAO = ReportDAO.getInstance(getActivity()); updateUI(); return view; }