Пример #1
0
  // 初始化歌曲列表
  private void initLocalMusicList() {
    // fileInfos = MediaUtil.getFileInfos(getApplicationContext()); //获取歌曲对象集合
    setListAdpter(MediaUtil.getMusicMaps(fileInfos)); // 显示歌曲列表
    music_siger_tv.setText(fileInfos.get(listPosition).getArtist());
    music_name_tv.setText(fileInfos.get(listPosition).getTitle());
    music_play_bt.setPressed(play_bt_press);
    music_play_bt.setChecked(play_bt_check);

    anim = ObjectAnimator.ofFloat(music_album_iv, "rotation", 0, 360);
    lin = new LinearInterpolator();
    anim.setDuration(6000);
    anim.setRepeatCount(-1);
    anim.setRepeatMode(ObjectAnimator.RESTART);
    anim.setInterpolator(lin); // 匀速

    PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 0f, 1f);
    PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 0, 1f);
    PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 0, 1f);
    animSongName = ObjectAnimator.ofPropertyValuesHolder(music_name_tv, pvhX, pvhY, pvhZ); // 渐现
    animSongName.setDuration(1000);
    animSongName.setRepeatCount(0);
    animSongName.setRepeatMode(ObjectAnimator.RESTART);

    animSongSinger = ObjectAnimator.ofPropertyValuesHolder(music_siger_tv, pvhX, pvhY, pvhZ); // 渐现
    animSongSinger.setDuration(1000);
    animSongSinger.setRepeatCount(0);
    animSongSinger.setRepeatMode(ObjectAnimator.RESTART);
  }
Пример #2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   if (requestCode == 0 && resultCode == 0) {
     Bundle fromLocalData = intent.getExtras();
     listPosition = fromLocalData.getInt("listPosition");
     play_bt_press = fromLocalData.getBoolean("bt_press");
     play_bt_check = fromLocalData.getBoolean("bt_check");
     isFirstTime = fromLocalData.getBoolean("isFirstTime");
     isPlaying = fromLocalData.getBoolean("isPlaying");
     isPause = fromLocalData.getBoolean("isPause");
     msg = fromLocalData.getInt("msg");
     music_siger_tv.setText(fileInfos.get(listPosition).getArtist());
     music_name_tv.setText(fileInfos.get(listPosition).getTitle());
     music_play_bt.setPressed(play_bt_press);
     music_play_bt.setChecked(play_bt_check);
   }
 }
Пример #3
0
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   appState = ((MApplication) getApplicationContext());
   helper = appState.getDBHelper();
   helperFavorite = appState.getDBHelperFavorite();
   fileInfos = appState.getFileInfos();
   music_play_bt.setPressed(play_bt_press);
   music_play_bt.setChecked(play_bt_check);
   setFavoriteDefault(); // 设置是否歌曲收藏状态
   if (anim != null && isPlaying == true) {
     if (!anim.isStarted()) {
       anim.start(); // 开始旋转
     } else {
       anim.resume(); // 继续旋转
     }
   } else {
     anim.pause(); // 停止旋转
   }
 }