codacy: These nested if statements could be combined

This commit is contained in:
AndyScherzinger 2018-02-21 21:59:38 +01:00
parent 4440e1e192
commit c6de6bdf28
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
4 changed files with 25 additions and 29 deletions

View File

@ -146,13 +146,12 @@ public class CallsListController extends BaseController implements SearchView.On
userEntity = userUtils.getCurrentUser();
if (userEntity == null) {
if (getParentController() != null && getParentController().getRouter() != null) {
if (userEntity == null &&
getParentController() != null && getParentController().getRouter() != null) {
getParentController().getRouter().setRoot((RouterTransaction.with(new ServerSelectionController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler())));
}
}
if (adapter == null) {
adapter = new FlexibleAdapter<>(callItems, getActivity(), false);
@ -359,12 +358,11 @@ public class CallsListController extends BaseController implements SearchView.On
private void dispose(@Nullable Disposable disposable) {
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
} else if (disposable == null) {
if (roomsQueryDisposable != null && !roomsQueryDisposable.isDisposed()) {
} else if (disposable == null &&
roomsQueryDisposable != null && !roomsQueryDisposable.isDisposed() {
roomsQueryDisposable.dispose();
roomsQueryDisposable = null;
}
}
}

View File

@ -184,20 +184,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ
userEntity = userUtils.getCurrentUser();
if (userEntity == null) {
if (getParentController().getRouter() != null) {
if (userEntity == null &&
getParentController() != null && getParentController().getRouter() != null) {
getParentController().getRouter().setRoot((RouterTransaction.with(new ServerSelectionController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler())));
}
}
if (adapter == null) {
adapter = new FlexibleAdapter<>(contactItems, getActivity(), false);
adapter.setNotifyChangeOfUnfilteredItems(true)
.setMode(SelectableAdapter.Mode.MULTI);
if (userEntity != null) {
fetchData();
}

View File

@ -545,9 +545,10 @@ public class MagicAudioManager {
bluetoothManager.updateDevice();
}
if (needBluetoothAudioStart && !needBluetoothAudioStop) {
// Attempt to start Bluetooth SCO audio (takes a few second to start).
if (!bluetoothManager.startScoAudio()) {
if (needBluetoothAudioStart &&
!needBluetoothAudioStop &&
!bluetoothManager.startScoAudio()) {
// Remove BLUETOOTH from list of available devices since SCO failed.
audioDevices.remove(AudioDevice.BLUETOOTH);
audioDeviceSetUpdated = true;

View File

@ -111,12 +111,11 @@ public class MagicProximitySensor implements SensorEventListener {
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
if (sensor.getType() == Sensor.TYPE_PROXIMITY) {
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
if (sensor.getType() == Sensor.TYPE_PROXIMITY &&
accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
}
@Override
public final void onSensorChanged(SensorEvent event) {