protected PanelState findNearestPanelStateFromHeight(float desiredPanelHeight){
  PanelState closestPanelState=PanelState.CLOSED;
  float smallestHeightDiff=Float.POSITIVE_INFINITY;
  for (  PanelState state : PanelState.values()) {
    if (!isValidState(state)) {
      continue;
    }
    if (!isFullscreenSizePanel() && state == PanelState.EXPANDED) {
      continue;
    }
    float height=getPanelHeightFromState(state);
    float heightDiff=Math.abs(desiredPanelHeight - height);
    if (heightDiff < smallestHeightDiff) {
      closestPanelState=state;
      smallestHeightDiff=heightDiff;
    }
  }
  return closestPanelState;
}

protected PanelState findNearestPanelStateFromHeight ( float desiredPanelHeight ) { PanelState closestPanelState = PanelState . CLOSED ; float smallestHeightDiff = Float . POSITIVE_INFINITY ; for ( PanelState state : PanelState . values ( ) ) { if ( ! isValidState ( state ) ) { continue ; } if ( ! isFullscreenSizePanel ( ) && state == PanelState . EXPANDED ) { continue ; } float height = getPanelHeightFromState ( state ) ; float heightDiff = Math . abs ( desiredPanelHeight - height ) ; if ( heightDiff < smallestHeightDiff ) { closestPanelState = state ; smallestHeightDiff = heightDiff ; } } return closestPanelState ; }
finds the state which has the nearest height compared to a given | desiredpanelheight | .
