Program: 28515
Project: 28515
Buggy source:
protected void registerAttributeProcessors(){
  addAttributeProcessor(Attributes.View.OnClick,new EventProcessor<V>(){
    @Override public void setOnEventListener(    final V view,    final Value value){
      view.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          fireEvent((ProteusView)view,EventType.OnClick,value);
        }
      }
);
    }
  }
);
  addAttributeProcessor(Attributes.View.Background,new DrawableResourceProcessor<V>(){
    @Override public void setDrawable(    V view,    Drawable drawable){
      if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        view.setBackgroundDrawable(drawable);
      }
 else {
        view.setBackground(drawable);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Height,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams != null) {
        layoutParams.height=(int)dimension;
        view.setLayoutParams(layoutParams);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Width,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams != null) {
        layoutParams.width=(int)dimension;
        view.setLayoutParams(layoutParams);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Weight,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      LinearLayout.LayoutParams layoutParams;
      if (view.getLayoutParams() instanceof LinearLayout.LayoutParams) {
        layoutParams=(LinearLayout.LayoutParams)view.getLayoutParams();
        layoutParams.weight=ParseHelper.parseFloat(value);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.LayoutGravity,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams instanceof LinearLayout.LayoutParams) {
        LinearLayout.LayoutParams linearLayoutParams=(LinearLayout.LayoutParams)layoutParams;
        linearLayoutParams.gravity=ParseHelper.parseGravity(value);
        view.setLayoutParams(layoutParams);
      }
 else       if (layoutParams instanceof FrameLayout.LayoutParams) {
        FrameLayout.LayoutParams linearLayoutParams=(FrameLayout.LayoutParams)layoutParams;
        linearLayoutParams.gravity=ParseHelper.parseGravity(value);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Padding,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding((int)dimension,(int)dimension,(int)dimension,(int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingLeft,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding((int)dimension,view.getPaddingTop(),view.getPaddingRight(),view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingTop,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),(int)dimension,view.getPaddingRight(),view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingRight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),view.getPaddingTop(),(int)dimension,view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingBottom,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),view.getPaddingTop(),view.getPaddingRight(),(int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.Margin,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins((int)dimension,(int)dimension,(int)dimension,(int)dimension);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginLeft,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins((int)dimension,layoutParams.topMargin,layoutParams.rightMargin,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginTop,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,(int)dimension,layoutParams.rightMargin,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginRight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,layoutParams.topMargin,(int)dimension,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginBottom,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,layoutParams.topMargin,layoutParams.rightMargin,(int)dimension);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MinHeight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setMinimumHeight((int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.MinWidth,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setMinimumWidth((int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.Elevation,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        view.setElevation(dimension);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Alpha,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setAlpha(ParseHelper.parseFloat(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Visibility,new AttributeProcessor<V>(){
    @Override public void handle(    V view,    Value value){
      view.setVisibility(ParseHelper.parseVisibility(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Invisibility,new AttributeProcessor<V>(){
    @Override public void handle(    V view,    Value value){
      view.setVisibility(ParseHelper.parseInvisibility(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Id,new StringAttributeProcessor<V>(){
    @Override public void handle(    final V view,    String value){
      if (view instanceof ProteusView) {
        view.setId(((ProteusView)view).getViewManager().getUniqueViewId(value));
      }
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        final String resourceName=value;
        view.setAccessibilityDelegate(new View.AccessibilityDelegate(){
          @Override public void onInitializeAccessibilityNodeInfo(          View host,          AccessibilityNodeInfo info){
            super.onInitializeAccessibilityNodeInfo(host,info);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
              String normalizedResourceName;
              if (!TextUtils.isEmpty(resourceName)) {
                String id;
                if (resourceName.startsWith(ID_STRING_START_PATTERN)) {
                  id=resourceName.substring(ID_STRING_START_PATTERN.length());
                }
 else                 if (resourceName.startsWith(ID_STRING_START_PATTERN1)) {
                  id=resourceName.substring(ID_STRING_START_PATTERN1.length());
                }
 else {
                  id=resourceName;
                }
                normalizedResourceName=view.getContext().getPackageName() + ID_STRING_NORMALIZED_PATTERN + id;
              }
 else {
                normalizedResourceName="String_Node_Str";
              }
              info.setViewIdResourceName(normalizedResourceName);
            }
          }
        }
);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.ContentDescription,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setContentDescription(value);
    }
  }
);
  addAttributeProcessor(Attributes.View.Clickable,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      boolean clickable=ParseHelper.parseBoolean(value);
      view.setClickable(clickable);
    }
  }
);
  addAttributeProcessor(Attributes.View.Tag,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setTag(value);
    }
  }
);
  addAttributeProcessor(Attributes.View.Enabled,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      boolean enabled=ParseHelper.parseBoolean(value);
      view.setEnabled(enabled);
    }
  }
);
  addAttributeProcessor(Attributes.View.Style,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      ProteusViewManager viewManager=((ProteusView)view).getViewManager();
      Layout layout=viewManager.getLayout();
      Styles styles=viewManager.getStyles();
      TypeParser handler=viewManager.getProteusLayoutInflater().getParser(layout.type);
      if (styles == null) {
        return;
      }
      String[] styleSet=value.split(ProteusConstants.STYLE_DELIMITER);
      for (      String styleName : styleSet) {
        if (styles.contains(styleName)) {
          process(styles.getStyle(styleName),layout,(ProteusView)view,(handler != null ? handler : ViewParser.this),viewManager.getProteusLayoutInflater());
        }
      }
    }
    private void process(    Map<Integer,Value> style,    Layout layout,    ProteusView proteusView,    TypeParser handler,    ProteusLayoutInflater builder){
      for (      Map.Entry<Integer,Value> entry : style.entrySet()) {
        builder.handleAttribute(handler,proteusView,entry.getKey(),entry.getValue());
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.TransitionName,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        view.setTransitionName(value);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.RequiresFadingEdge,new StringAttributeProcessor<V>(){
    private final String NONE="String_Node_Str";
    private final String BOTH="String_Node_Str";
    private final String VERTICAL="String_Node_Str";
    private final String HORIZONTAL="String_Node_Str";
    @Override public void handle(    V view,    String value){
switch (value) {
case NONE:
        view.setVerticalFadingEdgeEnabled(false);
      view.setHorizontalFadingEdgeEnabled(false);
    break;
case BOTH:
  view.setVerticalFadingEdgeEnabled(true);
view.setHorizontalFadingEdgeEnabled(true);
break;
case VERTICAL:
view.setVerticalFadingEdgeEnabled(true);
view.setHorizontalFadingEdgeEnabled(false);
break;
case HORIZONTAL:
view.setVerticalFadingEdgeEnabled(false);
view.setHorizontalFadingEdgeEnabled(true);
break;
default :
view.setVerticalFadingEdgeEnabled(false);
view.setHorizontalFadingEdgeEnabled(false);
break;
}
}
}
);
addAttributeProcessor(Attributes.View.FadingEdgeLength,new StringAttributeProcessor<V>(){
@Override public void handle(V view,String value){
view.setFadingEdgeLength(ParseHelper.parseInt(value));
}
}
);
addAttributeProcessor(Attributes.View.Animation,new TweenAnimationResourceProcessor<V>(){
@Override public void setAnimation(V view,Animation animation){
view.setAnimation(animation);
}
}
);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.TextAlignment,new StringAttributeProcessor<V>(){
@SuppressLint("String_Node_Str") @Override public void handle(V view,String value){
Integer textAlignment=ParseHelper.parseTextAlignment(value);
if (null != textAlignment) {
view.setTextAlignment(textAlignment);
}
}
}
);
}
final HashMap<String,Integer> relativeLayoutParams=new HashMap<>();
relativeLayoutParams.put(Attributes.View.AlignBaseline.getName(),RelativeLayout.ALIGN_BASELINE);
relativeLayoutParams.put(Attributes.View.AlignBottom.getName(),RelativeLayout.ALIGN_BOTTOM);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.AlignEnd.getName(),RelativeLayout.ALIGN_END);
}
relativeLayoutParams.put(Attributes.View.AlignLeft.getName(),RelativeLayout.ALIGN_LEFT);
relativeLayoutParams.put(Attributes.View.AlignRight.getName(),RelativeLayout.ALIGN_RIGHT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.AlignStart.getName(),RelativeLayout.ALIGN_START);
}
relativeLayoutParams.put(Attributes.View.AlignTop.getName(),RelativeLayout.ALIGN_TOP);
relativeLayoutParams.put(Attributes.View.Below.getName(),RelativeLayout.BELOW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.ToEndOf.getName(),RelativeLayout.END_OF);
}
relativeLayoutParams.put(Attributes.View.ToLeftOf.getName(),RelativeLayout.LEFT_OF);
relativeLayoutParams.put(Attributes.View.ToRightOf.getName(),RelativeLayout.RIGHT_OF);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.ToStartOf.getName(),RelativeLayout.START_OF);
}
addAttributeProcessor(Attributes.View.Above,createRelativeLayoutRuleProcessor(RelativeLayout.ABOVE));
addAttributeProcessor(Attributes.View.AlignBaseline,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_BASELINE));
addAttributeProcessor(Attributes.View.AlignBottom,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_BOTTOM));
addAttributeProcessor(Attributes.View.AlignLeft,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_LEFT));
addAttributeProcessor(Attributes.View.AlignRight,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_RIGHT));
addAttributeProcessor(Attributes.View.AlignTop,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_TOP));
addAttributeProcessor(Attributes.View.Below,createRelativeLayoutRuleProcessor(RelativeLayout.BELOW));
addAttributeProcessor(Attributes.View.ToLeftOf,createRelativeLayoutRuleProcessor(RelativeLayout.LEFT_OF));
addAttributeProcessor(Attributes.View.ToRightOf,createRelativeLayoutRuleProcessor(RelativeLayout.RIGHT_OF));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.AlignEnd,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_END));
addAttributeProcessor(Attributes.View.AlignStart,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_START));
addAttributeProcessor(Attributes.View.ToEndOf,createRelativeLayoutRuleProcessor(RelativeLayout.END_OF));
addAttributeProcessor(Attributes.View.ToStartOf,createRelativeLayoutRuleProcessor(RelativeLayout.START_OF));
}
relativeLayoutParams.put(Attributes.View.CenterHorizontal.getName(),RelativeLayout.CENTER_HORIZONTAL);
relativeLayoutParams.put(Attributes.View.CenterInParent.getName(),RelativeLayout.CENTER_IN_PARENT);
relativeLayoutParams.put(Attributes.View.CenterVertical.getName(),RelativeLayout.CENTER_VERTICAL);
relativeLayoutParams.put(Attributes.View.AlignParentTop.getName(),RelativeLayout.ALIGN_PARENT_TOP);
relativeLayoutParams.put(Attributes.View.AlignParentBottom.getName(),RelativeLayout.ALIGN_PARENT_BOTTOM);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.AlignParentEnd.getName(),RelativeLayout.ALIGN_PARENT_END);
}
relativeLayoutParams.put(Attributes.View.AlignParentLeft.getName(),RelativeLayout.ALIGN_PARENT_LEFT);
relativeLayoutParams.put(Attributes.View.AlignParentRight.getName(),RelativeLayout.ALIGN_PARENT_RIGHT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
relativeLayoutParams.put(Attributes.View.AlignParentStart.getName(),RelativeLayout.ALIGN_PARENT_START);
}
addAttributeProcessor(Attributes.View.AlignParentBottom,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_HORIZONTAL));
addAttributeProcessor(Attributes.View.AlignParentEnd,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_IN_PARENT));
addAttributeProcessor(Attributes.View.AlignParentLeft,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_VERTICAL));
addAttributeProcessor(Attributes.View.AlignParentRight,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_TOP));
addAttributeProcessor(Attributes.View.AlignParentStart,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_BOTTOM));
addAttributeProcessor(Attributes.View.CenterHorizontal,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_LEFT));
addAttributeProcessor(Attributes.View.CenterInParent,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_RIGHT));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.AlignParentTop,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_END));
addAttributeProcessor(Attributes.View.CenterVertical,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_START));
}
}

