Code example for RelativeLayout

Methods: getHeight, getWidth, requestFocus, setVisibility, startAnimation

0
    FlipAnimation rotation;
    //final float centerX = m_FrontFace.getWidth() / 2.0f; 
    //final float centerY = m_FrontFace.getHeight() / 2.0f; 
    final float centerX = (m_Pivot == PIVOT_LEFT) ? 
        0 : ((m_Pivot == PIVOT_CENTER) ? 
            (m_FrontFace.getWidth() / 2.0f) : m_FrontFace.getWidth()) ;
    final float centerY = (m_Pivot == PIVOT_LEFT) ? 
        0 : ((m_Pivot == PIVOT_CENTER) ? 
            (m_FrontFace.getHeight() / 2.0f) : m_FrontFace.getHeight()) ;
     
    if (frontFace) {
      m_FrontFace.setVisibility(View.GONE);
      m_BackFace.setVisibility(View.VISIBLE);
      m_BackFace.requestFocus();
      rotation = new FlipAnimation(-90, 0, centerX, centerY, 
                                    ((m_Direction==DIRECTION_VERTICAL) ? false : true));
    } 
    else { 
      m_BackFace.setVisibility(View.GONE);
      m_FrontFace.setVisibility(View.VISIBLE);
      m_FrontFace.requestFocus();
      rotation = new FlipAnimation(90, 0, centerX, centerY,
                                    ((m_Direction==DIRECTION_VERTICAL) ? false : true));
    } 
     
    rotation.setDuration(m_HalfAnimationDuration);
    rotation.setFillAfter(true);
     
    if (m_InterpolatorType==INTERPOLATOR_LINEAR)
      rotation.setInterpolator(new LinearInterpolator());
    else 
      rotation.setInterpolator(new DecelerateInterpolator());
     
    rotation.setAnimationListener(new EndListener());
     
    if (frontFace)
      m_BackFace.startAnimation(rotation);
    else 
      m_FrontFace.startAnimation(rotation);
  } 
   
  private final class HalfWayListener implements  Animation.AnimationListener {
    private boolean m_FrontFace;