我正在使用 Eclipse 进行 Android 开发,并且我已经设置了我的代码格式化样式,但仍然有我无法弄清楚如何在 Eclipse 中格式化的匿名方法。这就是 Eclipse 现在格式化匿名方法的方式:
// The BroadcastReceiver that listens for discovered devices and
// changes the title when discovery is finished
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Utils.Log.i("BLUETOOTH: " + action);
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the
// BluetoothDevice
// object from the
// Intent
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// If it's already
// paired, skip it,
// because it's been
// listed already
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
if (mNewDevicesArrayAdapter.getCount() == 0) {
mNewDevicesArrayAdapter.add(device);
}
btDevicesUpdateList.add(device);
}
}
else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
mNewDevicesArrayAdapter.setItems(btDevicesUpdateList);
mNewDevicesArrayAdapter.notifyDataSetChanged();
btDevicesUpdateList.clear();
mBtAdapter.startDiscovery();
}
else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
if (mBtAdapter.getState() == BluetoothAdapter.STATE_ON) {
switchToView(viewBluetoothOn);
firstTimeDiscover();
}
else if (mBtAdapter.getState() == BluetoothAdapter.STATE_OFF) {
switchToView(viewBluetoothOff);
}
}
}
};
看?它非常糟糕。将匿名方法声明格式化为保留在左侧并且不在=
等号下的正确设置是什么?