Added data sharing status text field to main activity

This commit is contained in:
Graham Jones
2022-01-29 19:57:56 +00:00
parent fd1aff80b1
commit e973154896
5 changed files with 58 additions and 7 deletions

View File

@@ -568,6 +568,42 @@ public class MainActivity extends AppCompatActivity {
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
if (mConnection.mSdServer.mLogData) {
if (mConnection.mSdServer.mLogDataRemote) {
if (mConnection.mSdServer.mLm.mWac.isLoggedIn()) {
tv = (TextView) findViewById(R.id.remoteDbTv);
tv.setText(getString(R.string.data_sharing_status)
+": "
+getString(R.string.data_sharing_setup_ok));
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
} else {
tv = (TextView) findViewById(R.id.remoteDbTv);
tv.setText(getString(R.string.data_sharing_status)
+": "
+getString(R.string.not_logged_in));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
} else {
tv = (TextView) findViewById(R.id.remoteDbTv);
tv.setText(getString(R.string.data_sharing_status)
+": "
+getString(R.string.not_sharing_logged_data));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
} else {
tv = (TextView) findViewById(R.id.remoteDbTv);
tv.setText(getString(R.string.data_sharing_status)
+": "
+getString(R.string.not_logging_data));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
// Set ProgressBars to show margin to alarm.
long powerPc;
if (mConnection.mSdServer.mSdData.alarmThresh != 0)
@@ -664,7 +700,6 @@ public class MainActivity extends AppCompatActivity {
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
} else { // Not bound to server
tv = (TextView) findViewById(R.id.alarmTv);
tv.setText(R.string.Dashes);
@@ -694,6 +729,11 @@ public class MainActivity extends AppCompatActivity {
tv.setText(getString(R.string.WatchBatteryEquals)+" ---%");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
tv = (TextView) findViewById(R.id.remoteDbTv);
tv.setText("---");
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
} catch (Exception e) {
Log.e(TAG, "ServerStatusRunnable: Exception - ");

View File

@@ -134,8 +134,8 @@ public class SdServer extends Service implements SdDataReceiver {
// Data Logging Parameters
private boolean mLogAlarms = true;
private boolean mLogData = false;
private boolean mLogDataRemote = false;
public boolean mLogData = false;
public boolean mLogDataRemote = false;
private boolean mLogDataRemoteMobile = false;
private String mAuthToken = null;
private long mEventDuration = 120; // event duration in seconds - uploads datapoints that cover this time range centred on the event time.