Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 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,28 @@ 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 && homePagerAdapter != null) {
int currentPage = viewPager.getCurrentItem();
if (currentPage == 1) { // assumption - history tab is always position 1
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 +817,6 @@ private boolean checkPlayServices() {
private void showErrorDialogPlayServices() {
Toast.makeText(getApplicationContext(), R.string.activity_main_error_play_services, Toast.LENGTH_SHORT).show();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ public void onNothingSelected(AdapterView<?> parent) {
ll1 = new LimitLine((float) minGlucoseValue);
ll2 = new LimitLine((float) maxGlucoseValue);
} else {
ll1 = new LimitLine((float) GlucosioConverter.glucoseToMmolL(maxGlucoseValue), getString(R.string.reading_high));
ll2 = new LimitLine((float) GlucosioConverter.glucoseToMmolL(minGlucoseValue), getString(R.string.reading_low));
ll1 = new LimitLine((float) GlucosioConverter.glucoseToMmolL(minGlucoseValue), getString(R.string.reading_low));
ll2 = new LimitLine((float) GlucosioConverter.glucoseToMmolL(maxGlucoseValue), getString(R.string.reading_high));
}

ll1.setLineWidth(0.8f);
Expand Down