use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class NewPlaylistRecyclerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
LocalTrack track = localTracks.get(position);
holder.title.setText(track.getTitle());
holder.artist.setText(track.getArtist());
LocalTrack lt = localTracks.get(position);
if (HomeActivity.finalSelectedTracks.contains(lt)) {
holder.cb.setChecked(true);
} else {
holder.cb.setChecked(false);
}
imgLoader.DisplayImage(track.getPath(), holder.art);
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack 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.LocalTrack 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.LocalTrack in project MusicDNA by harjot-oberai.
the class FolderContentFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.getLayoutParams().height = 0;
else
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
fragmentTitle = (TextView) view.findViewById(R.id.folder_fragment_title);
if (SplashActivity.tf4 != null)
fragmentTitle.setTypeface(SplashActivity.tf4);
title = (TextView) view.findViewById(R.id.folder_title);
title.setText(HomeActivity.tempMusicFolder.getFolderName());
songsText = (TextView) view.findViewById(R.id.folder_tracks_text);
String s = "";
if (HomeActivity.tempMusicFolder.getLocalTracks().size() > 1)
s = "Songs";
else
s = "Song";
songsText.setText(HomeActivity.tempMusicFolder.getLocalTracks().size() + " " + s);
backBtn = (ImageView) view.findViewById(R.id.folder_content_back_btn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
addToQueueIcon = (ImageView) view.findViewById(R.id.add_folder_to_queue_icon);
addToQueueIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.folderAddToQueue();
}
});
backdrop = (ImageView) view.findViewById(R.id.folder_backdrop);
LocalTrack lt = HomeActivity.tempFolderContent.get(0);
imgLoader.DisplayImage(lt.getPath(), backdrop);
folderContentRecycler = (RecyclerView) view.findViewById(R.id.folder_content_recycler);
fContentAdapter = new LocalTrackRecyclerAdapter(HomeActivity.tempFolderContent, getContext());
mLayoutManager2 = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
folderContentRecycler.setLayoutManager(mLayoutManager2);
folderContentRecycler.setItemAnimator(new DefaultItemAnimator());
folderContentRecycler.setAdapter(fContentAdapter);
folderContentRecycler.addOnItemTouchListener(new ClickItemTouchListener(folderContentRecycler) {
@Override
public boolean onClick(RecyclerView parent, View view, int position, long id) {
LocalTrack track = HomeActivity.tempMusicFolder.getLocalTracks().get(position);
if (HomeActivity.queue.getQueue().size() == 0) {
HomeActivity.queueCurrentIndex = 0;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.queueCurrentIndex == HomeActivity.queue.getQueue().size() - 1) {
HomeActivity.queueCurrentIndex++;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.isReloaded) {
HomeActivity.isReloaded = false;
HomeActivity.queueCurrentIndex = HomeActivity.queue.getQueue().size();
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else {
HomeActivity.queue.getQueue().add(++HomeActivity.queueCurrentIndex, new UnifiedTrack(true, track, null));
}
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onFolderContentItemClick(position);
return true;
}
@Override
public boolean onLongClick(RecyclerView parent, View view, final int position, long id) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.tempMusicFolder.getLocalTracks().get(position), null);
CustomGeneralBottomSheetDialog generalBottomSheetDialog = new CustomGeneralBottomSheetDialog();
generalBottomSheetDialog.setPosition(position);
generalBottomSheetDialog.setTrack(ut);
generalBottomSheetDialog.setFragment("Folder");
generalBottomSheetDialog.show(getActivity().getSupportFragmentManager(), "general_bottom_sheet_dialog");
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
playAllFAB = (FloatingActionButton) view.findViewById(R.id.folder_play_all_fab);
playAllFAB.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
playAllFAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.onFolderContentPlayAll();
}
});
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class FavouriteTrackAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
UnifiedTrack ut = favouriteList.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;
}
});
}
Aggregations