Fixed data sharing status box text on MainActivity.

This commit is contained in:
Graham Jones
2022-02-03 20:44:09 +00:00
parent d911d89e34
commit dd7c01b8ea
2 changed files with 53 additions and 68 deletions

View File

@@ -571,79 +571,64 @@ public class MainActivity extends AppCompatActivity {
tv.setTextColor(okTextColour); tv.setTextColor(okTextColour);
} }
if (mConnection.mSdServer.mLogData) { ////////////////////////////////////////////////////////////
if (mConnection.mSdServer.mLogDataRemote) { // Populate the Data Sharing Status Box
if (mConnection.mSdServer.mLm.mWac.isLoggedIn()) { // We start off with it set to OK, then check for several different abnormal conditions
if (!mConnection.mSdServer.mLogDataRemoteMobile) { // in turn - the last one that is active is the one that is displayed.
Log.v(TAG,"mLogDataRemoteMobile="+mConnection.mSdServer.mLogDataRemoteMobile); tv = (TextView) findViewById(R.id.remoteDbTv);
Log.v(TAG,"mUtil.isMobileDataActive="+mUtil.isMobileDataActive()); tv.setText(getString(R.string.data_sharing_status)
if (mUtil.isNetworkConnected()) { + ": "
if (mUtil.isMobileDataActive()) { + getString(R.string.data_sharing_setup_ok));
tv = (TextView) findViewById(R.id.remoteDbTv); tv.setBackgroundColor(okColour);
tv.setText(getString(R.string.data_sharing_status) tv.setTextColor(okTextColour);
+ ": "
+ getString(R.string.not_updating_mobile)); if (!mConnection.mSdServer.mLm.mWac.mServerConnectionOk) {
tv.setBackgroundColor(warnColour); // Problem connecting to server
tv.setTextColor(warnTextColour);
} else {
if (mConnection.mSdServer.mLm.mWac.mServerConnectionOk) {
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.error_connecting_to_server));
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_updating_no_network));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
} else {
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 = (TextView) findViewById(R.id.remoteDbTv);
tv.setText(getString(R.string.data_sharing_status) tv.setText(getString(R.string.data_sharing_status)
+": " + ": "
+getString(R.string.not_logging_data)); + getString(R.string.error_connecting_to_server));
tv.setBackgroundColor(warnColour); tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour); tv.setTextColor(warnTextColour);
} }
if (!mConnection.mSdServer.mLogDataRemoteMobile && mUtil.isMobileDataActive()) {
// We are on mobile internet but we are set to not upload over mobile data.
tv.setText(getString(R.string.data_sharing_status)
+ ": "
+ getString(R.string.not_updating_mobile));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (!mUtil.isNetworkConnected()) {
// No network connection
tv.setText(getString(R.string.data_sharing_status)
+ ": "
+ getString(R.string.not_updating_no_network));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (!mConnection.mSdServer.mLm.mWac.isLoggedIn()) {
// Not Logged In
tv.setText(getString(R.string.data_sharing_status)
+ ": "
+ getString(R.string.not_logged_in));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
if (!mConnection.mSdServer.mLogData) {
// Not set to share data
tv.setText(getString(R.string.data_sharing_status)
+ ": "
+ getString(R.string.not_sharing_logged_data));
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
/////////////////////////////////////////////////////
// Set ProgressBars to show margin to alarm. // Set ProgressBars to show margin to alarm.
long powerPc; long powerPc;
if (mConnection.mSdServer.mSdData.alarmThresh != 0) if (mConnection.mSdServer.mSdData.alarmThresh != 0)

View File

@@ -331,7 +331,7 @@
<string name="reset_password">Reset Password</string> <string name="reset_password">Reset Password</string>
<string name="login_to_osdapi">Log in to Share Data</string> <string name="login_to_osdapi">Log in to Share Data</string>
<string name="login">Log In</string> <string name="login">Log In</string>
<string name="data_sharing_status">Data Sharing Status</string> <string name="data_sharing_status">Data Sharing</string>
<string name="not_logging_data">Not Logging Data</string> <string name="not_logging_data">Not Logging Data</string>
<string name="not_sharing_logged_data">Not Sharing Logged Data</string> <string name="not_sharing_logged_data">Not Sharing Logged Data</string>
<string name="not_logged_in">Not Logged In</string> <string name="not_logged_in">Not Logged In</string>
@@ -339,6 +339,6 @@
<string name="please_confirm_seizure_events">Please Check your Shared Seizure Events</string> <string name="please_confirm_seizure_events">Please Check your Shared Seizure Events</string>
<string name="data_sharing_log_in">Data Sharing Log-In</string> <string name="data_sharing_log_in">Data Sharing Log-In</string>
<string name="not_updating_mobile">Not Updating using Mobile Internet</string> <string name="not_updating_mobile">Not Updating using Mobile Internet</string>
<string name="not_updating_no_network">Not Updating - No Network Connection</string> <string name="not_updating_no_network">No Network Connection</string>
<string name="error_connecting_to_server">Error Connecting to Server</string> <string name="error_connecting_to_server">Error Connecting to Server</string>
</resources> </resources>