diff --git a/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java b/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java index d899de9..ca32830 100644 --- a/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java @@ -39,7 +39,8 @@ public class LogManagerControlActivity extends AppCompatActivity { private SdServiceConnection mConnection; private OsdUtil mUtil; final Handler serverStatusHandler = new Handler(); - + private Integer mUiTimerPeriodFast = 2000; // 2 seconds - we use fast updating while UI is blank and we are waiting for first data + private Integer mUiTimerPeriodSlow = 60000; // 60 seconds - once data has been received and UI populated we only update once per minute. @Override protected void onCreate(Bundle savedInstanceState) { @@ -77,7 +78,7 @@ public class LogManagerControlActivity extends AppCompatActivity { super.onStart(); mUtil.bindToServer(getApplicationContext(), mConnection); waitForConnection(); - startUiTimer(); + startUiTimer(mUiTimerPeriodFast); } @Override @@ -129,7 +130,7 @@ public class LogManagerControlActivity extends AppCompatActivity { private void initialiseServiceConnection() { mLm = mConnection.mSdServer.mLm; - startUiTimer(); + startUiTimer(mUiTimerPeriodFast); getRemoteEvents(); // Populate events list - we only do it once when the activity is created because the query might slow down the UI. // We could try this code in updateUI() and see though. @@ -244,7 +245,13 @@ public class LogManagerControlActivity extends AppCompatActivity { } else { stopUpdating = false; } - if (stopUpdating) stopUiTimer(); + + // Note we do not really stop updating the UI, just change from the fast update period to the slow update period + // to save hammering the databases once the UI has been populated once. + if (stopUpdating) { + stopUiTimer(); + startUiTimer(mUiTimerPeriodSlow); + } } //updateUi(); @@ -352,7 +359,7 @@ public class LogManagerControlActivity extends AppCompatActivity { /* * Start the timer that will update the user interface every 5 seconds.. */ - private void startUiTimer() { + private void startUiTimer(Integer uiTimerPeriod) { if (mUiTimer != null) { Log.v(TAG, "startUiTimer -timer already running - cancelling it"); mUiTimer.cancel(); @@ -360,7 +367,7 @@ public class LogManagerControlActivity extends AppCompatActivity { } Log.v(TAG, "startUiTimer() - starting UiTimer"); mUiTimer = - new UiTimer(2000, 1000); + new UiTimer(uiTimerPeriod, 1000); mUiTimer.start(); } diff --git a/app/src/main/java/uk/org/openseizuredetector/SdServer.java b/app/src/main/java/uk/org/openseizuredetector/SdServer.java index 8ce0a67..dcba79c 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdServer.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdServer.java @@ -1668,7 +1668,7 @@ public class SdServer extends Service implements SdDataReceiver { PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, i, PendingIntent.FLAG_UPDATE_CURRENT); - String contentStr = "Please Record your Seizure Events"; + String contentStr = getString(R.string.please_confirm_seizure_events); if (mNotificationBuilder != null) { mNotification = mNotificationBuilder.setContentIntent(contentIntent) .setSmallIcon(iconId) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6de56c2..856fa00 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -294,10 +294,10 @@ Log in to OpenSeizureDetector Data Sharing Log Out Logged in with Token - Local Database - Remote Database - Number of Stored Events: - "Number of Stored Datapoints: " + Data on Phone + Shared Data + Number of Events Stored on Phone: + "Number of Datapoints Stored on Phone: " View Remote DB Data Report Seizure "Date: " @@ -305,7 +305,7 @@ "Time: " Cancel Select Time - Events in Local Database + Events Stored on Phone Created new Manual Alarm Event Datapoint not found - not doing anything Data Logging Settings @@ -326,7 +326,7 @@ ...waiting for data... Refresh Back - Unvalidated Seizure Events + Un-Confirmed Seizure Events Register New User Reset Password Log in to Share Data @@ -336,4 +336,5 @@ Not Sharing Logged Data Not Logged In Data Sharing Setup OK + Please Check your Shared Seizure Events diff --git a/app/src/main/res/xml/basic_prefs.xml b/app/src/main/res/xml/basic_prefs.xml index e7da12f..636b943 100644 --- a/app/src/main/res/xml/basic_prefs.xml +++ b/app/src/main/res/xml/basic_prefs.xml @@ -1,7 +1,7 @@