Material theme updates for Bluetooth Device picker.
Bug: 17303554 Change-Id: I6eba8654ffb95ff6a9e31c43f8e2ba93df79280d
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothDevicePicker;
|
||||
@@ -25,6 +24,9 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
@@ -33,6 +35,7 @@ import com.android.settings.R;
|
||||
* connection management.
|
||||
*/
|
||||
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
private static final int MENU_ID_REFRESH = Menu.FIRST;
|
||||
|
||||
public DevicePickerFragment() {
|
||||
super(null /* Not tied to any user restrictions. */);
|
||||
@@ -55,6 +58,29 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
mLaunchClass = intent.getStringExtra(BluetoothDevicePicker.EXTRA_LAUNCH_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
void initDevicePreference(BluetoothDevicePreference preference) {
|
||||
preference.setWidgetLayoutResource(R.layout.preference_empty_list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.add(Menu.NONE, MENU_ID_REFRESH, 0, R.string.bluetooth_search_for_devices)
|
||||
.setEnabled(true)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ID_REFRESH:
|
||||
mLocalAdapter.startScanning(true);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -62,6 +88,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||
mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
|
||||
&& (savedInstanceState == null); // don't start scan after rotation
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user