Search in sources :

Example 46 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class PlayerFragment method addToFavourite.

public void addToFavourite() {
    UnifiedTrack ut;
    if (homeActivity.localSelected)
        ut = new UnifiedTrack(true, localTrack, null);
    else
        ut = new UnifiedTrack(false, null, track);
    homeActivity.favouriteTracks.getFavourite().add(ut);
    mCallback.onAddedtoFavfromPlayer();
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)

Example 47 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class QueueRecyclerAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
    if (HomeActivity.queueCurrentIndex == position && !HomeActivity.isReloaded) {
        holder.title.setTextColor(HomeActivity.themeColor);
        holder.title.setTypeface(null, Typeface.BOLD);
        holder.indicator.setVisibility(View.VISIBLE);
        if (PlayerFragment.mMediaPlayer != null) {
            if (PlayerFragment.mMediaPlayer.isPlaying()) {
                holder.indicator.play();
            } else {
                holder.indicator.pause();
            }
        }
    } else {
        holder.title.setTextColor(Color.WHITE);
        holder.title.setTypeface(null, Typeface.NORMAL);
        holder.indicator.setVisibility(View.INVISIBLE);
    }
    holder.holderImg.setColorFilter(HomeActivity.themeColor);
    holder.indicator.setDrawColor(HomeActivity.themeColor);
    UnifiedTrack ut = queue.get(position);
    if (ut.getType()) {
        LocalTrack lt = ut.getLocalTrack();
        imgLoader.DisplayImage(lt.getPath(), holder.art);
        holder.title.setText(lt.getTitle());
        holder.artist.setText(lt.getArtist());
    } else {
        Track t = ut.getStreamTrack();
        Picasso.with(ctx).load(t.getArtworkURL()).resize(100, 100).error(R.drawable.ic_default).placeholder(R.drawable.ic_default).into(holder.art);
        holder.title.setText(t.getTitle());
        holder.artist.setText("");
    }
    holder.holderImg.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
                mDragStartListener.onDragStarted(holder);
            }
            return false;
        }
    });
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) Track(com.sdsmdg.harjot.MusicDNA.models.Track) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) MotionEvent(android.view.MotionEvent)

Example 48 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class QueueRecyclerAdapter method onItemMove.

@Override
public void onItemMove(int fromPosition, int toPosition) {
    UnifiedTrack prev = queue.remove(fromPosition);
    queue.add(toPosition, prev);
    notifyItemMoved(fromPosition, toPosition);
    if (fromPosition == HomeActivity.queueCurrentIndex) {
        HomeActivity.queueCurrentIndex = toPosition;
    } else if (fromPosition > HomeActivity.queueCurrentIndex && toPosition == HomeActivity.queueCurrentIndex) {
        HomeActivity.queueCurrentIndex++;
    } else if (fromPosition < HomeActivity.queueCurrentIndex && toPosition == HomeActivity.queueCurrentIndex) {
        HomeActivity.queueCurrentIndex--;
    }
    ((HomeActivity) ctx).updateVisualizerRecycler();
    new HomeActivity.SaveQueue().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : HomeActivity(com.sdsmdg.harjot.MusicDNA.activities.HomeActivity) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)

Example 49 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class RecentsTrackAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final RecentsTrackAdapter.MyViewHolder holder, int position) {
    UnifiedTrack ut = songList.get(position);
    if (ut.getType()) {
        LocalTrack lt = ut.getLocalTrack();
        imgLoader.DisplayImage(lt.getPath(), holder.art);
        holder.title.setText(lt.getTitle());
        holder.artist.setText(lt.getArtist());
    } else {
        Track t = ut.getStreamTrack();
        Picasso.with(ctx).load(t.getArtworkURL()).resize(100, 100).error(R.drawable.ic_default).placeholder(R.drawable.ic_default).into(holder.art);
        holder.title.setText(t.getTitle());
        holder.artist.setText("");
    }
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) Track(com.sdsmdg.harjot.MusicDNA.models.Track) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)

Example 50 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class RecentsTrackAdapter method onItemMove.

@Override
public void onItemMove(int fromPosition, int toPosition) {
    UnifiedTrack prev = songList.remove(fromPosition);
    songList.add(toPosition, prev);
    notifyItemMoved(fromPosition, toPosition);
    new HomeActivity.SaveRecents().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : HomeActivity(com.sdsmdg.harjot.MusicDNA.activities.HomeActivity) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)

Aggregations

UnifiedTrack (com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)51 LocalTrack (com.sdsmdg.harjot.MusicDNA.models.LocalTrack)25 RecyclerView (android.support.v7.widget.RecyclerView)17 View (android.view.View)17 Track (com.sdsmdg.harjot.MusicDNA.models.Track)16 ImageView (android.widget.ImageView)14 TextView (android.widget.TextView)14 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)11 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 ClickItemTouchListener (com.sdsmdg.harjot.MusicDNA.clickitemtouchlistener.ClickItemTouchListener)11 TextPaint (android.text.TextPaint)9 Playlist (com.sdsmdg.harjot.MusicDNA.models.Playlist)8 CustomLocalBottomSheetDialog (com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog)7 ShowcaseView (com.github.amlcurran.showcaseview.ShowcaseView)6 HomeActivity (com.sdsmdg.harjot.MusicDNA.activities.HomeActivity)6 CustomGeneralBottomSheetDialog (com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomGeneralBottomSheetDialog)6 Button (android.widget.Button)5 VisualizerView (com.sdsmdg.harjot.MusicDNA.visualizers.VisualizerView)4 Dialog (android.app.Dialog)3 Handler (android.os.Handler)3