private static String convertFunctionalColor(String raw,boolean alpha){
  if (!TextUtils.isEmpty(raw)) {
    raw=removeLeadingSpace(raw);
    if ((!alpha && raw.startsWith(FUNCTIONAL_RGB_PREFIX) && !raw.startsWith(FUNCTIONAL_RGBA_PREFIX)) || (alpha && raw.startsWith(FUNCTIONAL_RGBA_PREFIX))) {
      int start=raw.indexOf(OPEN_PAREN);
      int end=raw.lastIndexOf(CLOSE_PAREN);
      if (start != -1 && end != -1) {
        raw=raw.substring(start + 1,end);
        String[] gradients=raw.split(COMMA);
        int gradient_num=alpha ? NUM_FUNC_RGBA_GRADIENT : NUM_FUNC_RGB_GRADIENT;
        if (gradients != null && (gradients.length == gradient_num)) {
          StringBuilder rrggbbBuilder=new StringBuilder(HEX_PREFIX);
          rrggbbBuilder.append(parseRGB(gradients));
          if (alpha) {
            rrggbbBuilder.insert(1,parseAlpha(gradients[NUM_FUNC_RGBA_GRADIENT - 1]));
          }
          return rrggbbBuilder.toString();
        }
      }
    }
  }
  return null;
}

private static String convertFunctionalColor ( String raw , boolean alpha ) { if ( ! TextUtils . isEmpty ( raw ) ) { raw = removeLeadingSpace ( raw ) ; if ( ( ! alpha && raw . startsWith ( FUNCTIONAL_RGB_PREFIX ) && ! raw . startsWith ( FUNCTIONAL_RGBA_PREFIX ) ) || ( alpha && raw . startsWith ( FUNCTIONAL_RGBA_PREFIX ) ) ) { int start = raw . indexOf ( OPEN_PAREN ) ; int end = raw . lastIndexOf ( CLOSE_PAREN ) ; if ( start != - 1 && end != - 1 ) { raw = raw . substring ( start + 1 , end ) ; String [ ] gradients = raw . split ( COMMA ) ; int gradient_num = alpha ? NUM_FUNC_RGBA_GRADIENT : NUM_FUNC_RGB_GRADIENT ; if ( gradients != null && ( gradients . length == gradient_num ) ) { StringBuilder rrggbbBuilder = new StringBuilder ( HEX_PREFIX ) ; rrggbbBuilder . append ( parseRGB ( gradients ) ) ; if ( alpha ) { rrggbbBuilder . insert ( 1 , parseAlpha ( gradients [ NUM_FUNC_RGBA_GRADIENT - 1 ] ) ) ; } return rrggbbBuilder . toString ( ) ; } } } } return null ; }
parse a functional rgb to # rrggbb or functional rgba to # aarrggbb
