From fbf26eb5a6afaa6065d1265eb97dfce05f5b8f50 Mon Sep 17 00:00:00 2001 From: sorceressofmathematics Date: Tue, 23 May 2017 23:03:05 -0700 Subject: [PATCH 1/3] Added periodic "metronome" functionality to BottlenoseSender --- Morse/Android/BottlenoseSender/.idea/.name | 1 - .../Android/BottlenoseSender/.idea/gradle.xml | 4 +- Morse/Android/BottlenoseSender/.idea/misc.xml | 26 ++- .../.idea/runConfigurations.xml | 12 + Morse/Android/BottlenoseSender/.idea/vcs.xml | 2 +- .../BottlenoseSender/BottlenoseSender.iml | 4 +- Morse/Android/BottlenoseSender/app/app.iml | 76 +++--- .../Android/BottlenoseSender/app/build.gradle | 7 +- .../app/src/main/AndroidManifest.xml | 19 +- .../ghww/bottlenosesender/MainActivity.java | 216 +++++++++++++++++- .../bottlenosesender/SettingsActivity.java | 99 ++++++++ .../java/ghww/wcl/BluetoothSerialService.java | 7 +- .../main/java/ghww/wcl/CommunicationType.java | 2 +- .../src/main/java/ghww/wcl/DeviceType.java | 2 +- .../java/ghww/wcl/IGrindhouseListener.java | 2 +- .../app/src/main/java/ghww/wcl/NorthStar.java | 2 +- .../main/res/drawable/ic_info_black_24dp.xml | 9 + .../drawable/ic_notifications_black_24dp.xml | 9 + .../main/res/drawable/ic_sync_black_24dp.xml | 9 + .../app/src/main/res/values/arrays.xml | 13 ++ .../app/src/main/res/values/dimens.xml | 1 + .../app/src/main/res/values/strings.xml | 93 ++++++++ .../app/src/main/res/values/styles.xml | 9 + .../app/src/main/res/xml/pref_general.xml | 48 ++++ Morse/Android/BottlenoseSender/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- 26 files changed, 614 insertions(+), 64 deletions(-) delete mode 100644 Morse/Android/BottlenoseSender/.idea/.name create mode 100644 Morse/Android/BottlenoseSender/.idea/runConfigurations.xml create mode 100644 Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/SettingsActivity.java create mode 100644 Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_info_black_24dp.xml create mode 100644 Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_notifications_black_24dp.xml create mode 100644 Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_sync_black_24dp.xml create mode 100644 Morse/Android/BottlenoseSender/app/src/main/res/values/arrays.xml create mode 100644 Morse/Android/BottlenoseSender/app/src/main/res/xml/pref_general.xml diff --git a/Morse/Android/BottlenoseSender/.idea/.name b/Morse/Android/BottlenoseSender/.idea/.name deleted file mode 100644 index 75573da..0000000 --- a/Morse/Android/BottlenoseSender/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -BottlenoseSender \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/.idea/gradle.xml b/Morse/Android/BottlenoseSender/.idea/gradle.xml index 3ed2e6c..fe72da5 100644 --- a/Morse/Android/BottlenoseSender/.idea/gradle.xml +++ b/Morse/Android/BottlenoseSender/.idea/gradle.xml @@ -5,14 +5,14 @@ + diff --git a/Morse/Android/BottlenoseSender/.idea/misc.xml b/Morse/Android/BottlenoseSender/.idea/misc.xml index e930905..5d19981 100644 --- a/Morse/Android/BottlenoseSender/.idea/misc.xml +++ b/Morse/Android/BottlenoseSender/.idea/misc.xml @@ -3,6 +3,30 @@ + + + + @@ -13,7 +37,7 @@ - + diff --git a/Morse/Android/BottlenoseSender/.idea/runConfigurations.xml b/Morse/Android/BottlenoseSender/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/Morse/Android/BottlenoseSender/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/.idea/vcs.xml b/Morse/Android/BottlenoseSender/.idea/vcs.xml index 6564d52..c2365ab 100644 --- a/Morse/Android/BottlenoseSender/.idea/vcs.xml +++ b/Morse/Android/BottlenoseSender/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/BottlenoseSender.iml b/Morse/Android/BottlenoseSender/BottlenoseSender.iml index 1e94b47..048c86e 100644 --- a/Morse/Android/BottlenoseSender/BottlenoseSender.iml +++ b/Morse/Android/BottlenoseSender/BottlenoseSender.iml @@ -8,12 +8,12 @@ - + - + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/app.iml b/Morse/Android/BottlenoseSender/app/app.iml index 31ffbe8..781395d 100644 --- a/Morse/Android/BottlenoseSender/app/app.iml +++ b/Morse/Android/BottlenoseSender/app/app.iml @@ -9,13 +9,11 @@ - + - + + - + + - + - + + + + + + + + - + + + + + + + + - + - + + - - - - - - - - - - + + + + + + + - - - + + + + + - - - + + + + + + + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/build.gradle b/Morse/Android/BottlenoseSender/app/build.gradle index 545f011..b2a6a58 100644 --- a/Morse/Android/BottlenoseSender/app/build.gradle +++ b/Morse/Android/BottlenoseSender/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 - buildToolsVersion "22.0.1" + buildToolsVersion '25.0.0' defaultConfig { applicationId "ghww.bottlenosesender" @@ -10,6 +10,7 @@ android { targetSdkVersion 22 versionCode 1 versionName "1.0" + vectorDrawables.useSupportLibrary = true } buildTypes { release { @@ -25,5 +26,9 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) + // compile 'com.android.support:support-vector-drawable:22.+' compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.android.support:support-v4:22.2.1' + compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' + compile 'com.android.support:design:22.2.1' } diff --git a/Morse/Android/BottlenoseSender/app/src/main/AndroidManifest.xml b/Morse/Android/BottlenoseSender/app/src/main/AndroidManifest.xml index 2ce4de0..b86818d 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/AndroidManifest.xml +++ b/Morse/Android/BottlenoseSender/app/src/main/AndroidManifest.xml @@ -1,23 +1,28 @@ + package="ghww.bottlenosesender"> + + + + android:theme="@style/AppTheme"> + android:label="@string/app_name"> + - - - + + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/MainActivity.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/MainActivity.java index 66d3ffe..2278b5c 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/MainActivity.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/MainActivity.java @@ -1,15 +1,22 @@ package ghww.bottlenosesender; +import android.annotation.TargetApi; import android.app.Activity; +import android.app.AlarmManager; +import android.app.PendingIntent; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.graphics.Color; -import android.support.v7.app.ActionBarActivity; +import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; +import android.os.SystemClock; +import android.preference.PreferenceManager; +import android.support.v7.app.ActionBarActivity; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -19,12 +26,21 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; -import android.widget.TableLayout; import android.widget.TextView; import android.widget.Toast; import android.widget.ToggleButton; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.ArrayList; +import java.util.Calendar; import java.util.Queue; import java.util.Set; @@ -34,13 +50,20 @@ import ghww.wcl.IGrindhouseDevice; import ghww.wcl.IGrindhouseListener; - +@TargetApi(3) public class MainActivity extends ActionBarActivity { + private final String LOG_TAG = MainActivity.class.getSimpleName(); + + private static final int SETTINGS_RESULT = 1; private ArrayAdapter mPairedDevicesArrayAdapter; private ArrayAdapter mNewDevicesArrayAdapter; private ArrayList passedValuesCollection = new ArrayList(); IGrindhouseDevice gdal = GrindhouseDeviceFactory.GetDevice(DeviceType.BOTTLENOSE, CommunicationType.BLUETOOTH); String _selectedDeviceID = ""; + + private AlarmManager alarmMgr; + private PendingIntent alarmIntent; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,6 +71,15 @@ protected void onCreate(Bundle savedInstanceState) { mPairedDevicesArrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1); mNewDevicesArrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1); gdal.addListener(dataChangeListener); + setAlarm(); + } + + @Override + public void onDestroy() { + if (alarmMgr != null) { + alarmMgr.cancel(alarmIntent); + } + super.onDestroy(); } @Override @@ -66,12 +98,156 @@ public boolean onOptionsItemSelected(MenuItem item) { //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { + startActivityForResult(new Intent(this, SettingsActivity.class), SETTINGS_RESULT); return true; } return super.onOptionsItemSelected(item); } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == SETTINGS_RESULT) { + if (resultCode == Activity.RESULT_OK) { + setAlarm(); + } + } + super.onActivityResult(requestCode, resultCode, data); + } + + private void setAlarm() { + // If preference for enabling metronome is checked, set alarm for this + final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + + if(shared.getBoolean(getString(R.string.pref_key_toggle), false)) { + int refreshTime = Integer.parseInt( + shared.getString(getString(R.string.pref_key_refresh_time), + getString(R.string.pref_default_refresh_time))); + long refreshTimeMillis = refreshTime*60*1000; + + // Create PendingIntent and send it every refreshTime minutes + Intent intent = new Intent("ghww.bottlenosesender.ALARM_SEND_DATA"); + alarmIntent = PendingIntent.getBroadcast(this, 0, intent, 0); + + alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, + SystemClock.elapsedRealtime() + refreshTimeMillis, + refreshTimeMillis, alarmIntent); + + // Create BroadcastReceiver and IntentFilter to send to Bottlenose when alarm goes off + BroadcastReceiver br = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String sentData = ""; + if(shared.getBoolean(getString(R.string.pref_key_time), false)) { + // Get current time and add to sent data in HHMM format + Calendar calendar = Calendar.getInstance(); + int hours = calendar.get(Calendar.HOUR_OF_DAY); + int mins = calendar.get(Calendar.MINUTE); + sentData += (String.valueOf(hours) + String.valueOf(mins)); + } + if(shared.getBoolean(getString(R.string.pref_key_temp), false)) { + // These two need to be declared outside the try/catch + // so that they can be closed in the finally block. + HttpURLConnection urlConnection = null; + BufferedReader reader = null; + + // Will contain the raw JSON response as a string. + String forecastJsonStr = null; + + String location = shared.getString(getString(R.string.pref_key_location), + getString(R.string.pref_default_location)); + String units = shared.getString(getString(R.string.pref_units_key), + getString(R.string.pref_units_metric)); + + // Get current temperature and add to sent data + try { + // Construct the URL for the OpenWeatherMap query + // Possible parameters are avaiable at OWM's forecast API page, at + // http://openweathermap.org/API#forecast + final String FORECAST_BASE_URL = + "http://api.openweathermap.org/data/2.5/weather?"; + final String QUERY_PARAM = "q"; + final String UNITS_PARAM = "units"; + final String LOCATION_PARAM = "zip"; + + Uri builtUri = Uri.parse(FORECAST_BASE_URL).buildUpon() + .appendQueryParameter(UNITS_PARAM, units) + .appendQueryParameter(LOCATION_PARAM, location) + .build(); + + URL url = new URL(builtUri.toString()); + + // Create the request to OpenWeatherMap, and open the connection + urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection.setRequestMethod("GET"); + urlConnection.connect(); + + // Read the input stream into a String + InputStream inputStream = urlConnection.getInputStream(); + StringBuffer buffer = new StringBuffer(); + if (inputStream == null) { + // Nothing to do. + sentData += ""; + } + reader = new BufferedReader(new InputStreamReader(inputStream)); + + String line; + while ((line = reader.readLine()) != null) { + // Since it's JSON, adding a newline isn't necessary (it won't affect parsing) + // But it does make debugging a *lot* easier if you print out the completed + // buffer for debugging. + buffer.append(line + "\n"); + } + + if (buffer.length() == 0) { + // Stream was empty. No point in parsing. + return; + } + forecastJsonStr = buffer.toString(); + } catch (IOException e) { + Log.e(LOG_TAG, "Error ", e); + // If the code didn't successfully get the weather data, there's no point in attemping + // to parse it. + return; + } finally { + if (urlConnection != null) { + urlConnection.disconnect(); + } + if (reader != null) { + try { + reader.close(); + } catch (final IOException e) { + Log.e(LOG_TAG, "Error closing stream", e); + } + } + } + + try { + JSONObject forecastJson = new JSONObject(forecastJsonStr); + JSONObject weatherObject = forecastJson.getJSONObject("main"); + double temp = weatherObject.getDouble("temp"); + sentData += String.valueOf(temp); + } catch (JSONException e) { + Log.e(LOG_TAG, e.getMessage(), e); + e.printStackTrace(); + } + // This will only happen if there was an error getting or parsing the forecast. + sentData += ""; + } + + gdal.IssueCustomCommand(sentData); + } + }; + + IntentFilter iFilter = new IntentFilter("ghww.bottlenosesender.ALARM_SEND_DATA"); + registerReceiver(br, iFilter); + } else { + if (alarmMgr != null) { + alarmMgr.cancel(alarmIntent); + } + } + } + public void onButtonClickSendTime(View v) { LinearLayout layout = (LinearLayout) findViewById(R.id.linearlayout_content); layout.removeAllViews(); @@ -406,7 +582,7 @@ public void onItemClick(AdapterView av, View v, int arg2, long arg3) { gdal.ConnectToDevice("", address); findViewById(R.id.isConnected).setVisibility(View.VISIBLE); ((ToggleButton)findViewById(R.id.isConnected)).setChecked(gdal.isConnected()); - ((ToggleButton)findViewById(R.id.isConnected)).setEnabled(gdal.isConnected()); + findViewById(R.id.isConnected).setEnabled(gdal.isConnected()); mNewDevicesArrayAdapter.clear(); mPairedDevicesArrayAdapter.clear(); @@ -491,15 +667,41 @@ public void dataChanged(Queue msgQueue) { ToggleButton tb = (ToggleButton)findViewById(R.id.isConnected); if(gdal.isConnected()) { tb.setChecked(true); - ((ToggleButton)findViewById(R.id.isConnected)).setEnabled(true); + findViewById(R.id.isConnected).setEnabled(true); } else if(!gdal.isConnected()){ tb.setChecked(false); - ((ToggleButton)findViewById(R.id.isConnected)).setEnabled(true); + findViewById(R.id.isConnected).setEnabled(true); } } }; + + public void deviceBack(View v) { + String info = ((TextView) v).getText().toString(); + String address = ""; + LinearLayout content = (LinearLayout) findViewById(R.id.linearlayout_content); + LinearLayout devices = (LinearLayout) findViewById(R.id.mydevices); + + Button rawData = (Button) findViewById(R.id.button_rawdata); + Button timeSender = (Button) findViewById(R.id.button_timesender); + Button cardSender = (Button) findViewById(R.id.button_cardsender); + ToggleButton isConnected = (ToggleButton) findViewById(R.id.isConnected); + + if (info.length() > 17) + address = info.substring(info.length() - 17); + else + address = info; + + _selectedDeviceID = address; + content.setVisibility(View.VISIBLE); + devices.setVisibility(View.GONE); + + rawData.setVisibility(View.VISIBLE); + timeSender.setVisibility(View.VISIBLE); + cardSender.setVisibility(View.VISIBLE); + isConnected.setVisibility(View.VISIBLE); + } } diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/SettingsActivity.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/SettingsActivity.java new file mode 100644 index 0000000..76756b8 --- /dev/null +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/bottlenosesender/SettingsActivity.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2014 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. + */ +package ghww.bottlenosesender; + +import android.os.Bundle; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceManager; +import android.preference.SwitchPreference; + + +/** + * A {@link PreferenceActivity} that presents a set of application settings. + *

+ * See + * Android Design: Settings for design guidelines and the Settings + * API Guide for more information on developing a Settings UI. + */ +public class SettingsActivity extends PreferenceActivity + implements Preference.OnPreferenceChangeListener { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // Add 'general' preferences, defined in the XML file + addPreferencesFromResource(R.xml.pref_general); + + // For all preferences, attach an OnPreferenceChangeListener so the UI summary can be + // updated when the preference changes. + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_toggle))); + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_refresh_time))); + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_time))); + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_temp))); + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_location))); + bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_units_key))); + } + + /** + * Attaches a listener so the summary is always updated with the preference value. + * Also fires the listener once, to initialize the summary (so it shows up before the value + * is changed.) + */ + private void bindPreferenceSummaryToValue(Preference preference) { + // Set the listener to watch for value changes. + preference.setOnPreferenceChangeListener(this); + + // Trigger the listener immediately with the preference's + // current value. + if(preference instanceof SwitchPreference) { + onPreferenceChange(preference, + PreferenceManager + .getDefaultSharedPreferences(preference.getContext()) + .getBoolean(preference.getKey(), false)); + } else { + onPreferenceChange(preference, + PreferenceManager + .getDefaultSharedPreferences(preference.getContext()) + .getString(preference.getKey(), "")); + } + } + + @Override + public boolean onPreferenceChange(Preference preference, Object value) { + String stringValue = value.toString(); + + if (preference instanceof ListPreference) { + // For list preferences, look up the correct display value in + // the preference's 'entries' list (since they have separate labels/values). + ListPreference listPreference = (ListPreference) preference; + int prefIndex = listPreference.findIndexOfValue(stringValue); + if (prefIndex >= 0) { + preference.setSummary(listPreference.getEntries()[prefIndex]); + } + } else if (preference instanceof SwitchPreference) { + // Summary should remain unchanged in this case + preference.setSummary(preference.getSummary()); + } else { + // For other preferences, set the summary to the value's simple string representation. + preference.setSummary(stringValue); + } + return true; + } + +} \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/BluetoothSerialService.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/BluetoothSerialService.java index 256a1c8..d33adc1 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/BluetoothSerialService.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/BluetoothSerialService.java @@ -81,12 +81,7 @@ public synchronized int getState() { public synchronized boolean isConnected(){ //need to get the ordinal int state = getState(); - if(state == 3) { - return true; - } - else{ - return false; - } + return state == 3; } /** diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/CommunicationType.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/CommunicationType.java index 2d86907..49ae9b9 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/CommunicationType.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/CommunicationType.java @@ -4,5 +4,5 @@ public enum CommunicationType{ UNKNOWN, BLUETOOTH, WIFI, - XBEE; + XBEE } diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/DeviceType.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/DeviceType.java index 9361a78..f95356a 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/DeviceType.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/DeviceType.java @@ -4,5 +4,5 @@ public enum DeviceType{ UNKNOWN, NORTHSTAR, BOTTLENOSE, - CIRCADIA; + CIRCADIA } diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/IGrindhouseListener.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/IGrindhouseListener.java index 56c5d72..abb59f4 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/IGrindhouseListener.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/IGrindhouseListener.java @@ -3,5 +3,5 @@ import java.util.Queue; public interface IGrindhouseListener { - public void dataChanged(Queue msgQueue); + void dataChanged(Queue msgQueue); } diff --git a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/NorthStar.java b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/NorthStar.java index 70cf982..2008888 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/NorthStar.java +++ b/Morse/Android/BottlenoseSender/app/src/main/java/ghww/wcl/NorthStar.java @@ -87,7 +87,7 @@ public List IterateCommands(){ JSONObject commands = jsonObj.getJSONObject("commands"); for (int i = 0; i < commands.length(); i++) { String cName = (String) commands.names().get(i); - JSONObject j = (JSONObject) commands.getJSONObject(cName); + JSONObject j = commands.getJSONObject(cName); GrindhouseCommand ghc = new GrindhouseCommand(); ghc.commandFriendlyName = j.getString("commandFriendlyName"); ghc.commandText = j.getString("commandText"); diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_info_black_24dp.xml b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_info_black_24dp.xml new file mode 100644 index 0000000..34b8202 --- /dev/null +++ b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_info_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 0000000..e3400cf --- /dev/null +++ b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_sync_black_24dp.xml b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_sync_black_24dp.xml new file mode 100644 index 0000000..5a283aa --- /dev/null +++ b/Morse/Android/BottlenoseSender/app/src/main/res/drawable/ic_sync_black_24dp.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/values/arrays.xml b/Morse/Android/BottlenoseSender/app/src/main/res/values/arrays.xml new file mode 100644 index 0000000..8719d16 --- /dev/null +++ b/Morse/Android/BottlenoseSender/app/src/main/res/values/arrays.xml @@ -0,0 +1,13 @@ + + + + + @string/pref_units_label_metric + @string/pref_units_label_imperial + + + + @string/pref_units_metric + @string/pref_units_imperial + + \ No newline at end of file diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/values/dimens.xml b/Morse/Android/BottlenoseSender/app/src/main/res/values/dimens.xml index 47c8224..812cb7b 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/res/values/dimens.xml +++ b/Morse/Android/BottlenoseSender/app/src/main/res/values/dimens.xml @@ -2,4 +2,5 @@ 16dp 16dp + 16dp diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/values/strings.xml b/Morse/Android/BottlenoseSender/app/src/main/res/values/strings.xml index 170c66f..8d8fd91 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/res/values/strings.xml +++ b/Morse/Android/BottlenoseSender/app/src/main/res/values/strings.xml @@ -8,4 +8,97 @@ Time Sender Connection Back + Settings + + + + + General + + Enable social recommendations + Recommendations for people to contact + based on your message history + + + Display name + John Smith + + Add friends to messages + + Always + When possible + Never + + + 1 + 0 + -1 + + + + Data & sync + + Sync frequency + + 15 minutes + 30 minutes + 1 hour + 3 hours + 6 hours + Never + + + 15 + 30 + 60 + 180 + 360 + -1 + + + + Entry 1 + Entry 2 + Entry 3 + + + + 1 + 2 + 3 + + + + + System sync settings + + + Notifications + + New message notifications + + Ringtone + Silent + + Vibrate + pref_key_toggle + toggle_alarm + Send periodic information to Bottlenose + Turn On Updates + 60 + refresh_time + Refresh Time (minutes) + send_time + Send Time + send_temp + Send Temperature + Location + location + 55455 + Temperature Units + Metric + Imperial + units + metric + imperial diff --git a/Morse/Android/BottlenoseSender/app/src/main/res/values/styles.xml b/Morse/Android/BottlenoseSender/app/src/main/res/values/styles.xml index 766ab99..d56db92 100644 --- a/Morse/Android/BottlenoseSender/app/src/main/res/values/styles.xml +++ b/Morse/Android/BottlenoseSender/app/src/main/res/values/styles.xml @@ -5,4 +5,13 @@ + + +