/** Constructor required for XML inflation. */
  public FlipViewController(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // setBackgroundColor(Color.WHITE);

    int orientation = VERTICAL;
    int spinePosition = MIDDLE_SPINE;

    TypedArray a =
        context.getTheme().obtainStyledAttributes(attrs, R.styleable.FlipViewController, 0, 0);

    try {
      int value = a.getInteger(R.styleable.FlipViewController_orientation, VERTICAL);
      if (value == HORIZONTAL) {
        orientation = HORIZONTAL;
      }

      value = a.getInteger(R.styleable.FlipViewController_spinePosition, MIDDLE_SPINE);
      if (value == LEFT_SPINE) {
        spinePosition = LEFT_SPINE;
      }

      value = a.getInteger(R.styleable.FlipViewController_animationBitmapFormat, 0);
      if (value == 1) {
        setAnimationBitmapFormat(Bitmap.Config.ARGB_4444);
      } else if (value == 2) {
        setAnimationBitmapFormat(Bitmap.Config.RGB_565);
      } else {
        setAnimationBitmapFormat(Bitmap.Config.ARGB_8888);
      }
    } finally {
      a.recycle();
    }

    init(context, orientation, spinePosition);
  }
 public FlipViewController(Context context, int flipOrientation, int spinePosition) {
   super(context);
   init(context, flipOrientation, spinePosition);
 }