diff --git a/CHANGELOG.md b/CHANGELOG.md index 3550291..3a11db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ OpenSeizureDetector Android App - Change Log ============================================ + V4.2.12 - Fixed crash when pressing 'Install Watch App' button by hiding the button if the Pebble data source is not selected + - Added a 'Help' and 'Troubleshooting' button and menu item to draw users' attention to the web site instructions. V4.2.11 - Updated permissions handling to support Android 14 (needed to publish on Play Store) - added a crude 'flap' detector into OSD Algorithm - Added setting to change the delay before SMS alert is sent (Issue #202) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d050036..131c331 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="151" + android:versionName="4.2.12"> diff --git a/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java b/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java index 66228d4..9e9bdae 100644 --- a/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java +++ b/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java @@ -292,6 +292,34 @@ public class MainActivity2 extends AppCompatActivity { Log.i(TAG, "exception starting settings activity " + ex.toString()); } return true; + case R.id.action_instructions: + Log.i(TAG, "action_instructions"); + try { + String url = "https://www.openseizuredetector.org.uk/?page_id=1894"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } catch (Exception ex) { + Log.v(TAG, "exception displaying instructions " + ex.toString()); + mUtil.showToast("ERROR Displaying Instructions"); + } + return true; + + case R.id.action_troubleshooting: + Log.i(TAG, "action_troubleshooting"); + try { + String url = "https://www.openseizuredetector.org.uk/?page_id=2235"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } catch (Exception ex) { + Log.v(TAG, "exception displaying troubleshooting " + ex.toString()); + mUtil.showToast("ERROR Displaying Troubleshooting Tips"); + } + return true; + case R.id.action_about: Log.i(TAG, "action_about"); showAbout(); diff --git a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java index 4ee024e..e2a45d6 100644 --- a/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/StartupActivity.java @@ -183,17 +183,79 @@ public class StartupActivity extends AppCompatActivity { } }); - + // Enable the "Install Watch App" button if we have the Pebble data source selected, + // otherwise hide it. b = (Button) findViewById(R.id.installOsdAppButton); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + String dataSourceName = (prefs.getString("DataSource", "Phone")); + if (dataSourceName.equals("Pebble")) { + b.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Log.v(TAG, "install Osd Watch App button clicked"); + if (mConnection.mSdServer.mSdDataSource != null) { + mUtil.writeToSysLogFile("Installing Watch App"); + mConnection.mSdServer.mSdDataSource.installWatchApp(); + } else { + mUtil.showToast("Error installing watch app - Datasource has not started - please see installation instructions on web site"); + Log.v(TAG, "Displaying Installation Instructions"); + try { + String url = "https://www.openseizuredetector.org.uk/?page_id=1894"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } catch (Exception ex) { + Log.i(TAG, "exception starting install watch app activity " + ex.toString()); + mUtil.showToast("Error Displaying Installation Instructions - try http://www.openseizuredetector.org.uk/?page_id=1894 instead"); + } + } + } + }); + } else { + b.setVisibility(View.GONE); + } + + b = (Button) findViewById(R.id.instructionsButton); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Log.v(TAG, "install Osd Watch App button clicked"); - mUtil.writeToSysLogFile("Installing Watch App"); - mConnection.mSdServer.mSdDataSource.installWatchApp(); + Log.v(TAG, "instructions button clicked"); + try { + String url = "https://www.openseizuredetector.org.uk/?page_id=1894"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } catch (Exception ex) { + Log.v(TAG, "exception displaying instructions " + ex.toString()); + mUtil.showToast("ERROR Displaying Instructions"); + } + } }); + b = (Button) findViewById(R.id.troubleshootingButton); + b.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Log.v(TAG, "troubleshooting button clicked"); + try { + String url = "https://www.openseizuredetector.org.uk/?page_id=2235"; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + } catch (Exception ex) { + Log.v(TAG, "exception displaying troubleshooting " + ex.toString()); + mUtil.showToast("ERROR Displaying Troubleshooting Tips"); + } + + } + }); + + + // Connect to the background service mConnection = new SdServiceConnection(getApplicationContext()); } diff --git a/app/src/main/res/layout/startup_activity.xml b/app/src/main/res/layout/startup_activity.xml index 1d0aaca..6c81712 100644 --- a/app/src/main/res/layout/startup_activity.xml +++ b/app/src/main/res/layout/startup_activity.xml @@ -35,12 +35,36 @@ android:layout_gravity="center_horizontal" /> +