Merge "Tapping a connected Bluetooth device now presents its settings dialog." into lmp-dev

This commit is contained in:
PauloftheWest
2014-08-25 15:48:15 +00:00
committed by Android (Google) Code Review

View File

@@ -56,6 +56,8 @@ public final class BluetoothDevicePreference extends Preference implements
private AlertDialog mDisconnectDialog; private AlertDialog mDisconnectDialog;
private View mView;
public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) { public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) {
super(context); super(context);
@@ -140,6 +142,7 @@ public final class BluetoothDevicePreference extends Preference implements
} }
} }
mView = view;
super.onBindView(view); super.onBindView(view);
} }
@@ -179,7 +182,10 @@ public final class BluetoothDevicePreference extends Preference implements
int bondState = mCachedDevice.getBondState(); int bondState = mCachedDevice.getBondState();
if (mCachedDevice.isConnected()) { if (mCachedDevice.isConnected()) {
askDisconnect(); if (mOnSettingsClickListener != null) {
mView.setTag(mCachedDevice);
mOnSettingsClickListener.onClick(mView);
}
} else if (bondState == BluetoothDevice.BOND_BONDED) { } else if (bondState == BluetoothDevice.BOND_BONDED) {
mCachedDevice.connect(true); mCachedDevice.connect(true);
} else if (bondState == BluetoothDevice.BOND_NONE) { } else if (bondState == BluetoothDevice.BOND_NONE) {