Added button in settings to select BLE device. Note may have broken theme so UI looks odd - actionbar may be missing...

This commit is contained in:
Graham Jones
2020-08-08 21:31:34 +01:00
parent 3d9d47a757
commit 7e2dce8c67
12 changed files with 499 additions and 28 deletions

View File

@@ -0,0 +1,23 @@
<!--
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="56dp"
android:minWidth="56dp">
<ProgressBar android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"/>
</FrameLayout>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/device_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="24dp"/>
<TextView android:id="@+id/device_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12dp"/>
</LinearLayout>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Button
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/selectBLEDeviceButton"
android:text="@string/select_ble_device_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
>
</Button>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_refresh"
android:checkable="false"
android:orderInCategory="1"
app:showAsAction="ifRoom" />
<item android:id="@+id/menu_scan"
android:title="@string/menu_scan"
android:orderInCategory="100"
app:showAsAction="ifRoom|withText" />
<item android:id="@+id/menu_stop"
android:title="@string/menu_stop"
android:orderInCategory="101"
app:showAsAction="ifRoom|withText" />
</menu>

View File

@@ -141,5 +141,13 @@
<string name="send_sms_last_location">Send SMS - last location is </string>
<string name="failed_to_send_sms">ERROR: FAILED TO SEND SMS MESSAGE</string>
<string name="sms_alarms_disabled">SMS Alarms Disabled - not doing anything!</string>
<string name="title_devices">BLE Devices</string>
<string name="ble_not_supported">BLE Not Supported</string>
<string name="error_bluetooth_not_supported">Bluetooth Not Supported</string>
<string name="menu_stop">STOP</string>
<string name="menu_scan">SCAN</string>
<string name="unknown_device">Unknown Device</string>
<string name="select_ble_device_title">Select BLE Device</string>
<string name="select_ble_device_desc">Select Bluetooth Low Energy (BLE) Device to provide seizure (acceleration and heart rate) data).</string>
</resources>

View File

@@ -8,6 +8,12 @@
android:entryValues="@array/datasource_list_values"
android:defaultValue="Pebble"
android:dialogTitle="Select Data Source" />
<Preference
android:key="SelectBLEDevice"
android:title="@string/select_ble_device_title"
android:summary="@string/select_ble_device_desc"
android:widgetLayout="@layout/pref_select_ble_device_button"
/>
<CheckBoxPreference
android:defaultValue="true"
android:key="LogAlarms"

View File

@@ -1,7 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The ListPreference data is defined in pebble_datasource_values.xml -->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<?xml version="1.0" encoding="utf-8"?><!-- The ListPreference data is defined in pebble_datasource_values.xml -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="BLE Device Settings">
<EditTextPreference
android:defaultValue=""
android:key="BLE_Device_Addr"
android:summary="MAC Address of BLE Data Source Device"
android:title="Device Address" />
<EditTextPreference
android:defaultValue=""
android:key="BLE_Device_Name"
android:summary="Name of BLE Data Source Device"
android:title="Device Address" />
</PreferenceCategory>
<PreferenceCategory android:title="User Interface Settings">
<EditTextPreference
android:defaultValue="5"
@@ -58,23 +68,22 @@
android:summary="Period (in seconds) between data analyses"
android:title="SamplePeriod (sec)" />
<ListPreference
android:key="PebbleSdMode"
android:title="Seizure Detector Mode"
android:summary="Select one of the three available modes of operation."
android:defaultValue="0"
android:dialogTitle="Select Seizure Detector Mode"
android:entries="@array/pebble_sd_mode_list"
android:entryValues="@array/pebble_sd_mode_list_values"
android:defaultValue="0"
android:dialogTitle="Select Seizure Detector Mode" />
android:key="PebbleSdMode"
android:summary="Select one of the three available modes of operation."
android:title="Seizure Detector Mode" />
<ListPreference
android:key="SampleFreq"
android:title="Select Sample Frequency"
android:summary="Higher Frequency is more Accurate, but uses more battery power."
android:entries="@array/pebble_sample_freq_list"
android:entryValues="@array/pebble_sample_freq_list_values"
android:defaultValue="100"
android:dialogTitle="Select Sample Frequency"
android:enabled="true"
/>
android:entries="@array/pebble_sample_freq_list"
android:entryValues="@array/pebble_sample_freq_list_values"
android:key="SampleFreq"
android:summary="Higher Frequency is more Accurate, but uses more battery power."
android:title="Select Sample Frequency" />
</PreferenceCategory>
@@ -102,16 +111,15 @@
android:title="Fall Detection Window (milli-seconds)" />
</PreferenceCategory>
<PreferenceCategory
android:title="Watch Communications Settings">
<PreferenceCategory android:title="Watch Communications Settings">
<ListPreference
android:key="PebbleDebug"
android:title="Seizure Detector Debug Mode"
android:summary="Set Debug mode on or off."
android:defaultValue="0"
android:dialogTitle="Select Debug Mode"
android:entries="@array/pebble_debug_list"
android:entryValues="@array/pebble_debug_values"
android:defaultValue="0"
android:dialogTitle="Select Debug Mode" />
android:key="PebbleDebug"
android:summary="Set Debug mode on or off."
android:title="Seizure Detector Debug Mode" />
<EditTextPreference
android:defaultValue="10"
android:key="AppRestartTimeout"