Fixed version (ground truth):
protected void registerAttributeProcessors(){
  addAttributeProcessor(Attributes.View.OnClick,new EventProcessor<V>(){
    @Override public void setOnEventListener(    final V view,    final Value value){
      view.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          fireEvent((ProteusView)view,EventType.OnClick,value);
        }
      }
);
    }
  }
);
  addAttributeProcessor(Attributes.View.Background,new DrawableResourceProcessor<V>(){
    @Override public void setDrawable(    V view,    Drawable drawable){
      if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        view.setBackgroundDrawable(drawable);
      }
 else {
        view.setBackground(drawable);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Height,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams != null) {
        layoutParams.height=(int)dimension;
        view.setLayoutParams(layoutParams);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Width,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams != null) {
        layoutParams.width=(int)dimension;
        view.setLayoutParams(layoutParams);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Weight,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      LinearLayout.LayoutParams layoutParams;
      if (view.getLayoutParams() instanceof LinearLayout.LayoutParams) {
        layoutParams=(LinearLayout.LayoutParams)view.getLayoutParams();
        layoutParams.weight=ParseHelper.parseFloat(value);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.LayoutGravity,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      ViewGroup.LayoutParams layoutParams=view.getLayoutParams();
      if (layoutParams instanceof LinearLayout.LayoutParams) {
        LinearLayout.LayoutParams linearLayoutParams=(LinearLayout.LayoutParams)layoutParams;
        linearLayoutParams.gravity=ParseHelper.parseGravity(value);
        view.setLayoutParams(layoutParams);
      }
 else       if (layoutParams instanceof FrameLayout.LayoutParams) {
        FrameLayout.LayoutParams linearLayoutParams=(FrameLayout.LayoutParams)layoutParams;
        linearLayoutParams.gravity=ParseHelper.parseGravity(value);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Padding,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding((int)dimension,(int)dimension,(int)dimension,(int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingLeft,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding((int)dimension,view.getPaddingTop(),view.getPaddingRight(),view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingTop,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),(int)dimension,view.getPaddingRight(),view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingRight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),view.getPaddingTop(),(int)dimension,view.getPaddingBottom());
    }
  }
);
  addAttributeProcessor(Attributes.View.PaddingBottom,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setPadding(view.getPaddingLeft(),view.getPaddingTop(),view.getPaddingRight(),(int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.Margin,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins((int)dimension,(int)dimension,(int)dimension,(int)dimension);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginLeft,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins((int)dimension,layoutParams.topMargin,layoutParams.rightMargin,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginTop,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,(int)dimension,layoutParams.rightMargin,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginRight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,layoutParams.topMargin,(int)dimension,layoutParams.bottomMargin);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MarginBottom,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams layoutParams;
        layoutParams=(ViewGroup.MarginLayoutParams)view.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin,layoutParams.topMargin,layoutParams.rightMargin,(int)dimension);
        view.setLayoutParams(layoutParams);
      }
 else {
        if (ProteusConstants.isLoggingEnabled()) {
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.MinHeight,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setMinimumHeight((int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.MinWidth,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      view.setMinimumWidth((int)dimension);
    }
  }
);
  addAttributeProcessor(Attributes.View.Elevation,new DimensionAttributeProcessor<V>(){
    @Override public void setDimension(    V view,    float dimension){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        view.setElevation(dimension);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.Alpha,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setAlpha(ParseHelper.parseFloat(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Visibility,new AttributeProcessor<V>(){
    @Override public void handle(    V view,    Value value){
      view.setVisibility(ParseHelper.parseVisibility(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Invisibility,new AttributeProcessor<V>(){
    @Override public void handle(    V view,    Value value){
      view.setVisibility(ParseHelper.parseInvisibility(value));
    }
  }
);
  addAttributeProcessor(Attributes.View.Id,new StringAttributeProcessor<V>(){
    @Override public void handle(    final V view,    String value){
      if (view instanceof ProteusView) {
        view.setId(((ProteusView)view).getViewManager().getUniqueViewId(value));
      }
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        final String resourceName=value;
        view.setAccessibilityDelegate(new View.AccessibilityDelegate(){
          @Override public void onInitializeAccessibilityNodeInfo(          View host,          AccessibilityNodeInfo info){
            super.onInitializeAccessibilityNodeInfo(host,info);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
              String normalizedResourceName;
              if (!TextUtils.isEmpty(resourceName)) {
                String id;
                if (resourceName.startsWith(ID_STRING_START_PATTERN)) {
                  id=resourceName.substring(ID_STRING_START_PATTERN.length());
                }
 else                 if (resourceName.startsWith(ID_STRING_START_PATTERN1)) {
                  id=resourceName.substring(ID_STRING_START_PATTERN1.length());
                }
 else {
                  id=resourceName;
                }
                normalizedResourceName=view.getContext().getPackageName() + ID_STRING_NORMALIZED_PATTERN + id;
              }
 else {
                normalizedResourceName="String_Node_Str";
              }
              info.setViewIdResourceName(normalizedResourceName);
            }
          }
        }
);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.ContentDescription,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setContentDescription(value);
    }
  }
);
  addAttributeProcessor(Attributes.View.Clickable,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      boolean clickable=ParseHelper.parseBoolean(value);
      view.setClickable(clickable);
    }
  }
);
  addAttributeProcessor(Attributes.View.Tag,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      view.setTag(value);
    }
  }
);
  addAttributeProcessor(Attributes.View.Enabled,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      boolean enabled=ParseHelper.parseBoolean(value);
      view.setEnabled(enabled);
    }
  }
);
  addAttributeProcessor(Attributes.View.Style,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      ProteusViewManager viewManager=((ProteusView)view).getViewManager();
      Layout layout=viewManager.getLayout();
      Styles styles=viewManager.getStyles();
      TypeParser handler=viewManager.getProteusLayoutInflater().getParser(layout.type);
      if (styles == null) {
        return;
      }
      String[] styleSet=value.split(ProteusConstants.STYLE_DELIMITER);
      for (      String styleName : styleSet) {
        if (styles.contains(styleName)) {
          process(styles.getStyle(styleName),layout,(ProteusView)view,(handler != null ? handler : ViewParser.this),viewManager.getProteusLayoutInflater());
        }
      }
    }
    private void process(    Map<Integer,Value> style,    Layout layout,    ProteusView proteusView,    TypeParser handler,    ProteusLayoutInflater builder){
      for (      Map.Entry<Integer,Value> entry : style.entrySet()) {
        builder.handleAttribute(handler,proteusView,entry.getKey(),entry.getValue());
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.TransitionName,new StringAttributeProcessor<V>(){
    @Override public void handle(    V view,    String value){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        view.setTransitionName(value);
      }
    }
  }
);
  addAttributeProcessor(Attributes.View.RequiresFadingEdge,new StringAttributeProcessor<V>(){
    private final String NONE="String_Node_Str";
    private final String BOTH="String_Node_Str";
    private final String VERTICAL="String_Node_Str";
    private final String HORIZONTAL="String_Node_Str";
    @Override public void handle(    V view,    String value){
switch (value) {
case NONE:
        view.setVerticalFadingEdgeEnabled(false);
      view.setHorizontalFadingEdgeEnabled(false);
    break;
case BOTH:
  view.setVerticalFadingEdgeEnabled(true);
view.setHorizontalFadingEdgeEnabled(true);
break;
case VERTICAL:
view.setVerticalFadingEdgeEnabled(true);
view.setHorizontalFadingEdgeEnabled(false);
break;
case HORIZONTAL:
view.setVerticalFadingEdgeEnabled(false);
view.setHorizontalFadingEdgeEnabled(true);
break;
default :
view.setVerticalFadingEdgeEnabled(false);
view.setHorizontalFadingEdgeEnabled(false);
break;
}
}
}
);
addAttributeProcessor(Attributes.View.FadingEdgeLength,new StringAttributeProcessor<V>(){
@Override public void handle(V view,String value){
view.setFadingEdgeLength(ParseHelper.parseInt(value));
}
}
);
addAttributeProcessor(Attributes.View.Animation,new TweenAnimationResourceProcessor<V>(){
@Override public void setAnimation(V view,Animation animation){
view.setAnimation(animation);
}
}
);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.TextAlignment,new StringAttributeProcessor<V>(){
@SuppressLint("String_Node_Str") @Override public void handle(V view,String value){
Integer textAlignment=ParseHelper.parseTextAlignment(value);
if (null != textAlignment) {
view.setTextAlignment(textAlignment);
}
}
}
);
}
addAttributeProcessor(Attributes.View.Above,createRelativeLayoutRuleProcessor(RelativeLayout.ABOVE));
addAttributeProcessor(Attributes.View.AlignBaseline,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_BASELINE));
addAttributeProcessor(Attributes.View.AlignBottom,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_BOTTOM));
addAttributeProcessor(Attributes.View.AlignLeft,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_LEFT));
addAttributeProcessor(Attributes.View.AlignRight,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_RIGHT));
addAttributeProcessor(Attributes.View.AlignTop,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_TOP));
addAttributeProcessor(Attributes.View.Below,createRelativeLayoutRuleProcessor(RelativeLayout.BELOW));
addAttributeProcessor(Attributes.View.ToLeftOf,createRelativeLayoutRuleProcessor(RelativeLayout.LEFT_OF));
addAttributeProcessor(Attributes.View.ToRightOf,createRelativeLayoutRuleProcessor(RelativeLayout.RIGHT_OF));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.AlignEnd,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_END));
addAttributeProcessor(Attributes.View.AlignStart,createRelativeLayoutRuleProcessor(RelativeLayout.ALIGN_START));
addAttributeProcessor(Attributes.View.ToEndOf,createRelativeLayoutRuleProcessor(RelativeLayout.END_OF));
addAttributeProcessor(Attributes.View.ToStartOf,createRelativeLayoutRuleProcessor(RelativeLayout.START_OF));
}
addAttributeProcessor(Attributes.View.AlignParentTop,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_TOP));
addAttributeProcessor(Attributes.View.AlignParentRight,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_RIGHT));
addAttributeProcessor(Attributes.View.AlignParentBottom,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_BOTTOM));
addAttributeProcessor(Attributes.View.AlignParentLeft,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_LEFT));
addAttributeProcessor(Attributes.View.CenterHorizontal,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_HORIZONTAL));
addAttributeProcessor(Attributes.View.CenterVertical,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_VERTICAL));
addAttributeProcessor(Attributes.View.CenterInParent,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.CENTER_IN_PARENT));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
addAttributeProcessor(Attributes.View.AlignParentStart,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_START));
addAttributeProcessor(Attributes.View.AlignParentEnd,createRelativeLayoutBooleanRuleProcessor(RelativeLayout.ALIGN_PARENT_END));
}
}