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

Binary file not shown.

View File

@@ -130,6 +130,11 @@ public class FragmentCommon extends FragmentOsdBaseClass {
tv.setBackgroundColor(alarmColour);
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);
@@ -196,15 +201,18 @@ public class FragmentCommon extends FragmentOsdBaseClass {
}
tv = (TextView) mRootView.findViewById(R.id.dataSourceInfoTv);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
if (mConnection.mSdServer.mSdDataSourceName.equals("Phone")) {
tv.setText(getString(R.string.DataSource) + " = " + "Phone (Demo Mode)");
tv.setBackgroundColor(warnColour);
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 {
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
tv.setBackgroundColor(okColour);
tv.setTextColor(okTextColour);
}
// deal with latch alarms button

View File

@@ -159,7 +159,9 @@ public class FragmentSystem extends FragmentOsdBaseClass {
tv.setTextColor(warnTextColour);
}
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) {
tv.setBackgroundColor(alarmColour);
tv.setTextColor(alarmTextColour);

View File

@@ -65,18 +65,7 @@ public class MainActivity2 extends AppCompatActivity {
mUtil.writeToSysLogFile("MainActivity2.onCreate()");
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
public Fragment createFragment(int position) {
// Note - the number of positions must match the value returned by getItemCount() below.
switch (position) {
case 0:
return new FragmentOsdAlg();
case 1:
return new FragmentHrAlg();
case 2:
return new FragmentBatt();
case 3:
return new FragmentSystem();
case 4:
return new FragmentDataSharing();
//case 3:
// return new FragmentBatt();
//case 4:
// return new FragmentDataSharing();
default:
Log.e(TAG, "createFragment() - invalid Position " + position);
@@ -309,7 +299,7 @@ public class MainActivity2 extends AppCompatActivity {
@Override
public int getItemCount() {
return 5;
return 3;
}
}

View File

@@ -36,6 +36,7 @@ import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.format.Time;
@@ -621,5 +622,23 @@ public class SdDataSourceBLE extends SdDataSource {
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="DataSource">DataSource</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="ServerStopped">Server Stopped</string>
<string name="Warning">WARNING</string>