Search in sources :

Example 1 with PlayQueueFragment

use of com.wm.remusic.fragment.PlayQueueFragment in project remusic by aa112901.

the class PlayingActivity method setTools.

private void setTools() {
    mPlayingmode.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            MusicPlayer.cycleRepeat();
            updatePlaymode();
        }
    });
    mPre.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // MusicPlayer.previous(PlayingActivity.this.getApplication(), true);
            Message msg = new Message();
            msg.what = PRE_MUSIC;
            mPlayHandler.sendMessage(msg);
        }
    });
    mControl.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (MusicPlayer.isPlaying()) {
                mControl.setImageResource(R.drawable.play_rdi_btn_pause);
            } else {
                mControl.setImageResource(R.drawable.play_rdi_btn_play);
            }
            if (MusicPlayer.getQueueSize() != 0) {
                MusicPlayer.playOrPause();
            }
        }
    });
    mNext.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mRotateAnim != null) {
                mRotateAnim.end();
                mRotateAnim = null;
            }
            //                mHandler.removeCallbacks(mNextRunnable);
            //                mHandler.postDelayed(mNextRunnable,300);
            Message msg = new Message();
            msg.what = NEXT_MUSIC;
            mPlayHandler.sendMessage(msg);
        //   MusicPlayer.mNext();
        }
    });
    mPlaylist.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            PlayQueueFragment playQueueFragment = new PlayQueueFragment();
            playQueueFragment.show(getSupportFragmentManager(), "playlistframent");
        }
    });
    mMore.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SimpleMoreFragment moreFragment = SimpleMoreFragment.newInstance(MusicPlayer.getCurrentAudioId());
            moreFragment.show(getSupportFragmentManager(), "music");
        }
    });
    mFav.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (isFav) {
                mPlaylistsManager.removeItem(PlayingActivity.this, IConstants.FAV_PLAYLIST, MusicPlayer.getCurrentAudioId());
                mFav.setImageResource(R.drawable.play_rdi_icn_love);
                isFav = false;
            } else {
                try {
                    MusicInfo info = MusicPlayer.getPlayinfos().get(MusicPlayer.getCurrentAudioId());
                    mPlaylistsManager.insertMusic(PlayingActivity.this, IConstants.FAV_PLAYLIST, info);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                mFav.setImageResource(R.drawable.play_icn_loved);
                isFav = true;
            }
            Intent intent = new Intent(IConstants.PLAYLIST_COUNT_CHANGED);
            sendBroadcast(intent);
        }
    });
}
Also used : Message(android.os.Message) PlayQueueFragment(com.wm.remusic.fragment.PlayQueueFragment) SimpleMoreFragment(com.wm.remusic.fragment.SimpleMoreFragment) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) LrcView(com.wm.remusic.lrc.LrcView) MusicInfo(com.wm.remusic.info.MusicInfo) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

Intent (android.content.Intent)1 Message (android.os.Message)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 PlayQueueFragment (com.wm.remusic.fragment.PlayQueueFragment)1 SimpleMoreFragment (com.wm.remusic.fragment.SimpleMoreFragment)1 MusicInfo (com.wm.remusic.info.MusicInfo)1 LrcView (com.wm.remusic.lrc.LrcView)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1