Tidying up new user interface (and upgrading libraries after I suddenly got a load of build errors for some reason)

This commit is contained in:
Graham Jones
2024-01-24 20:09:34 +00:00
parent df9465dfb2
commit b4ec9afdcc
7 changed files with 57 additions and 38 deletions

View File

@@ -1,13 +1,13 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
android { android {
compileSdkVersion 33 compileSdk 34 // Android 14
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
defaultConfig { defaultConfig {
applicationId "uk.org.openseizuredetector" applicationId "uk.org.openseizuredetector"
minSdkVersion 23 minSdkVersion 23 // Android 6
targetSdkVersion 33 targetSdkVersion 33 // Android 13
multiDexEnabled true multiDexEnabled true
} }
@@ -42,15 +42,15 @@ dependencies {
// how we use ValueFormatter // how we use ValueFormatter
// FIXME: Update mainactivity so we can use the latest version. // FIXME: Update mainactivity so we can use the latest version.
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.3' implementation 'com.github.PhilJay:MPAndroidChart:v2.1.3'
implementation 'com.getpebble:pebblekit:3.1.0@aar' implementation 'com.getpebble:pebblekit:4.0.1@aar'
// Unit testing dependencies // Unit testing dependencies
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.firebase:firebase-auth:19.2.0' implementation 'com.google.firebase:firebase-auth:22.3.1'
implementation 'androidx.test:core:1.4.0' implementation 'androidx.test:core:1.5.0'
implementation 'com.google.android.gms:play-services-tflite-java:16.0.0' implementation 'com.google.android.gms:play-services-tflite-java:16.1.0'
implementation 'com.google.android.gms:play-services-tflite-support:16.0.0' implementation 'com.google.android.gms:play-services-tflite-support:16.1.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'org.apache.commons:commons-math3:3.6.1' implementation 'org.apache.commons:commons-math3:3.6.1'
// google play services used for location finding for SMS alerts. // google play services used for location finding for SMS alerts.
@@ -60,16 +60,16 @@ dependencies {
implementation 'com.google.android.gms:play-services-location:+' implementation 'com.google.android.gms:play-services-location:+'
//implementation 'com.github.RohitSurwase.UCE-Handler:uce_handler:1.3' //implementation 'com.github.RohitSurwase.UCE-Handler:uce_handler:1.3'
implementation 'com.android.volley:volley:1.2.1' implementation 'com.android.volley:volley:1.2.1'
implementation platform('com.google.firebase:firebase-bom:29.2.0') implementation platform('com.google.firebase:firebase-bom:32.7.1')
implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-analytics'
implementation 'com.firebaseui:firebase-ui-auth:7.2.0' implementation 'com.firebaseui:firebase-ui-auth:8.0.2'
implementation 'com.google.firebase:firebase-firestore' implementation 'com.google.firebase:firebase-firestore'
implementation 'androidx.navigation:navigation-fragment:2.5.2' implementation 'androidx.navigation:navigation-fragment:2.7.6'
implementation 'androidx.navigation:navigation-ui:2.5.2' implementation 'androidx.navigation:navigation-ui:2.7.6'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
testImplementation "androidx.test:core" testImplementation "androidx.test:core"
testImplementation 'org.mockito:mockito-core:4.3.1' testImplementation 'org.mockito:mockito-core:5.9.0'
//testImplementation 'org.hamcrest:hamcrest-library:2.2' //testImplementation 'org.hamcrest:hamcrest-library:2.2'
//testImplementation 'org.robolectric:robolectric:4.7.3' //testImplementation 'org.robolectric:robolectric:4.7.3'

Binary file not shown.

View File

@@ -130,6 +130,11 @@ public class FragmentCommon extends FragmentOsdBaseClass {
tv.setBackgroundColor(alarmColour); tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour); tv.setTextColor(alarmTextColour);
} }
if (mConnection.mSdServer.mSdData.alarmState == 4) {
tv.setText(R.string.Fault);
tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour);
}
tv = (TextView) mRootView.findViewById(R.id.algsTv); tv = (TextView) mRootView.findViewById(R.id.algsTv);
@@ -196,15 +201,18 @@ public class FragmentCommon extends FragmentOsdBaseClass {
} }
tv = (TextView) mRootView.findViewById(R.id.dataSourceInfoTv); tv = (TextView) mRootView.findViewById(R.id.dataSourceInfoTv);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
if (mConnection.mSdServer.mSdDataSourceName.equals("Phone")) { if (mConnection.mSdServer.mSdDataSourceName.equals("Phone")) {
tv.setText(getString(R.string.DataSource) + " = " + "Phone (Demo Mode)"); tv.setText(getString(R.string.DataSource) + " = " + "Phone (Demo Mode)");
tv.setBackgroundColor(warnColour); tv.setBackgroundColor(warnColour);
tv.setTextColor(warnTextColour); tv.setTextColor(warnTextColour);
} else if (mConnection.mSdServer.mSdDataSourceName.equals("BLE")) {
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName
+ " ("+ mConnection.mSdServer.mSdData.watchSdName + ", "
+ mConnection.mSdServer.mSdData.watchPartNo+")");
} else { } else {
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName); tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
} }
// deal with latch alarms button // deal with latch alarms button

