Move device detail edit button from menu to header
Move the edit button on Bluetooth device detail, From action bar menu to header. Use EntityHeaderController to add and control, Rename those method because we use them on more than one place now. Change-Id: I3afad6baeab80895c109603e2ab13428582a4dd8 Fixes: 76206922 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -22,9 +22,6 @@ import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
@@ -41,9 +38,6 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
|
||||
public static final String KEY_DEVICE_ADDRESS = "device_address";
|
||||
private static final String TAG = "BTDeviceDetailsFrg";
|
||||
|
||||
@VisibleForTesting
|
||||
static int EDIT_DEVICE_NAME_ITEM_ID = Menu.FIRST;
|
||||
|
||||
/**
|
||||
* An interface to let tests override the normal mechanism for looking up the
|
||||
* CachedBluetoothDevice and LocalBluetoothManager, and substitute their own mocks instead.
|
||||
@@ -60,9 +54,12 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
|
||||
@VisibleForTesting
|
||||
static TestDataFactory sTestDataFactory;
|
||||
|
||||
private String mDeviceAddress;
|
||||
private LocalBluetoothManager mManager;
|
||||
private CachedBluetoothDevice mCachedDevice;
|
||||
@VisibleForTesting
|
||||
String mDeviceAddress;
|
||||
@VisibleForTesting
|
||||
LocalBluetoothManager mManager;
|
||||
@VisibleForTesting
|
||||
CachedBluetoothDevice mCachedDevice;
|
||||
|
||||
public BluetoothDeviceDetailsFragment() {
|
||||
super(DISALLOW_CONFIG_BLUETOOTH);
|
||||
@@ -117,24 +114,6 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
|
||||
return R.xml.bluetooth_device_details_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
MenuItem item = menu.add(0, EDIT_DEVICE_NAME_ITEM_ID, 0, R.string.bluetooth_rename_button);
|
||||
item.setIcon(R.drawable.ic_mode_edit);
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
if (menuItem.getItemId() == EDIT_DEVICE_NAME_ITEM_ID) {
|
||||
RemoteDeviceNameDialogFragment.newInstance(mCachedDevice).show(
|
||||
getFragmentManager(), RemoteDeviceNameDialogFragment.TAG);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(menuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
ArrayList<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
|
Reference in New Issue
Block a user