protected ArrayList<FoldingCellView> prepareViewsForAnimation(ArrayList<Integer> viewHeights,Bitmap titleViewBitmap,Bitmap contentViewBitmap){
  if (viewHeights == null || viewHeights.isEmpty())   throw new IllegalStateException("ViewHeights array must be not null and not empty");
  ArrayList<FoldingCellView> partsList=new ArrayList<>();
  int partWidth=titleViewBitmap.getWidth();
  int yOffset=0;
  for (int i=0; i < viewHeights.size(); i++) {
    int partHeight=viewHeights.get(i);
    Bitmap partBitmap=Bitmap.createBitmap(partWidth,partHeight,Bitmap.Config.ARGB_8888);
    Canvas canvas=new Canvas(partBitmap);
    Rect srcRect=new Rect(0,yOffset,partWidth,yOffset + partHeight);
    Rect destRect=new Rect(0,0,partWidth,partHeight);
    canvas.drawBitmap(contentViewBitmap,srcRect,destRect,null);
    ImageView backView=createImageViewFromBitmap(partBitmap);
    ImageView frontView=null;
    if (i < viewHeights.size() - 1) {
      frontView=(i == 0) ? createImageViewFromBitmap(titleViewBitmap) : createBackSideView(viewHeights.get(i + 1));
    }
    partsList.add(new FoldingCellView(frontView,backView,getContext()));
    yOffset=yOffset + partHeight;
  }
  return partsList;
}

protected ArrayList < FoldingCellView > prepareViewsForAnimation ( ArrayList < Integer > viewHeights , Bitmap titleViewBitmap , Bitmap contentViewBitmap ) { if ( viewHeights == null || viewHeights . isEmpty ( ) ) throw new IllegalStateException ( "ViewHeights array must be not null and not empty" ) ; ArrayList < FoldingCellView > partsList = new ArrayList < > ( ) ; int partWidth = titleViewBitmap . getWidth ( ) ; int yOffset = 0 ; for ( int i = 0 ; i < viewHeights . size ( ) ; i ++ ) { int partHeight = viewHeights . get ( i ) ; Bitmap partBitmap = Bitmap . createBitmap ( partWidth , partHeight , Bitmap . Config . ARGB_8888 ) ; Canvas canvas = new Canvas ( partBitmap ) ; Rect srcRect = new Rect ( 0 , yOffset , partWidth , yOffset + partHeight ) ; Rect destRect = new Rect ( 0 , 0 , partWidth , partHeight ) ; canvas . drawBitmap ( contentViewBitmap , srcRect , destRect , null ) ; ImageView backView = createImageViewFromBitmap ( partBitmap ) ; ImageView frontView = null ; if ( i < viewHeights . size ( ) - 1 ) { frontView = ( i == 0 ) ? createImageViewFromBitmap ( titleViewBitmap ) : createBackSideView ( viewHeights . get ( i + 1 ) ) ; } partsList . add ( new FoldingCellView ( frontView , backView , getContext ( ) ) ) ; yOffset = yOffset + partHeight ; } return partsList ; }
create and prepare list of foldingcellviews with different bitmap parts for fold animation
