private void computeProximityThreshold(Keyboard keyboard){
  if (keyboard == null)   return;
  final Key[] keys=mKeys;
  if (keys == null)   return;
  int length=keys.length;
  int dimensionSum=0;
  for (int i=0; i < length; i++) {
    Key key=keys[i];
    dimensionSum+=Math.min(key.width,key.height + mKeyboardVerticalGap) + key.gap;
  }
  if (dimensionSum < 0 || length == 0)   return;
  mKeyDetector.setProximityThreshold((int)(dimensionSum * 1.4f / length));
}

private void computeProximityThreshold ( Keyboard keyboard ) { if ( keyboard == null ) return ; final Key [ ] keys = mKeys ; if ( keys == null ) return ; int length = keys . length ; int dimensionSum = 0 ; for ( int i = 0 ; i < length ; i ++ ) { Key key = keys [ i ] ; dimensionSum += Math . min ( key . width , key . height + mKeyboardVerticalGap ) + key . gap ; } if ( dimensionSum < 0 || length == 0 ) return ; mKeyDetector . setProximityThreshold ( ( int ) ( dimensionSum * 1.4f / length ) ) ; }
compute the average distance between adjacent keys ( horizontally and vertically ) and square it to get the proximity threshold . we use a square here and in computing the touch distance from a key ' s center to avoid taking a square root .
