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();
}
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;
}
});
}
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);
}
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("");
}
}
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);
}
Aggregations