private void setupButtonsByFlightState() { final State droneState = getDrone().getAttribute(AttributeType.STATE); if (droneState != null && droneState.isConnected()) { if (droneState.isArmed()) { if (droneState.isFlying()) { setupButtonsForFlying(); } else { setupButtonsForArmed(); } } else { setupButtonsForDisarmed(); } } else { setupButtonsForDisconnected(); } }
@Override public boolean isSlidingUpPanelEnabled(Drone drone) { final State droneState = drone.getAttribute(AttributeType.STATE); return droneState.isConnected() && droneState.isArmed() && droneState.isFlying(); }