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

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="uk.org.openseizuredetector"
android:versionCode="92"
android:versionName="4.0.0b">
android:versionName="4.0.0c">
<!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
@@ -37,7 +37,7 @@
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<activity android:name=".AuthenticateActivity"></activity>
<activity android:name=".AuthenticateActivity"/>
<!-- @android:style/Theme.Holo.Light" -->
<activity android:name=".BLEScanActivity" />
<activity android:name=".ExportDataActivity" /> <!-- android:usesCleartextTraffic="true" -->

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.

View File

@@ -20,16 +20,16 @@
android:id="@+id/serverStatusTv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="0.5"
android:gravity="center"
android:text="textView1" />
<TextView
android:id="@+id/serverIpTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="0.5"
android:gravity="center"
android:text="textView2" />
</LinearLayout>
@@ -86,6 +86,11 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/remoteDbTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="----" />
<TextView
android:id="@+id/powerTv"
@@ -132,6 +137,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/CancelAudibleButtonTxt" />
<Button
android:id="@+id/manualAlarmButton"
android:layout_width="0dp"

View File

@@ -330,4 +330,9 @@
<string name="register">Register New User</string>
<string name="reset_password">Reset Password</string>
<string name="login_to_osdapi">Log in to osdApi Remote Database</string>
<string name="data_sharing_status">Data Sharing Status</string>
<string name="not_logging_data">Not Logging Data</string>
<string name="not_sharing_logged_data">Not Sharing Logged Data</string>
<string name="not_logged_in">Not Logged In</string>
<string name="data_sharing_setup_ok">Data Sharing Setup OK</string>
</resources>