@@ -790,9 +790,10 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
790790 case RESULT_OK :
791791 if (activityState == PairingActivityState .STATE_ENABLE_BT_FOR_PAIRING ) {
792792 proceedAfterBlePermissionGranted ();
793- } else if (activityState == PairingActivityState .STATE_ENABLE_BT_FOR_CONNECT ) {
794- toggleConnection ();
795793 }
794+ // else if (activityState == PairingActivityState.STATE_ENABLE_BT_FOR_CONNECT) {
795+ // toggleConnection();
796+ // }
796797 break ;
797798 case RESULT_CANCELED :
798799 //Change state back to Idle
@@ -1139,37 +1140,37 @@ public void startWithPairing() {
11391140 /**
11401141 * Enables or disables connection with a currently paired micro:bit board.
11411142 */
1142- public void toggleConnection () {
1143- ConnectedDevice currentDevice = BluetoothUtils .getPairedMicrobit (this );
1144- Log .v (TAG , "currentDevice.toString()" );
1145-
1146- if (currentDevice .mAddress != null ) {
1147- boolean currentState = currentDevice .mStatus ;
1148-
1149- if (!currentState ) {
1150- setActivityState (PairingActivityState .STATE_CONNECTING );
1151- requestPermissions .clear ();
1152- PopUp .show (getString (R .string .init_connection ),
1153- "" ,
1154- R .drawable .message_face , R .drawable .blue_btn ,
1155- PopUp .GIFF_ANIMATION_NONE ,
1156- PopUp .TYPE_SPINNER ,
1157- null , null );
1158-
1159- ServiceUtils .sendConnectDisconnectMessage (true );
1160- } else {
1161- setActivityState (PairingActivityState .STATE_DISCONNECTING );
1162- PopUp .show (getString (R .string .disconnecting ),
1163- "" ,
1164- R .drawable .message_face , R .drawable .blue_btn ,
1165- PopUp .GIFF_ANIMATION_NONE ,
1166- PopUp .TYPE_SPINNER ,
1167- null , null );
1168-
1169- ServiceUtils .sendConnectDisconnectMessage (false );
1170- }
1171- }
1172- }
1143+ // private void toggleConnection() {
1144+ // ConnectedDevice currentDevice = BluetoothUtils.getPairedMicrobit(this);
1145+ // Log.v(TAG, "currentDevice.toString()");
1146+ //
1147+ // if(currentDevice.mAddress != null) {
1148+ // boolean currentState = currentDevice.mStatus;
1149+ //
1150+ // if(!currentState) {
1151+ // setActivityState(PairingActivityState.STATE_CONNECTING);
1152+ // requestPermissions.clear();
1153+ // PopUp.show(getString(R.string.init_connection),
1154+ // "",
1155+ // R.drawable.message_face, R.drawable.blue_btn,
1156+ // PopUp.GIFF_ANIMATION_NONE,
1157+ // PopUp.TYPE_SPINNER,
1158+ // null, null);
1159+ //
1160+ // ServiceUtils.sendConnectDisconnectMessage(true);
1161+ // } else {
1162+ // setActivityState(PairingActivityState.STATE_DISCONNECTING);
1163+ // PopUp.show(getString(R.string.disconnecting),
1164+ // "",
1165+ // R.drawable.message_face, R.drawable.blue_btn,
1166+ // PopUp.GIFF_ANIMATION_NONE,
1167+ // PopUp.TYPE_SPINNER,
1168+ // null, null);
1169+ //
1170+ // ServiceUtils.sendConnectDisconnectMessage(false);
1171+ // }
1172+ // }
1173+ // }
11731174
11741175 @ Override
11751176 public void onRequestPermissionsResult (int requestCode , @ NonNull String permissions [],
@@ -1326,12 +1327,12 @@ public void onClick(final View v) {
13261327 logi ("onClick() :: connectBtn" );
13271328 Toast .makeText (MBApp .getApp (), getString (R .string .no_longer_required_to_connect ), Toast .LENGTH_LONG ).show ();
13281329
1329- if (!BluetoothChecker .getInstance ().isBluetoothON ()) {
1330- setActivityState (PairingActivityState .STATE_ENABLE_BT_FOR_CONNECT );
1331- enableBluetooth ();
1332- return ;
1333- }
1334- toggleConnection ();
1330+ // if(!BluetoothChecker.getInstance().isBluetoothON()) {
1331+ // setActivityState(PairingActivityState.STATE_ENABLE_BT_FOR_CONNECT);
1332+ // enableBluetooth();
1333+ // return;
1334+ // }
1335+ // toggleConnection();
13351336 break ;
13361337
13371338 //TODO: there is no ability to delete paired device on Connect screen, so add or remove the case.
0 commit comments