diff --git a/Application/src/main/AndroidManifest.xml b/Application/src/main/AndroidManifest.xml index d16069c..ed8e98a 100644 --- a/Application/src/main/AndroidManifest.xml +++ b/Application/src/main/AndroidManifest.xml @@ -35,7 +35,8 @@ + android:label="@string/app_name" android:launchMode="singleTop"> + @@ -47,6 +48,6 @@ android:configChanges="orientation|keyboardHidden" android:label="@string/select_device" android:theme="@android:style/Theme.Holo.Dialog"/> - + diff --git a/Application/src/main/java/org/surfsite/iconsole/BluetoothChatFragment.java b/Application/src/main/java/org/surfsite/iconsole/BluetoothChatFragment.java index d044d11..bd97e2e 100644 --- a/Application/src/main/java/org/surfsite/iconsole/BluetoothChatFragment.java +++ b/Application/src/main/java/org/surfsite/iconsole/BluetoothChatFragment.java @@ -53,7 +53,6 @@ public class BluetoothChatFragment extends Fragment { // Intent request codes private static final int REQUEST_CONNECT_DEVICE_SECURE = 1; - private static final int REQUEST_CONNECT_DEVICE_INSECURE = 2; private static final int REQUEST_ENABLE_BT = 3; // Layout Views @@ -159,9 +158,9 @@ public class BluetoothChatFragment extends Fragment { mStopButton = (Button) view.findViewById(R.id.button_stop); mDisconnectButton = (Button) view.findViewById(R.id.button_disconnect); mLevel = (NumberPicker) view.findViewById(R.id.Level); - mLevel.setMaxValue(16); + mLevel.setMaxValue(32); mLevel.setMinValue(1); - mLevel.setValue(5); + mLevel.setValue(1); mLevel.setWrapSelectorWheel(false); mLevel.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS); mSpeedText = (TextView) view.findViewById(R.id.Speed); @@ -411,12 +410,6 @@ public class BluetoothChatFragment extends Fragment { connectDevice(data, true); } break; - case REQUEST_CONNECT_DEVICE_INSECURE: - // When DeviceListActivity returns with a device to connect - if (resultCode == Activity.RESULT_OK) { - connectDevice(data, false); - } - break; case REQUEST_ENABLE_BT: // When the request to enable Bluetooth returns if (resultCode == Activity.RESULT_OK) { @@ -463,17 +456,6 @@ public class BluetoothChatFragment extends Fragment { startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE); return true; } - case R.id.insecure_connect_scan: { - // Launch the DeviceListActivity to see devices and do scan - Intent serverIntent = new Intent(getActivity(), DeviceListActivity.class); - startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE); - return true; - } - case R.id.discoverable: { - // Ensure this device is discoverable by others - ensureDiscoverable(); - return true; - } } return false; } diff --git a/Application/src/main/java/org/surfsite/iconsole/BluetoothChatService.java b/Application/src/main/java/org/surfsite/iconsole/BluetoothChatService.java index c598eb0..4a0e6b5 100644 --- a/Application/src/main/java/org/surfsite/iconsole/BluetoothChatService.java +++ b/Application/src/main/java/org/surfsite/iconsole/BluetoothChatService.java @@ -196,10 +196,12 @@ public class BluetoothChatService extends Service { private void showNotification() { // In this sample, we'll use the same text for the ticker and the expanded notification CharSequence text = getText(R.string.local_service_started); + Intent myIntent = new Intent(getApplicationContext(), MainActivity.class); + myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // The PendingIntent to launch our activity if the user selects this notification - PendingIntent contentIntent = PendingIntent.getActivity(this, 0, - new Intent(this, MainActivity.class), 0); + PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, + myIntent, 0); // Set the info for the views that show in the notification panel. Notification notification = new Notification.Builder(this) diff --git a/Application/src/main/java/org/surfsite/iconsole/MainActivity.java b/Application/src/main/java/org/surfsite/iconsole/MainActivity.java index 734326b..6e26949 100644 --- a/Application/src/main/java/org/surfsite/iconsole/MainActivity.java +++ b/Application/src/main/java/org/surfsite/iconsole/MainActivity.java @@ -68,59 +68,6 @@ public class MainActivity extends FragmentActivity { Log.i(TAG, "Service started"); } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - MenuItem logToggle = menu.findItem(R.id.menu_toggle_log); - //logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator); - logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log); - - return super.onPrepareOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - /* - switch(item.getItemId()) { - case R.id.menu_toggle_log: - mLogShown = !mLogShown; - ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output); - if (mLogShown) { - output.setDisplayedChild(1); - } else { - output.setDisplayedChild(0); - } - supportInvalidateOptionsMenu(); - return true; - } - */ - return super.onOptionsItemSelected(item); - } -/* - public void initializeLogging() { - // Wraps Android's native log framework. - LogWrapper logWrapper = new LogWrapper(); - // Using Log, front-end to the logging chain, emulates android.util.log method signatures. - Log.setLogNode(logWrapper); - - // Filter strips out everything except the message text. - MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter(); - logWrapper.setNext(msgFilter); - - // On screen logging via a fragment with a TextView. - LogFragment logFragment = (LogFragment) getSupportFragmentManager() - .findFragmentById(R.id.log_fragment); - msgFilter.setNext(logFragment.getLogView()); - - Log.i(TAG, "Ready"); - } - */ - @Override protected void onDestroy() { stopService(new Intent(this, BluetoothChatService.class)); diff --git a/Application/src/main/res/layout/fragment_bluetooth_chat.xml b/Application/src/main/res/layout/fragment_bluetooth_chat.xml index 3d549a0..95338db 100644 --- a/Application/src/main/res/layout/fragment_bluetooth_chat.xml +++ b/Application/src/main/res/layout/fragment_bluetooth_chat.xml @@ -27,85 +27,87 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RPM" - android:layout_marginBottom="8dp" - app:layout_constraintBottom_toTopOf="@+id/RPM" - app:layout_constraintRight_toLeftOf="@+id/guideline" + app:layout_constraintRight_toLeftOf="@+id/guidelineright" android:layout_marginRight="16dp" android:layout_marginLeft="16dp" - app:layout_constraintLeft_toLeftOf="@+id/guideline3" - app:layout_constraintTop_toTopOf="@+id/guideline6" - android:layout_marginTop="16dp" /> + app:layout_constraintLeft_toLeftOf="@+id/guidelineleft" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + app:layout_constraintBaseline_toBaselineOf="@+id/textView7" /> + android:layout_marginTop="16dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" /> + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + app:layout_constraintBaseline_toBaselineOf="@+id/textView4" /> + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + app:layout_constraintBaseline_toBaselineOf="@+id/textView3" /> + android:layout_marginTop="16dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" /> + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp"/> + app:layout_constraintTop_toTopOf="parent" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" /> + app:layout_constraintTop_toTopOf="@+id/guideline5" + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintTop_toTopOf="parent" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" /> + app:layout_constraintRight_toLeftOf="@+id/guidelineleft" + app:layout_constraintTop_toTopOf="@+id/guideline4" + android:layout_marginStart="16dp" /> + app:layout_constraintLeft_toLeftOf="@+id/guidelineleft" + app:layout_constraintRight_toLeftOf="@+id/guidelineright" + app:layout_constraintBaseline_toBaselineOf="@+id/Calories" /> + app:layout_constraintLeft_toLeftOf="@+id/guidelineleft" + app:layout_constraintRight_toLeftOf="@+id/guidelineright" + app:layout_constraintBaseline_toBaselineOf="@+id/Power" /> + + + android:text="@string/level" + app:layout_constraintBottom_toTopOf="@+id/guideline5" + app:layout_constraintHorizontal_bias="0.509" + app:layout_constraintLeft_toLeftOf="@+id/guidelineright" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + tools:layout_editor_absoluteX="154dp" /> + tools:layout_editor_absoluteX="307dp" /> - - - - - - diff --git a/Application/src/main/res/menu/main.xml b/Application/src/main/res/menu/main.xml deleted file mode 100644 index b49c2c5..0000000 --- a/Application/src/main/res/menu/main.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - -