Add a confirmation dialog when forgetting BT device

This adds a confirmation dialog for when you hit the "Forget" button to
unpair with a device from the Bluetooth device details page.

Bug: 37955181
Test: make RunSettingsRoboTests
Change-Id: I7643ed09bf363c48078d6de8a47583bf91fc7729
This commit is contained in:
Antony Sargent
2017-06-30 15:23:01 -07:00
parent 6d50576496
commit b6fc6e31a5
4 changed files with 198 additions and 8 deletions

View File

@@ -43,14 +43,19 @@ public class BluetoothDetailsButtonsController extends BluetoothDetailsControlle
mIsConnected = device.isConnected();
}
private void onForgetButtonPressed() {
ForgetDeviceDialogFragment fragment =
ForgetDeviceDialogFragment.newInstance(mCachedDevice.getAddress());
fragment.show(mFragment.getFragmentManager(), ForgetDeviceDialogFragment.TAG);
}
@Override
protected void init(PreferenceScreen screen) {
mActionButtons = (LayoutPreference) screen.findPreference(getPreferenceKey());
Button rightButton = (Button) mActionButtons.findViewById(R.id.right_button);
rightButton.setText(R.string.forget);
rightButton.setOnClickListener((view) -> {
mCachedDevice.unpair();
mFragment.getActivity().finish();
onForgetButtonPressed();
});
}