V3.0.4 - Fixed problem with crashing after server stopped, and crash when selecting install watch app menu option. And I think I have finally sorted the problem of multiple
versions of the server running...but might be wrong - clsoe the issue anyway and see what happens. Also tidied up main app screen when server stopped or in fault condition. Closes #13, Closes #12, Closes #11
This commit is contained in:
BIN
app/release/app-release-3.0.4.apk
Normal file
BIN
app/release/app-release-3.0.4.apk
Normal file
Binary file not shown.
@@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":52,"versionName":"3.0.3","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":53,"versionName":"3.0.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="uk.org.openseizuredetector"
|
package="uk.org.openseizuredetector"
|
||||||
android:versionCode="52"
|
android:versionCode="53"
|
||||||
android:versionName="3.0.3"
|
android:versionName="3.0.4"
|
||||||
>
|
>
|
||||||
<!--android:allowBackup="false"-->
|
<!--android:allowBackup="false"-->
|
||||||
|
|
||||||
|
|||||||
@@ -159,13 +159,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
Log.i(TAG, "onCreateOptionsMenu()");
|
Log.i(TAG, "onCreateOptionsMenu()");
|
||||||
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
|
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
|
||||||
mOptionsMenu = menu;
|
//mOptionsMenu = menu;
|
||||||
if (mConnection.mSdServer.mSdDataSourceName != "Pebble") {
|
//if (mConnection.mSdServer.mSdDataSourceName != "Pebble") {
|
||||||
Log.v(TAG,"Disabling Pebble Specific Menu Items");
|
// Log.v(TAG,"Disabling Pebble Specific Menu Items");
|
||||||
menu.findItem(R.id.action_instal_watch_app).setEnabled(false);
|
// menu.findItem(R.id.action_instal_watch_app).setEnabled(false);
|
||||||
menu.findItem(R.id.action_launch_pebble_app).setEnabled(false);
|
// menu.findItem(R.id.action_launch_pebble_app).setEnabled(false);
|
||||||
|
//}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,13 +172,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
Log.i(TAG, "onOptionsItemSelected() : " + item.getItemId() + " selected");
|
Log.i(TAG, "onOptionsItemSelected() : " + item.getItemId() + " selected");
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_launch_pebble_app:
|
/*case R.id.action_launch_pebble_app:
|
||||||
Log.i(TAG, "action_launch_pebble_app");
|
Log.i(TAG, "action_launch_pebble_app");
|
||||||
mConnection.mSdServer.mSdDataSource.startPebbleApp();
|
mConnection.mSdServer.mSdDataSource.startPebbleApp();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_instal_watch_app:
|
*/
|
||||||
|
case R.id.action_install_watch_app:
|
||||||
Log.i(TAG, "action_install_watch_app");
|
Log.i(TAG, "action_install_watch_app");
|
||||||
mConnection.mSdServer.mSdDataSource.installWatchApp();
|
mConnection.mSdServer.mSdDataSource.installWatchApp();
|
||||||
|
return true;
|
||||||
|
|
||||||
case R.id.action_accept_alarm:
|
case R.id.action_accept_alarm:
|
||||||
Log.i(TAG, "action_accept_alarm");
|
Log.i(TAG, "action_accept_alarm");
|
||||||
@@ -281,10 +282,13 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String versionName = mUtil.getAppVersionName();
|
String versionName = mUtil.getAppVersionName();
|
||||||
tv.setText("OpenSeizureDetector Android App Version " + versionName);
|
tv.setText("OpenSeizureDetector Android App Version " + versionName);
|
||||||
|
|
||||||
Log.i(TAG,"onStart() - binding to server");
|
if (mUtil.isServerRunning()) {
|
||||||
mUtil.writeToSysLogFile("MainActivity.onStart - Binding to Server");
|
mUtil.writeToSysLogFile("MainActivity.onStart - Binding to Server");
|
||||||
mUtil.bindToServer(this, mConnection);
|
mUtil.bindToServer(this, mConnection);
|
||||||
|
} else {
|
||||||
|
Log.i(TAG,"onStart() - Server Not Running");
|
||||||
|
mUtil.writeToSysLogFile("MainActivity.onStart - Server Not Running");
|
||||||
|
}
|
||||||
// start timer to refresh user interface every second.
|
// start timer to refresh user interface every second.
|
||||||
mUiTimer = new Timer();
|
mUiTimer = new Timer();
|
||||||
mUiTimer.schedule(new TimerTask() {
|
mUiTimer.schedule(new TimerTask() {
|
||||||
@@ -395,21 +399,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
tv.setBackgroundColor(warnColour);
|
tv.setBackgroundColor(warnColour);
|
||||||
tv.setTextColor(warnTextColour);
|
tv.setTextColor(warnTextColour);
|
||||||
}
|
}
|
||||||
if (mConnection.mSdServer.mSdData.alarmState == 4) {
|
|
||||||
tv.setText("FAULT");
|
|
||||||
tv.setBackgroundColor(warnColour);
|
|
||||||
tv.setTextColor(warnTextColour);
|
|
||||||
}
|
|
||||||
if (mConnection.mSdServer.mSdData.alarmState == 6) {
|
if (mConnection.mSdServer.mSdData.alarmState == 6) {
|
||||||
tv.setText("MUTE");
|
tv.setText("MUTE");
|
||||||
tv.setBackgroundColor(warnColour);
|
tv.setBackgroundColor(warnColour);
|
||||||
tv.setTextColor(warnTextColour);
|
tv.setTextColor(warnTextColour);
|
||||||
}
|
}
|
||||||
if (mConnection.mSdServer.mSdData.alarmState == 7) {
|
|
||||||
tv.setText("NET FAULT");
|
|
||||||
tv.setBackgroundColor(warnColour);
|
|
||||||
tv.setTextColor(warnTextColour);
|
|
||||||
}
|
|
||||||
if (mConnection.mSdServer.mSdData.alarmStanding) {
|
if (mConnection.mSdServer.mSdData.alarmStanding) {
|
||||||
tv.setText("**ALARM**");
|
tv.setText("**ALARM**");
|
||||||
tv.setBackgroundColor(alarmColour);
|
tv.setBackgroundColor(alarmColour);
|
||||||
@@ -420,6 +414,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
tv.setBackgroundColor(alarmColour);
|
tv.setBackgroundColor(alarmColour);
|
||||||
tv.setTextColor(alarmTextColour);
|
tv.setTextColor(alarmTextColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
tv = (TextView) findViewById(R.id.pebTimeTv);
|
tv = (TextView) findViewById(R.id.pebTimeTv);
|
||||||
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
|
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
|
||||||
tv.setBackgroundColor(okColour);
|
tv.setBackgroundColor(okColour);
|
||||||
@@ -526,12 +521,79 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
pbDrawable = getResources().getDrawable(R.drawable.progress_bar_red);
|
pbDrawable = getResources().getDrawable(R.drawable.progress_bar_red);
|
||||||
//pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN);
|
//pb.getProgressDrawable().setColorFilter(colour, PorterDuff.Mode.SRC_IN);
|
||||||
pb.setProgressDrawable(pbDrawable);
|
pb.setProgressDrawable(pbDrawable);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Fault Conditions - We override the values in the UI because we do not know
|
||||||
|
// if the stored ones are correct or not with a fault present.
|
||||||
|
if ((mConnection.mSdServer.mSdData.alarmState == 4) ||
|
||||||
|
(mConnection.mSdServer.mSdData.alarmState == 7)) {
|
||||||
|
tv = (TextView) findViewById(R.id.alarmTv);
|
||||||
|
if (mConnection.mSdServer.mSdData.alarmState == 4) {
|
||||||
|
tv.setText("FAULT");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
}
|
||||||
|
if (mConnection.mSdServer.mSdData.alarmState == 7) {
|
||||||
|
tv.setText("NET FAULT");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
}
|
||||||
|
tv = (TextView) findViewById(R.id.pebTimeTv);
|
||||||
|
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.pebTimeTv);
|
||||||
|
tv.setText("--:--:--");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.pebbleTv);
|
||||||
|
tv.setText("HR = ---");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.appTv);
|
||||||
|
tv.setText("Watch App -----");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.battTv);
|
||||||
|
tv.setText("Watch Battery = ---%");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
}
|
||||||
|
|
||||||
} else { // Not bound to server
|
} else { // Not bound to server
|
||||||
tv = (TextView) findViewById(R.id.alarmTv);
|
tv = (TextView) findViewById(R.id.alarmTv);
|
||||||
tv.setText("------");
|
tv.setText("------");
|
||||||
tv.setBackgroundColor(warnColour);
|
tv.setBackgroundColor(warnColour);
|
||||||
tv.setTextColor(warnTextColour);
|
tv.setTextColor(warnTextColour);
|
||||||
|
tv = (TextView) findViewById(R.id.pebTimeTv);
|
||||||
|
tv.setText(mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S"));
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.pebTimeTv);
|
||||||
|
tv.setText("--:--:--");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.pebbleTv);
|
||||||
|
tv.setText("HR = ---");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.appTv);
|
||||||
|
tv.setText("Watch App -----");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) findViewById(R.id.battTv);
|
||||||
|
tv.setText("Watch Battery = ---%");
|
||||||
|
tv.setBackgroundColor(warnColour);
|
||||||
|
tv.setTextColor(warnTextColour);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "ServerStatusRunnable: Exception - ");
|
Log.e(TAG, "ServerStatusRunnable: Exception - ");
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package uk.org.openseizuredetector;
|
package uk.org.openseizuredetector;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -81,7 +83,17 @@ public abstract class SdDataSource {
|
|||||||
/**
|
/**
|
||||||
* Install the watch app on the watch.
|
* Install the watch app on the watch.
|
||||||
*/
|
*/
|
||||||
public void installWatchApp() { Log.v(TAG,"installWatchApp"); }
|
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));
|
||||||
|
mContext.startActivity(i);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.i(TAG, "exception starting install watch app activity " + ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void startPebbleApp() { Log.v(TAG,"startPebbleApp()"); }
|
public void startPebbleApp() { Log.v(TAG,"startPebbleApp()"); }
|
||||||
|
|
||||||
|
|||||||
@@ -739,52 +739,6 @@ public class SdDataSourcePebble extends SdDataSource {
|
|||||||
nRawData = 0;
|
nRawData = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Install the wach app that is bundled in the 'assets' folder of this
|
|
||||||
* phone app.
|
|
||||||
* from https://github.com/pebble-examples/pebblekit-android-example/blob/master/android/Eclipse/src/com/getpebble/pebblekitexample/MainActivity.java#L148
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void installWatchApp() {
|
|
||||||
Log.v(TAG, "SdDataSourcePebble.installWatchApp()");
|
|
||||||
mUtil.writeToSysLogFile("SdDataSourcePebble.installWatchApp()");
|
|
||||||
final String WATCHAPP_FILENAME = "pebble_sd.pbw";
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Read .pbw from assets/
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
File file = new File(mContext.getExternalFilesDir(null), WATCHAPP_FILENAME);
|
|
||||||
InputStream is = mContext.getResources().getAssets().open(WATCHAPP_FILENAME);
|
|
||||||
OutputStream os = new FileOutputStream(file);
|
|
||||||
byte[] pbw = new byte[is.available()];
|
|
||||||
is.read(pbw);
|
|
||||||
os.write(pbw);
|
|
||||||
is.close();
|
|
||||||
os.close();
|
|
||||||
|
|
||||||
// Install via Pebble Android app
|
|
||||||
intent.setDataAndType(Uri.fromFile(file), "application/pbw");
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
} catch (IOException e) {
|
|
||||||
mUtil.writeToSysLogFile("SdDataSourcePebble.installWatchApp() - app install failed"+e.toString());
|
|
||||||
Toast.makeText(mContext, "App install failed: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Install the OpenSeizureDetector watch app onto the watch from Pebble AppStore
|
|
||||||
* based on https://forums.getpebble.com/discussion/13128/install-watch-app-pebble-store-from-android-companion-app
|
|
||||||
*/
|
|
||||||
public void installWatchAppFromPebbleAppStore() {
|
|
||||||
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("pebble://appstore/54d28a43e4d94c043f000008"));
|
|
||||||
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
mContext.startActivity(myIntent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open Pebble or Pebble Time app. If it is not installed, open Play store so the user can install it.
|
* Open Pebble or Pebble Time app. If it is not installed, open Play store so the user can install it.
|
||||||
|
|||||||
@@ -501,6 +501,7 @@ public class StartupActivity extends Activity {
|
|||||||
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
||||||
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
||||||
+ "\n\nChanges in this version:"
|
+ "\n\nChanges in this version:"
|
||||||
|
+ "\n- V3.0.4 - Fixed issues with install watch app, and stopping server resulting in crashes"
|
||||||
+ "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected"
|
+ "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected"
|
||||||
+ "\n- Upgraded to be compatible with Android Version 9"
|
+ "\n- Upgraded to be compatible with Android Version 9"
|
||||||
+ "\n- Added support a Garmin based seizure detector with Heart Rate alarm "
|
+ "\n- Added support a Garmin based seizure detector with Heart Rate alarm "
|
||||||
@@ -536,6 +537,7 @@ public class StartupActivity extends Activity {
|
|||||||
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
||||||
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
||||||
+ "\n\nChanges in this version:"
|
+ "\n\nChanges in this version:"
|
||||||
|
+ "\n- V3.0.4 - Fixed issues with install watch app, and stopping server resulting in crashes"
|
||||||
+ "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected"
|
+ "\n- V3.0.3 - Fixed problem with crash on phone boot if Auto Start on Boot option selected"
|
||||||
+ "\n- Upgraded to be compatible with Android Version 9"
|
+ "\n- Upgraded to be compatible with Android Version 9"
|
||||||
+ "\n- Added support for a Garmin based seizure detector with Heart Rate alarm "
|
+ "\n- Added support for a Garmin based seizure detector with Heart Rate alarm "
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
android:id="@+id/action_start_stop"
|
android:id="@+id/action_start_stop"
|
||||||
android:icon="@drawable/stop_server"
|
android:icon="@drawable/stop_server"
|
||||||
android:showAsAction="never|withText"
|
android:showAsAction="never|withText"
|
||||||
android:title="Stop Server" />
|
android:title="Start/Stop Server" />
|
||||||
|
|
||||||
<!-- fault beep test does not work because of fault timer so don't show menu option
|
<!-- fault beep test does not work because of fault timer so don't show menu option
|
||||||
<item
|
<item
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
android:showAsAction="never|withText"
|
android:showAsAction="never|withText"
|
||||||
android:title="Test Fault Beep" />
|
android:title="Test Fault Beep" />
|
||||||
-->
|
-->
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/action_launch_pebble_app"
|
android:id="@+id/action_launch_pebble_app"
|
||||||
android:showAsAction="never|withText"
|
android:showAsAction="never|withText"
|
||||||
android:title="Launch Pebble App" />
|
android:title="Launch Pebble App" />
|
||||||
|
-->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_instal_watch_app"
|
android:id="@+id/action_install_watch_app"
|
||||||
android:showAsAction="never|withText"
|
android:showAsAction="never|withText"
|
||||||
android:title="Install Watch App" />
|
android:title="Install Watch App" />
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.3.1'
|
classpath 'com.android.tools.build:gradle:3.3.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|||||||
Reference in New Issue
Block a user