0

如何在动画开始和结束时禁用和启用多个文本视图

public void animateKeyBoardButton(TextView param1, EditText param2, boolean b) {
            int i = (param1.getWidth() - param2.getWidth()) / 2;
            int j = (param1.getHeight() - param2.getHeight()) / 2;
            int k = param2.getLeft() - (i + param1.getLeft());
            int m = param2.getTop() - (j + param1.getTop());
            localAnimationSet = new AnimationSet(true);
            ScaleAnimation localScaleAnimation1 = new ScaleAnimation(1.0F, 1.2F,
                    1.0F, 1.2F, 1, 0.5F, 1, 0.5F);
            localScaleAnimation1.setDuration(100L);
            ScaleAnimation localScaleAnimation2 = new ScaleAnimation(1.0F, 0.8F,
                    1.0F, 0.8F, 1, 0.5F, 1, 0.5F);
            localScaleAnimation2.setDuration(100L);
            localScaleAnimation2.setStartOffset(100L);
            TranslateAnimation localTranslateAnimation;

            localTranslateAnimation = new TranslateAnimation(0.0F, k, 0.0F, m);
            localTranslateAnimation.setDuration(200L);
            localTranslateAnimation.setStartOffset(200L);


            localAnimationSet.addAnimation(localTranslateAnimation);
            localAnimationSet.setFillEnabled(true);
            param1.startAnimation(localAnimationSet);
            localAnimationSet.setAnimationListener(new KeyBoardButtonMoveOutListener(param1));
        }

        class KeyBoardButtonMoveOutListener implements Animation.AnimationListener {
            TextView myView;

            public KeyBoardButtonMoveOutListener(TextView arg2) {
                this.myView = arg2;
            }

            public void onAnimationEnd(Animation paramAnimation) 
            {
                AnimationSet localAnimationSet = new AnimationSet(true);
                int i = GameScreen.this.random.nextInt(3);
                int j = 0;
                int k = 0;
                switch (i) {
                default:
                case 0:
                case 1:
                case 2:
                }
                while (true) {
                    TranslateAnimation localTranslateAnimation = new TranslateAnimation(
                            j, 0.0F, k, 0.0F);
                    localTranslateAnimation.setDuration(200L);
                    ScaleAnimation localScaleAnimation1 = new ScaleAnimation(1.0F,
                            1.2F, 1.0F, 1.2F, 1, 0.5F, 1, 0.5F);
                    localScaleAnimation1.setDuration(100L);
                    localScaleAnimation1.setStartOffset(200L);
                    ScaleAnimation localScaleAnimation2 = new ScaleAnimation(1.0F,
                            0.8F, 1.0F, 0.8F, 1, 0.5F, 1, 0.5F);
                    localScaleAnimation2.setDuration(100L);
                    localScaleAnimation2.setStartOffset(300L);
                    localAnimationSet.addAnimation(localScaleAnimation1);
                    localAnimationSet.addAnimation(localScaleAnimation2);
                    localAnimationSet.addAnimation(localTranslateAnimation);
                    localAnimationSet.setFillEnabled(true);

                        GameScreen.this.dest.startAnimation(localAnimationSet);
                        GameScreen.this.dest.setText(str);

                        if(myView==tv1)
                        {
                            tv2.setClickable(true);
                            tv3.setClickable(true);
                            tv4.setClickable(true);
                            tv5.setClickable(true);
                            tv6.setClickable(true);
                            tv7.setClickable(true);
                            tv8.setClickable(true);
                        }

                    return;
                }
            }

            public void onAnimationRepeat(Animation paramAnimation) {
            }

            public void onAnimationStart(Animation paramAnimation) {
                        if(myView==tv1)
                        {
                            tv2.setClickable(false);
                            tv3.setClickable(false);
                            tv4.setClickable(false);
                            tv5.setClickable(false);
                            tv6.setClickable(false);
                            tv7.setClickable(false);
                            tv8.setClickable(false);
                        }
            }
        }

        public class KeyBoardMoveInListener implements Animation.AnimationListener {
            TextView myView;

            public KeyBoardMoveInListener(TextView arg2) {
                this.myView = arg2;
            }

            public void onAnimationEnd(Animation paramAnimation) {

            }

            public void onAnimationRepeat(Animation paramAnimation) {

            }`enter code here`

            public void onAnimationStart(Animation paramAnimation) {

            }
        }
4

0 回答 0