Search in sources :

Example 1 with TintImageView

use of com.bilibili.magicasakura.widgets.TintImageView in project remusic by aa112901.

the class QuickControlsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.bottom_nav, container, false);
    this.rootView = rootView;
    mPlayPause = (TintImageView) rootView.findViewById(R.id.control);
    mProgress = (TintProgressBar) rootView.findViewById(R.id.song_progress_normal);
    mTitle = (TextView) rootView.findViewById(R.id.playbar_info);
    mArtist = (TextView) rootView.findViewById(R.id.playbar_singer);
    mAlbumArt = (SimpleDraweeView) rootView.findViewById(R.id.playbar_img);
    next = (ImageView) rootView.findViewById(R.id.play_next);
    playQueue = (ImageView) rootView.findViewById(R.id.play_list);
    mProgress.setProgressTintList(ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary));
    mProgress.postDelayed(mUpdateProgress, 0);
    mPlayPause.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mPlayPause.setImageResource(MusicPlayer.isPlaying() ? R.drawable.playbar_btn_pause : R.drawable.playbar_btn_play);
            mPlayPause.setImageTintList(R.color.theme_color_primary);
            if (MusicPlayer.getQueueSize() == 0) {
                Toast.makeText(MainApplication.context, getResources().getString(R.string.queue_is_empty), Toast.LENGTH_SHORT).show();
            } else {
                HandlerUtil.getInstance(MainApplication.context).postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        MusicPlayer.playOrPause();
                    }
                }, 60);
            }
        }
    });
    next.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    MusicPlayer.next();
                }
            }, 60);
        }
    });
    playQueue.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    PlayQueueFragment playQueueFragment = new PlayQueueFragment();
                    playQueueFragment.show(getFragmentManager(), "playqueueframent");
                }
            }, 60);
        }
    });
    rootView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainApplication.context, PlayingActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            MainApplication.context.startActivity(intent);
        }
    });
    return rootView;
}
Also used : PlayingActivity(com.wm.remusic.activity.PlayingActivity) Handler(android.os.Handler) Intent(android.content.Intent) ImageView(android.widget.ImageView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

Intent (android.content.Intent)1 Handler (android.os.Handler)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 TintImageView (com.bilibili.magicasakura.widgets.TintImageView)1 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)1 PlayingActivity (com.wm.remusic.activity.PlayingActivity)1