Code example for RelativeLayout

Methods: getAlpha, ofFloat, setAlpha

0
    public void setHaloMessageNumber(int value, boolean alwaysFlip) {
 
        // Allow transitions only if no overlay is set 
        if (mHaloCurrentOverlay == null) {
            msgNumberAlphaAnimator.cancel(true);
            float oldAlpha = mHaloNumberContainer.getAlpha();
 
            mHaloNumberContainer.setAlpha(1f);
            mHaloNumber.setAlpha(1f);
            mHaloNumberIcon.setAlpha(0f);
            if (value < 1) {
                mHaloNumber.setText("");
                mHaloNumberIcon.setAlpha(1f);                
            } else if (value < 100) {
                mHaloNumber.setText(String.valueOf(value));
            } else { 
                mHaloNumber.setText("+");
            } 
             
            if (value < 1) {
                msgNumberAlphaAnimator.animate(ObjectAnimator.ofFloat(mHaloNumberContainer, "alpha", 0f).setDuration(1000),
                        new DecelerateInterpolator(), null, 1500, null);
            } 
 
            if (!alwaysFlip && oldAlpha == 1f && (value == mHaloMessageNumber || (value > 99 && mHaloMessageNumber > 99))) return;
            msgNumberFlipAnimator.animate(ObjectAnimator.ofFloat(mHaloNumberContainer, "rotationY", -180, 0).setDuration(500),
                        new DecelerateInterpolator(), null);
        } 
        mHaloMessageNumber = value;
    }