Example usage for android.graphics.drawable AnimationDrawable setAlpha

List of usage examples for android.graphics.drawable AnimationDrawable setAlpha

Introduction

In this page you can find the example usage for android.graphics.drawable AnimationDrawable setAlpha.

Prototype

@Override
    public void setAlpha(int alpha) 

Source Link

Usage

From source file:org.telegram.ui.ChatActivity.java

private void setTypingAnimation(boolean start) {
    TextView subtitle = (TextView) parentActivity.findViewById(R.id.action_bar_subtitle);
    if (subtitle == null) {
        final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_subtitle", "id",
                "android");
        subtitle = (TextView) parentActivity.findViewById(subtitleId);
    }//from w  w w  .j a v  a  2 s.com
    if (subtitle != null) {
        if (start) {
            try {
                if (currentChat != null) {
                    subtitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.typing_dots_chat, 0, 0, 0);
                } else {
                    subtitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.typing_dots, 0, 0, 0);
                }
                subtitle.setCompoundDrawablePadding(Utilities.dp(4));
                AnimationDrawable mAnim = (AnimationDrawable) subtitle.getCompoundDrawables()[0];
                mAnim.setAlpha(200);
                mAnim.start();
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
        } else {
            subtitle.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        }
    }
}