use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class FavouritesFragment method updateFavFragment.
@Override
public void updateFavFragment() {
if (HomeActivity.favouriteTracks.getFavourite().size() > 0) {
UnifiedTrack ut = HomeActivity.favouriteTracks.getFavourite().get(0);
if (ut.getType()) {
LocalTrack lt = ut.getLocalTrack();
imgLoader.DisplayImage(lt.getPath(), backdrop);
} else {
Track t = ut.getStreamTrack();
Picasso.with(getContext()).load(t.getArtworkURL()).resize(100, 100).error(R.drawable.ic_default).placeholder(R.drawable.ic_default).into(backdrop);
}
}
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class FolderFragment method initializeHeaderImages.
public void initializeHeaderImages(View v) {
imgView[0] = (ImageView) v.findViewById(R.id.all_folder_img_1);
imgView[1] = (ImageView) v.findViewById(R.id.all_folder_img_2);
imgView[2] = (ImageView) v.findViewById(R.id.all_folder_img_3);
imgView[3] = (ImageView) v.findViewById(R.id.all_folder_img_4);
imgView[4] = (ImageView) v.findViewById(R.id.all_folder_img_5);
imgView[5] = (ImageView) v.findViewById(R.id.all_folder_img_6);
imgView[6] = (ImageView) v.findViewById(R.id.all_folder_img_7);
imgView[7] = (ImageView) v.findViewById(R.id.all_folder_img_8);
imgView[8] = (ImageView) v.findViewById(R.id.all_folder_img_9);
imgView[9] = (ImageView) v.findViewById(R.id.all_folder_img_10);
int numFolders = HomeActivity.allMusicFolders.getMusicFolders().size();
MusicFolder mf1, mf2;
if (numFolders == 0) {
for (int i = 0; i < 10; i++) {
imgLoader.DisplayImage("folder" + i, imgView[i]);
}
} else if (numFolders == 1) {
mf1 = HomeActivity.allMusicFolders.getMusicFolders().get(0);
for (int i = 0; i < Math.min(10, mf1.getLocalTracks().size()); i++) {
imgLoader.DisplayImage(mf1.getLocalTracks().get(i).getPath(), imgView[i]);
}
if (mf1.getLocalTracks().size() < 10) {
for (int i = mf1.getLocalTracks().size(); i < 10; i++) {
imgLoader.DisplayImage("folder" + i, imgView[i]);
}
}
} else {
mf1 = HomeActivity.allMusicFolders.getMusicFolders().get(0);
mf2 = HomeActivity.allMusicFolders.getMusicFolders().get(1);
for (int i = 0; i < Math.min(10, mf1.getLocalTracks().size()); i++) {
imgLoader.DisplayImage(mf1.getLocalTracks().get(i).getPath(), imgView[i]);
}
if (mf1.getLocalTracks().size() < 10) {
if (mf2.getLocalTracks().size() >= (10 - mf1.getLocalTracks().size())) {
for (int i = mf1.getLocalTracks().size(); i < 10; i++) {
LocalTrack lt = mf2.getLocalTracks().get(i - mf1.getLocalTracks().size());
imgLoader.DisplayImage(lt.getPath(), imgView[i]);
}
} else {
for (int i = mf1.getLocalTracks().size(); i < mf1.getLocalTracks().size() + mf2.getLocalTracks().size(); i++) {
LocalTrack lt = mf2.getLocalTracks().get(i - mf1.getLocalTracks().size());
imgLoader.DisplayImage(lt.getPath(), imgView[i]);
}
for (int i = mf1.getLocalTracks().size() + mf2.getLocalTracks().size(); i < 10; i++) {
imgLoader.DisplayImage("folder" + i, imgView[i]);
}
}
}
}
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class FolderRecyclerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
MusicFolder mf = musicFolders.get(position);
List<LocalTrack> list = mf.getLocalTracks();
// holder.playListName.setText(mf.getFolderName() + " (" + mf.getLocalTracks().size() + ")");
holder.playListName.setText(mf.getFolderName());
if (list.size() >= 3) {
String[] names = new String[3];
for (int i = 0; i < 3; i++) {
names[i] = list.get(i).getTitle();
imgLoader.DisplayImage(list.get(i).getPath(), holder.img[i]);
holder.name[i].setText(names[i]);
}
holder.continuedSymbol.setVisibility(View.VISIBLE);
} else {
int sz = list.size();
String[] names = new String[3];
for (int i = 0; i < sz; i++) {
names[i] = list.get(i).getTitle();
imgLoader.DisplayImage(list.get(i).getPath(), holder.img[i]);
holder.name[i].setText(names[i]);
}
}
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class HomeActivity method addArtistToQueue.
@Override
public void addArtistToQueue() {
List<LocalTrack> list = tempArtist.getArtistSongs();
for (LocalTrack lt : list) {
HomeActivity.queue.addToQueue(new UnifiedTrack(true, lt, null));
}
if (playerFragment != null && playerFragment.snappyRecyclerView != null) {
playerFragment.snappyRecyclerView.getAdapter().notifyDataSetChanged();
playerFragment.snappyRecyclerView.setTransparency();
}
Toast.makeText(ctx, "Added " + list.size() + " song(s) to queue", Toast.LENGTH_SHORT).show();
}
use of com.sdsmdg.harjot.MusicDNA.models.LocalTrack in project MusicDNA by harjot-oberai.
the class HomeActivity method onQueueItemClicked.
////////////////////////////////////////////////////////////////////////////////////////////////
/*
* QueueFragment callbacks START
* onQueueItemClicked() -> when a song is selected from queue.
* onQueueSave() -> queue save as playlist fab is clicked.
* onQueueClear() -> when queue clear option is selected.
*/
@Override
public void onQueueItemClicked(final int position) {
if (isPlayerVisible && isQueueVisible)
showPlayer3();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
queueCurrentIndex = position;
UnifiedTrack ut = queue.getQueue().get(position);
if (ut.getType()) {
LocalTrack track = ut.getLocalTrack();
localSelectedTrack = track;
streamSelected = false;
localSelected = true;
queueCall = false;
isReloaded = false;
onLocalTrackSelected(position);
} else {
Track track = ut.getStreamTrack();
selectedTrack = track;
streamSelected = true;
localSelected = false;
queueCall = false;
isReloaded = false;
onTrackSelected(position);
}
}
}, 500);
}
Aggregations