View File

@@ -159,7 +159,9 @@ public class FragmentSystem extends FragmentOsdBaseClass {
tv.setTextColor(warnTextColour); tv.setTextColor(warnTextColour);
} }
tv = (TextView) mRootView.findViewById(R.id.battTv); tv = (TextView) mRootView.findViewById(R.id.battTv);
tv.setText(getString(R.string.WatchBatteryEquals) + String.valueOf(mConnection.mSdServer.mSdData.batteryPc) + "%"); tv.setText(getString(R.string.WatchBatteryEquals)
+ String.valueOf(mConnection.mSdServer.mSdData.batteryPc) + "% / "
+ String.valueOf(mConnection.mSdServer.mSdData.phoneBatteryPc) + "%");
if (mConnection.mSdServer.mSdData.batteryPc <= 10) { if (mConnection.mSdServer.mSdData.batteryPc <= 10) {
tv.setBackgroundColor(alarmColour); tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour); tv.setTextColor(alarmTextColour);

View File

@@ -65,18 +65,7 @@ public class MainActivity2 extends AppCompatActivity {
mUtil.writeToSysLogFile("MainActivity2.onCreate()"); mUtil.writeToSysLogFile("MainActivity2.onCreate()");
mContext = this; mContext = this;
/**
if (savedInstanceState == null) {
// Instantiate a ViewPager2 and a PagerAdapter.
mFragmentPager = findViewById(R.id.fragment_pager);
mFragmentStateAdapter = new ScreenSlideFragmentPagerAdapter(this);
mFragmentPager.setAdapter(mFragmentStateAdapter);
getSupportFragmentManager().beginTransaction()
.setReorderingAllowed(true)
.add(R.id.fragment_common_container_view, FragmentCommon.class, null)
.commit();
}
*/
} }
/** /**
@@ -289,17 +278,18 @@ public class MainActivity2 extends AppCompatActivity {
@Override @Override
public Fragment createFragment(int position) { public Fragment createFragment(int position) {
// Note - the number of positions must match the value returned by getItemCount() below.
switch (position) { switch (position) {
case 0: case 0:
return new FragmentOsdAlg(); return new FragmentOsdAlg();
case 1: case 1:
return new FragmentHrAlg(); return new FragmentHrAlg();
case 2: case 2:
return new FragmentBatt();
case 3:
return new FragmentSystem(); return new FragmentSystem();
case 4: //case 3:
return new FragmentDataSharing(); // return new FragmentBatt();
//case 4:
// return new FragmentDataSharing();
default: default:
Log.e(TAG, "createFragment() - invalid Position " + position); Log.e(TAG, "createFragment() - invalid Position " + position);
@@ -309,7 +299,7 @@ public class MainActivity2 extends AppCompatActivity {
@Override @Override
public int getItemCount() { public int getItemCount() {
return 5; return 3;
} }
} }

View File

@@ -36,6 +36,7 @@ import android.bluetooth.BluetoothProfile;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.format.Time; import android.text.format.Time;
@@ -621,5 +622,23 @@ public class SdDataSourceBLE extends SdDataSource {
return mBluetoothGatt.getServices(); return mBluetoothGatt.getServices();
} }
/**
* Install the watch app on the watch.
*/
/* @Override
public void installWatchApp() {
Log.v(TAG, "installWatchApp");
try {
String url = "http://www.openseizuredetector.org.uk/?page_id=1207";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(i);
} catch (Exception ex) {
Log.i(TAG, "exception starting install watch app activity " + ex.toString());
showToast("Error Displaying Installation Instructions - try http://www.openseizuredetector.org.uk/?page_id=1207 instead");
}
}
*/
} }

View File

@@ -44,7 +44,7 @@
<string name="WaitingForSeizureDetectorSettings">Waiting for Seizure Detector Settings...</string> <string name="WaitingForSeizureDetectorSettings">Waiting for Seizure Detector Settings...</string>
<string name="DataSource">DataSource</string> <string name="DataSource">DataSource</string>
<string name="AppTitleText">OpenSeizureDetector Android App Version </string> <string name="AppTitleText">OpenSeizureDetector Android App Version </string>
<string name="ServerRunningOK">Server Running OK\n</string> <string name="ServerRunningOK">Server Running OK</string>
<string name="AccessServerAt">Access Server at </string> <string name="AccessServerAt">Access Server at </string>
<string name="ServerStopped">Server Stopped</string> <string name="ServerStopped">Server Stopped</string>
<string name="Warning">WARNING</string> <string name="Warning">WARNING</string>