BLE peripheral mode (4/4): Settings change for advertising preference.
Change-Id: I5721f136267fe25e55f764bb4a6c53acd45b318b
This commit is contained in:
@@ -51,9 +51,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
|
||||
private static final String TAG = "BluetoothSettings";
|
||||
|
||||
private static final int MENU_ID_SCAN = Menu.FIRST;
|
||||
private static final int MENU_ID_RENAME_DEVICE = Menu.FIRST + 1;
|
||||
private static final int MENU_ID_VISIBILITY_TIMEOUT = Menu.FIRST + 2;
|
||||
private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 3;
|
||||
private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 1;
|
||||
|
||||
/* Private intent to show the list of received files */
|
||||
private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES =
|
||||
@@ -178,12 +176,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
|
||||
menu.add(Menu.NONE, MENU_ID_SCAN, 0, textId)
|
||||
.setEnabled(bluetoothIsEnabled && !isDiscovering)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(Menu.NONE, MENU_ID_RENAME_DEVICE, 0, R.string.bluetooth_rename_device)
|
||||
.setEnabled(bluetoothIsEnabled)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
menu.add(Menu.NONE, MENU_ID_VISIBILITY_TIMEOUT, 0, R.string.bluetooth_visibility_timeout)
|
||||
.setEnabled(bluetoothIsEnabled)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
@@ -198,16 +190,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
|
||||
}
|
||||
return true;
|
||||
|
||||
case MENU_ID_RENAME_DEVICE:
|
||||
new BluetoothNameDialogFragment().show(
|
||||
getFragmentManager(), "rename device");
|
||||
return true;
|
||||
|
||||
case MENU_ID_VISIBILITY_TIMEOUT:
|
||||
new BluetoothVisibilityTimeoutFragment().show(
|
||||
getFragmentManager(), "visibility timeout");
|
||||
return true;
|
||||
|
||||
case MENU_ID_SHOW_RECEIVED:
|
||||
Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES);
|
||||
getActivity().sendBroadcast(intent);
|
||||
@@ -252,7 +234,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
|
||||
|
||||
// This device
|
||||
if (mMyDevicePreference == null) {
|
||||
mMyDevicePreference = new Preference(getActivity());
|
||||
mMyDevicePreference = new BluetoothLocalDevicePreference(
|
||||
getActivity(), mLocalDeviceProfilesListener);
|
||||
}
|
||||
mMyDevicePreference.setTitle(mLocalAdapter.getName());
|
||||
if (getResources().getBoolean(com.android.internal.R.bool.config_voice_capable)) {
|
||||
@@ -360,6 +343,18 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
|
||||
updateContent(mLocalAdapter.getBluetoothState(), false);
|
||||
}
|
||||
|
||||
// Listener for local device profile fragment.
|
||||
private final View.OnClickListener mLocalDeviceProfilesListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
if (isRestrictedAndNotPinProtected()) return;
|
||||
|
||||
((PreferenceActivity) getActivity()).startPreferencePanel(
|
||||
LocalDeviceProfilesSettings.class.getName(), null,
|
||||
0, mLocalAdapter.getName(), null, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private final View.OnClickListener mDeviceProfilesListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// User clicked on advanced options icon for a device in the list
|
||||
|
Reference in New Issue
Block a user