If Bluetooth is enabled but not discoverable, warn but continue.

This commit is contained in:
akwizgran
2013-03-11 13:56:12 +00:00
parent 787c428874
commit 78ccebf357

View File

@@ -39,7 +39,7 @@ public class BluetoothWidget extends LinearLayout implements OnClickListener {
status.setPadding(10, 10, 10, 10);
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if(adapter == null) {
bluetoothStateChanged(false);
listener.bluetoothStateChanged(false);
ImageView warning = new ImageView(ctx);
warning.setImageResource(R.drawable.alerts_and_states_warning);
warning.setPadding(10, 10, 10, 10);
@@ -47,7 +47,7 @@ public class BluetoothWidget extends LinearLayout implements OnClickListener {
status.setText(R.string.bluetooth_not_available);
addView(status);
} else if(adapter.getScanMode() == SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
bluetoothStateChanged(true);
listener.bluetoothStateChanged(true);
ImageView ok = new ImageView(ctx);
ok.setImageResource(R.drawable.navigation_accept);
ok.setPadding(10, 10, 10, 10);
@@ -59,7 +59,7 @@ public class BluetoothWidget extends LinearLayout implements OnClickListener {
settings.setOnClickListener(this);
addView(settings);
} else if(adapter.isEnabled()) {
bluetoothStateChanged(false);
listener.bluetoothStateChanged(true);
ImageView warning = new ImageView(ctx);
warning.setImageResource(R.drawable.alerts_and_states_warning);
warning.setPadding(10, 10, 10, 10);
@@ -71,7 +71,7 @@ public class BluetoothWidget extends LinearLayout implements OnClickListener {
settings.setOnClickListener(this);
addView(settings);
} else {
bluetoothStateChanged(false);
listener.bluetoothStateChanged(false);
ImageView warning = new ImageView(ctx);
warning.setImageResource(R.drawable.alerts_and_states_warning);
warning.setPadding(10, 10, 10, 10);
@@ -85,10 +85,6 @@ public class BluetoothWidget extends LinearLayout implements OnClickListener {
}
}
private void bluetoothStateChanged(boolean enabled) {
listener.bluetoothStateChanged(enabled);
}
public void onClick(View view) {
getContext().startActivity(new Intent(ACTION_BLUETOOTH_SETTINGS));
}