// updates what's displayed on the "Current Exposure Level" within the circle progress bar public void updateCurrentUVLevel() { // Refresh the circle progress bar only for the current UV reading Fragment f = getFragmentManager().findFragmentById(R.id.content_frame); if (f instanceof SummaryFragment) { ((SummaryFragment) f).pb.invalidate(); ((SummaryFragment) f).ResetBars(); } }
// updates what's displayed on the "Current Exposure Level" within the circle progress bar // ie the percentage of exposurelevel public void updateExposureLevel() { // Calculate the new exposure level by reading the .readings file corresponding // to the CURRENT day String todayReadings = getCurrDate() + ".readings"; Vector<String> readData = readFile(todayReadings); if (readData.size() > 0) { currentExposureLevel = 0; // overwrite the old value with new one for (String line : readData) { String[] processed = line.split(","); currentExposureLevel = currentExposureLevel + Double.parseDouble(processed[0]); } } currentExposurePerc = currentExposureLevel / RECOMMENDED_EXPOSURE * 100; Log.e("test", "Percentage exposure: " + Double.toString(currentExposurePerc) + "%"); // Refresh the circle progress bar Fragment f = getFragmentManager().findFragmentById(R.id.content_frame); if (f instanceof SummaryFragment) { ((SummaryFragment) f).pb.invalidate(); ((SummaryFragment) f).ResetBars(); } }