@Override protected void initialize() { mPresenter = new MyStatPresenter(getActivity()); mPresenter.setView(this); appPreferences = new TrayAppPreferences(getActivity()); DateTime dateTime = DateTime.now(); int dayOfWeek = dateTime.getDayOfWeek(); boolean resetData; if (dayOfWeek == 1) { // It's Monday, check if data should be reset resetData = appPreferences.getBoolean(PREF_DATA_SHOULD_RESET, false); } else { // Not Monday, don't reset data resetData = false; // Set to true so that when it's Monday it resets again appPreferences.put(PREF_DATA_SHOULD_RESET, true); } mPresenter.getChartValues(resetData); }
@OnClick(R.id.resetDataBtn) public void resetData() { mPresenter.getChartValues(true); Toast.makeText(getActivity(), "Data reset", Toast.LENGTH_SHORT).show(); }
public void refreshChart() { mPresenter.getChartValues(false); }