Example usage for android.widget FrameLayout setAnimation

List of usage examples for android.widget FrameLayout setAnimation

Introduction

In this page you can find the example usage for android.widget FrameLayout setAnimation.

Prototype

public void setAnimation(Animation animation) 

Source Link

Document

Sets the next animation to play for this view.

Usage

From source file:com.osama.cgpacalculator.MainActivity.java

@SuppressLint("InflateParams")
private void showAboutDialog() {
    final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f);
    animation.setDuration(800);//from  ww w.  ja  va2 s . c o m

    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.about_dialog);

    final FrameLayout frame = ((FrameLayout) dialog.findViewById(R.id.about_content_layout));
    frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));

    dialog.findViewById(R.id.credit_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingLi = false;
            if (!isShowingCr) {
                frame.addView(getLayoutInflater().inflate(R.layout.credits_layout, null));
                isShowingCr = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingCr = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.findViewById(R.id.license_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingCr = false;
            if (!isShowingLi) {
                frame.addView(getLayoutInflater().inflate(R.layout.license_layout, null));
                isShowingLi = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingLi = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.show();
}