@NonNull private NinePatchDrawable addTopLeftPatch(boolean isShadow,int xTo,int yTop){
  NinePatchDrawable topStartDrawable;
  NinePatchDrawable topStartBorderDrawable;
  if (mBlock.getPreviousConnection() != null) {
    mHelper.setPointMaybeFlip(mPreviousConnectorOffset,mOutputConnectorMargin,yTop);
    topStartDrawable=getColoredPatchDrawable(isShadow ? R.drawable.top_start_previous_shadow : R.drawable.top_start_previous);
    topStartBorderDrawable=mPatchManager.getPatchDrawable(R.drawable.top_start_previous_border);
    mPreviousConnectorHighlightPatch=mPatchManager.getPatchDrawable(R.drawable.top_start_previous_connection);
  }
 else   if (mBlock.getOutputConnection() != null) {
    mHelper.setPointMaybeFlip(mOutputConnectorOffset,mOutputConnectorMargin,yTop);
    topStartDrawable=getColoredPatchDrawable(isShadow ? R.drawable.top_start_output_shadow : R.drawable.top_start_output);
    topStartBorderDrawable=mPatchManager.getPatchDrawable(R.drawable.top_start_output_border);
    mOutputConnectorHighlightPatch=mPatchManager.getPatchDrawable(R.drawable.top_start_output_connection);
  }
 else   if (mUseHat) {
    topStartDrawable=getColoredPatchDrawable(isShadow ? R.drawable.top_start_hat_shadow : R.drawable.top_start_hat);
    topStartBorderDrawable=mPatchManager.getPatchDrawable(R.drawable.top_start_hat_border);
  }
 else {
    topStartDrawable=getColoredPatchDrawable(isShadow ? R.drawable.top_start_default_shadow : R.drawable.top_start_default);
    topStartBorderDrawable=mPatchManager.getPatchDrawable(R.drawable.top_start_default_border);
  }
  mHelper.setRtlAwareBounds(tempRect,mBlockViewSize.x,0,0,xTo,topStartDrawable.getIntrinsicHeight());
  topStartDrawable.setBounds(tempRect);
  topStartBorderDrawable.setBounds(tempRect);
  if (mPreviousConnectorHighlightPatch != null) {
    mPreviousConnectorHighlightPatch.setBounds(tempRect);
  }
  if (mOutputConnectorHighlightPatch != null) {
    mOutputConnectorHighlightPatch.setBounds(tempRect);
  }
  mBlockPatches.add(topStartDrawable);
  mBlockBorderPatches.add(topStartBorderDrawable);
  return topStartDrawable;
}

@ NonNull private NinePatchDrawable addTopLeftPatch ( boolean isShadow , int xTo , int yTop ) { NinePatchDrawable topStartDrawable ; NinePatchDrawable topStartBorderDrawable ; if ( mBlock . getPreviousConnection ( ) != null ) { mHelper . setPointMaybeFlip ( mPreviousConnectorOffset , mOutputConnectorMargin , yTop ) ; topStartDrawable = getColoredPatchDrawable ( isShadow ? R . drawable . top_start_previous_shadow : R . drawable . top_start_previous ) ; topStartBorderDrawable = mPatchManager . getPatchDrawable ( R . drawable . top_start_previous_border ) ; mPreviousConnectorHighlightPatch = mPatchManager . getPatchDrawable ( R . drawable . top_start_previous_connection ) ; } else if ( mBlock . getOutputConnection ( ) != null ) { mHelper . setPointMaybeFlip ( mOutputConnectorOffset , mOutputConnectorMargin , yTop ) ; topStartDrawable = getColoredPatchDrawable ( isShadow ? R . drawable . top_start_output_shadow : R . drawable . top_start_output ) ; topStartBorderDrawable = mPatchManager . getPatchDrawable ( R . drawable . top_start_output_border ) ; mOutputConnectorHighlightPatch = mPatchManager . getPatchDrawable ( R . drawable . top_start_output_connection ) ; } else if ( mUseHat ) { topStartDrawable = getColoredPatchDrawable ( isShadow ? R . drawable . top_start_hat_shadow : R . drawable . top_start_hat ) ; topStartBorderDrawable = mPatchManager . getPatchDrawable ( R . drawable . top_start_hat_border ) ; } else { topStartDrawable = getColoredPatchDrawable ( isShadow ? R . drawable . top_start_default_shadow : R . drawable . top_start_default ) ; topStartBorderDrawable = mPatchManager . getPatchDrawable ( R . drawable . top_start_default_border ) ; } mHelper . setRtlAwareBounds ( tempRect , mBlockViewSize . x , 0 , 0 , xTo , topStartDrawable . getIntrinsicHeight ( ) ) ; topStartDrawable . setBounds ( tempRect ) ; topStartBorderDrawable . setBounds ( tempRect ) ; if ( mPreviousConnectorHighlightPatch != null ) { mPreviousConnectorHighlightPatch . setBounds ( tempRect ) ; } if ( mOutputConnectorHighlightPatch != null ) { mOutputConnectorHighlightPatch . setBounds ( tempRect ) ; } mBlockPatches . add ( topStartDrawable ) ; mBlockBorderPatches . add ( topStartBorderDrawable ) ; return topStartDrawable ; }
add the top - left corner drawable .
