Skip to content

Commit

Permalink
Merge 13bb9b8 into 2c3e350
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Walters committed Jul 23, 2018
2 parents 2c3e350 + 13bb9b8 commit 836862f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/src/main/java/org/glucosio/android/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.glucosio.android.adapter.HomePagerAdapter;
import org.glucosio.android.analytics.Analytics;
import org.glucosio.android.db.DatabaseHandler;
import org.glucosio.android.fragment.HistoryFragment;
import org.glucosio.android.presenter.ExportPresenter;
import org.glucosio.android.presenter.MainPresenter;
import org.glucosio.android.tools.LocaleHelper;
Expand Down Expand Up @@ -166,6 +167,7 @@ public void onPageSelected(int position) {
public void onPageScrollStateChanged(int state) {

}

});

FloatingActionButton fabAddReading = findViewById(R.id.activity_main_fab_add_reading);
Expand Down Expand Up @@ -272,6 +274,30 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
analytics.reportScreen("Main Activity");
}

@Override
protected void onResume() {
/* Added this method to ensure that new data is shown after being added by other activities
example - while viewing HbA1c history, use calculator to add reading. The new reading
wasn't being shown on the history until the user navigated away from the history page
and came back, and it should refresh with data IMHO
*/
super.onResume();

if (viewPager != null) {
int currentPage = viewPager.getCurrentItem();
if (currentPage == 1) { // assumption - history tab is always position 1
if (homePagerAdapter != null) {
HistoryFragment historyFragment = homePagerAdapter.getHistoryFragment();
if (historyFragment != null) {
historyFragment.reloadFragmentAdapter();
}
}
}
}


}

private void openRemindersActivity() {
Intent intent = new Intent(this, RemindersActivity.class);
startActivity(intent);
Expand Down Expand Up @@ -793,4 +819,6 @@ private boolean checkPlayServices() {
private void showErrorDialogPlayServices() {
Toast.makeText(getApplicationContext(), R.string.activity_main_error_play_services, Toast.LENGTH_SHORT).show();
}


}

0 comments on commit 836862f

Please sign in to comment.