Example usage for android.animation AnimatorSet setDuration

List of usage examples for android.animation AnimatorSet setDuration

Introduction

In this page you can find the example usage for android.animation AnimatorSet setDuration.

Prototype

@Override
public AnimatorSet setDuration(long duration) 

Source Link

Document

Sets the length of each of the current child animations of this AnimatorSet.

Usage

From source file:kr.wdream.ui.ChatActivity.java

private void showGifHint() {
    SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig",
            Activity.MODE_PRIVATE);/*w ww .  ja  v a  2s .c  o  m*/
    if (preferences.getBoolean("gifhint", false)) {
        return;
    }
    preferences.edit().putBoolean("gifhint", true).commit();

    if (getParentActivity() == null || fragmentView == null || gifHintTextView != null) {
        return;
    }
    if (!allowContextBotPanelSecond) {
        if (chatActivityEnterView != null) {
            chatActivityEnterView.setOpenGifsTabFirst();
        }
        return;
    }
    SizeNotifierFrameLayout frameLayout = (SizeNotifierFrameLayout) fragmentView;
    int index = frameLayout.indexOfChild(chatActivityEnterView);
    if (index == -1) {
        return;
    }
    chatActivityEnterView.setOpenGifsTabFirst();
    emojiButtonRed = new View(getParentActivity());
    emojiButtonRed.setBackgroundResource(kr.wdream.storyshop.R.drawable.redcircle);
    frameLayout.addView(emojiButtonRed, index + 1,
            LayoutHelper.createFrame(10, 10, Gravity.BOTTOM | Gravity.LEFT, 30, 0, 0, 27));

    gifHintTextView = new TextView(getParentActivity());
    gifHintTextView.setBackgroundResource(kr.wdream.storyshop.R.drawable.tooltip);
    gifHintTextView.setTextColor(Theme.CHAT_GIF_HINT_TEXT_COLOR);
    gifHintTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    gifHintTextView.setPadding(AndroidUtilities.dp(10), 0, AndroidUtilities.dp(10), 0);
    gifHintTextView
            .setText(LocaleController.getString("TapHereGifs", kr.wdream.storyshop.R.string.TapHereGifs));
    gifHintTextView.setGravity(Gravity.CENTER_VERTICAL);
    frameLayout.addView(gifHintTextView, index + 1,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.LEFT | Gravity.BOTTOM, 5, 0, 0, 3));

    AnimatorSet AnimatorSet = new AnimatorSet();
    AnimatorSet.playTogether(ObjectAnimator.ofFloat(gifHintTextView, "alpha", 0.0f, 1.0f),
            ObjectAnimator.ofFloat(emojiButtonRed, "alpha", 0.0f, 1.0f));
    AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animation) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (gifHintTextView == null) {
                        return;
                    }
                    AnimatorSet AnimatorSet = new AnimatorSet();
                    AnimatorSet.playTogether(ObjectAnimator.ofFloat(gifHintTextView, "alpha", 0.0f));
                    AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            if (gifHintTextView != null) {
                                gifHintTextView.setVisibility(View.GONE);
                            }
                        }
                    });
                    AnimatorSet.setDuration(300);
                    AnimatorSet.start();
                }
            }, 2000);
        }
    });
    AnimatorSet.setDuration(300);
    AnimatorSet.start();
}