예제 #1
0
  private void fadeOutBadge(final Runnable onAnimationComplete) {
    synchronized (lock) {
      if (!animationRunning // animation is already running, so shouldn't
          // start a new one
          && lastIncremented.get() != 0 // counter was reset, in which
          // case it would be
          // unintuitive for the badge
          // to fade
          && badgeTextView.getVisibility() == View.VISIBLE) {
        // animation isn't already showing, and the badge is visible
        animationRunning = true;

        badgeLinearLayout.setVisibility(View.VISIBLE);
        // show an animation for the badge with the textview and the
        // background linearlayout fading out
        Animation fadeOutAnimation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
        fadeOutAnimation.setDuration(ANIMATION_TIME);
        fadeOutAnimation.setAnimationListener(
            new AnimationListener() {

              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationRepeat(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                synchronized (lock) {
                  badgeTextView.setVisibility(View.INVISIBLE);

                  // necessary to update again to set the history text
                  // view correctly
                  onAnimationComplete.run();
                  animationRunning = false;
                }
              }
            });
        badgeTextView.setAnimation(fadeOutAnimation);
        fadeOutAnimation.start();
        TransitionDrawable transitionDrawable =
            (TransitionDrawable) badgeLinearLayout.getBackground();
        transitionDrawable.setCrossFadeEnabled(true);
        transitionDrawable.startTransition(ANIMATION_TIME);
      } else {
        // just don't show it - the animation might already be showing,
        // or maybe the badge is
        // already invisible
        badgeLinearLayout.setVisibility(View.INVISIBLE);
        badgeTextView.setVisibility(View.INVISIBLE);

        // this ensures that the history text view gets updated
        // properly, even if the user
        // exits the activity while the animation is in progress (e.g.
        // by going to the Settings)
        onAnimationComplete.run();
      }
    }
  }
 private void showWaiting(boolean isShow) {
   if (isShow) {
     waitingAnimation.start();
     waitingLayout.setVisibility(ViewGroup.VISIBLE);
   } else {
     waitingAnimation.cancel();
     waitingLayout.setVisibility(View.GONE);
   }
 }
 public void animateRegion() {
   if (regionIV != null) {
     Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in);
     regionIV.setAnimation(anim);
     regionTV.setAnimation(anim);
     anim.setStartOffset(1500);
     anim.setFillAfter(true);
     anim.start();
   }
 }
예제 #4
0
  public static void sacleBreath(View view) {
    //        ScaleAnimation scaleAnimation = new ScaleAnimation(1, to, 1, to,
    // Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    Animation scaleAnimation =
        AnimationUtils.loadAnimation(MyApplication.getContext(), R.anim.scale_animation);

    //        scaleAnimation.setRepeatCount(Animation.INFINITE);
    //		scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setDuration(500);
    view.startAnimation(scaleAnimation);
    scaleAnimation.start();
  }
 /**
  * 播放音乐
  *
  * @param parent
  * @param view
  * @param position
  * @param id
  */
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   //      LogUtil.logInfo(TAG, "onItemClick: "+position);
   //      ToastUtil.showToast(getContext(),""+position);
   List<SongList> songLists = MusicApplication.getMusicPlayer().getSongLists();
   MusicApplication.getMusicPlayer().setMusicListType(SEARCH);
   MusicApplication.getMusicPlayer().setPosition(position);
   String songId = songLists.get(position).getSong_id();
   // LogUtil.logInfo(TAG, "onItemClick: " + songId);
   presenterNetDetial.setSong(songId);
   lvSearchMusic.setVisibility(View.GONE);
   animation =
       new TranslateAnimation(
           0, 0, lvSearchMusic.getHeight() + llNetFragment.getHeight(), llNetFragment.getHeight());
   animation.setDuration(300);
   animation.start();
 }
  /**
   * 设置点击事件,显示相应数据的列表
   *
   * @param v
   */
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.ll_new_list:
        setIntentType(NEW);
        break;
      case R.id.ll_hot_list:
        setIntentType(HOT);
        break;
      case R.id.ll_billboard_list:
        setIntentType(BILLBOARD);
        break;
      case R.id.ll_ktv_list:
        setIntentType(KTV);
        break;
      case R.id.ibtn_local_music:
        if (MusicApplication.getContext().getPlayer().isPlaying()) {
          intentPlayActivity();
          return;
        } else {
          // ToastUtil(getActivity(), "当前没有播放歌曲");
          intentPlayActivity();
        }
        break;
      case R.id.ibtn_music_search:
        String songName = etSearch.getText().toString().trim();
        if (songName != null) {
          lvSearchMusic.setVisibility(View.VISIBLE);
          animation =
              new TranslateAnimation(
                  0,
                  0,
                  llNetFragment.getHeight(),
                  lvSearchMusic.getHeight() + llNetFragment.getHeight());
          animation.setDuration(300);
          animation.start();
          //                    LogUtil.logInfo(TAG, "songName: " + songName);
          presenterNet.loadSearchMusics(songName);
        } else if ("".equals(songName)) {
          ToastUtil.showToast(getContext(), "请输入想听的歌曲");
        }
        break;
    }
    // LogUtil.logInfo(TAG, "Fragment onClick: " + type);

  }
  @Override
  protected void onResume() {
    super.onResume();

    initialize();
    refreshNotes();
    spinnerAnimation.start();
    initializeMap();
    measurementPresenter.registerListener(this);
    initializeRouteOverlay();
    traceOverlay.startDrawing();

    checkConnection();

    updater = new HeatMapUpdater();
    heatMapDetector = detectMapIdle(mapView, HEAT_MAP_UPDATE_TIMEOUT, updater);
    soundTraceDetector = detectMapIdle(mapView, SOUND_TRACE_UPDATE_TIMEOUT, this);
  }
예제 #8
0
 public void startAnim() {
   anim.start();
 }
예제 #9
0
 @Implementation
 public void startAnimation(Animation anim) {
   setAnimation(anim);
   animation.start();
 }