Beispiel #1
0
        @Override
        public void run() {
          startAds();

          // Create congrats message TODO add message about scrap once upgrading is implemented
          String r = (mFinalScore == 1) ? "robot" : "robots";
          String congratsMessage = "Congrats, you destroyed " + mFinalScore + " " + r;

          mMessageView.setText(congratsMessage);

          mNameInput.setText(GameApp.CurrentUser.GetName());

          mGameOverLayout.setVisibility(View.VISIBLE);

          Animation expand = AnimationUtils.loadAnimation(me, R.anim.expand);
          expand.setAnimationListener(
              new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                  mSubmitLayout.setVisibility(View.VISIBLE);
                }

                @Override
                public void onAnimationEnd(Animation animation) {}

                @Override
                public void onAnimationRepeat(Animation animation) {}
              });

          mSubmitLayout.startAnimation(expand);
          mSubmitLayout.invalidate();
        }
Beispiel #2
0
        @Override
        public void run() {
          // Make sure the user entered a name. Quit if they didn't
          final String name = mNameInput.getText().toString();
          if (name.trim().isEmpty()) {
            Toast.makeText(me, "Please enter a name", Toast.LENGTH_SHORT).show();
            return;
          }

          // Update user profile
          mFinalName = name;
          GameApp.CurrentUser.SetName(name);

          // Create the animation to shrink the submit layout
          Animation collapse = AnimationUtils.loadAnimation(me, R.anim.collapse);
          collapse.setAnimationListener(
              new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {}

                @Override
                public void onAnimationEnd(Animation animation) {
                  onCollapseEnd();
                }

                @Override
                public void onAnimationRepeat(Animation animation) {}
              });
          mSubmitLayout.startAnimation(collapse);
          mSubmitLayout.invalidate();
        }